-
-
Notifications
You must be signed in to change notification settings - Fork 449
Closed
Labels
🐛 bugSomething isn't workingSomething isn't working
Description
Describe the bug
When setting lock.format to pylock and running pdm lock
with a dependency pointing to a branch of a GitHub repo I get the following error:
tomlkit.exceptions.ConvertError: Unable to convert an object of <class 'NoneType'> to a TOML item
When using the old format I don't get errors.
To reproduce
- Create a minimal
pyproject.toml
with a Github dependency like
[project]
name = "test"
version = "0.1.0"
dependencies = [
"pony @ git+https://github.com/henri-hulski/pony.git@stubs",
]
requires-python = ">=3.11"
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
- Switch to pylock format:
pdm config lock.format pylock
-
Remove existing lock files.
-
Run
pdm lock -v
Expected Behavior
The command should create successfully pylock.toml
.
Environment Information
PDM version:
2.25.4
Python Interpreter:
/home/test/test/.venv/bin/python (3.11)
Project Root:
/home/test/test
Local Packages:
{
"implementation_name": "cpython",
"implementation_version": "3.11.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "6.12.33+deb12-amd64",
"platform_system": "Linux",
"platform_version": "#1 SMP PREEMPT_DYNAMIC Debian 6.12.33-1~bpo12+1 (2025-07-09)",
"python_full_version": "3.11.2",
"platform_python_implementation": "CPython",
"python_version": "3.11",
"sys_platform": "linux"
}
Verbose Command Output
$ pdm lock -v
pdm.termui: ======== Start resolving requirements ========
pdm.termui: pony @ git+https://github.com/henri-hulski/pony.git@stubs
pdm.termui: Adding requirement python>=3.11
pdm.termui: Adding requirement pony @ git+https://github.com/henri-hulski/pony.git@stubs
pdm.termui: ======== Starting round 0 ========
unearth.vcs.git: Cloning https://github.com/henri-hulski/pony.git (revision: stubs) to /tmp/pdm-build-1rmkfj87
unearth.vcs.git: Resolved https://github.com/henri-hulski/pony.git to commit 60dbddd016d61d4a11e7c030b54bbb697f1b2dc5
pdm.termui: Running PEP 517 backend to get metadata for <Link git+https://github.com/henri-hulski/pony.git@stubs (from None)>
pdm.termui: Preparing environment(Isolated mode) for PEP 517 build...
pdm.termui: ======== Start resolving requirements ========
pdm.termui: Adding requirement python==3.11.2
pdm.termui: Adding requirement setuptools>=61
pdm.termui: ======== Resolution Result ========
pdm.termui: python None
pdm.termui: setuptools 80.9.0
pdm.termui: Fetching hashes for setuptools@80.9.0
pdm.termui: Installing setuptools@80.9.0...
pdm.termui: Using cached response for https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl (from https://pypi.org/simple/setuptools/)>
pdm.termui: Synchronization complete.
pdm.termui: /tmp/pdm-build-env-6ydwn66p-shared/lib/python3.11/site-packages/setuptools/_distutils/dist.py:289: UserWarning: Unknown distribution option: 'test_suite'
pdm.termui: warnings.warn(msg)
pdm.termui: /tmp/pdm-build-env-6ydwn66p-shared/lib/python3.11/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
pdm.termui: !!
pdm.termui:
pdm.termui: ********************************************************************************
pdm.termui: Please consider removing the following classifiers in favor of a SPDX license expression:
pdm.termui:
pdm.termui: License :: OSI Approved :: Apache Software License
pdm.termui:
pdm.termui: See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
pdm.termui: ********************************************************************************
pdm.termui:
pdm.termui: !!
pdm.termui: self._finalize_license_expression()
pdm.termui: running egg_info
pdm.termui: creating pony.egg-info
pdm.termui: writing pony.egg-info/PKG-INFO
pdm.termui: writing dependency_links to pony.egg-info/dependency_links.txt
pdm.termui: writing top-level names to pony.egg-info/top_level.txt
pdm.termui: writing manifest file 'pony.egg-info/SOURCES.txt'
pdm.termui: reading manifest file 'pony.egg-info/SOURCES.txt'
pdm.termui: reading manifest template 'MANIFEST.in'
pdm.termui: warning: no files found matching 'pony/flask/example/templates'
pdm.termui: warning: no files found matching '*.html'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file 'pony.egg-info/SOURCES.txt'
pdm.termui: /tmp/pdm-build-env-6ydwn66p-shared/lib/python3.11/site-packages/setuptools/_distutils/dist.py:289: UserWarning: Unknown distribution option: 'test_suite'
pdm.termui: warnings.warn(msg)
pdm.termui: /tmp/pdm-build-env-6ydwn66p-shared/lib/python3.11/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
pdm.termui: !!
pdm.termui:
pdm.termui: ********************************************************************************
pdm.termui: Please consider removing the following classifiers in favor of a SPDX license expression:
pdm.termui:
pdm.termui: License :: OSI Approved :: Apache Software License
pdm.termui:
pdm.termui: See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
pdm.termui: ********************************************************************************
pdm.termui:
pdm.termui: !!
pdm.termui: self._finalize_license_expression()
pdm.termui: running dist_info
pdm.termui: creating /tmp/pdm-meta-61hombqm/pony.egg-info
pdm.termui: writing /tmp/pdm-meta-61hombqm/pony.egg-info/PKG-INFO
pdm.termui: writing dependency_links to /tmp/pdm-meta-61hombqm/pony.egg-info/dependency_links.txt
pdm.termui: writing top-level names to /tmp/pdm-meta-61hombqm/pony.egg-info/top_level.txt
pdm.termui: writing manifest file '/tmp/pdm-meta-61hombqm/pony.egg-info/SOURCES.txt'
pdm.termui: reading manifest file '/tmp/pdm-meta-61hombqm/pony.egg-info/SOURCES.txt'
pdm.termui: reading manifest template 'MANIFEST.in'
pdm.termui: warning: no files found matching 'pony/flask/example/templates'
pdm.termui: warning: no files found matching '*.html'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file '/tmp/pdm-meta-61hombqm/pony.egg-info/SOURCES.txt'
pdm.termui: creating '/tmp/pdm-meta-61hombqm/pony-0.7.19.dist-info'
pdm.termui: Adding new pin: python None
pdm.termui: ======== Starting round 1 ========
pdm.termui: Adding new pin: pony 0.7.19
pdm.termui: ======== Starting round 2 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: python None
pdm.termui: pony git+https://github.com/henri-hulski/pony.git@60dbddd016d61d4a11e7c030b54bbb697f1b2dc5
Traceback (most recent call last):
File "/home/test/.local/bin/pdm", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/core.py", line 391, in main
return core.main(args or sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/core.py", line 270, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/core.py", line 265, in main
self.handle(project, options)
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/core.py", line 195, in handle
command.handle(project, options)
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/cli/commands/lock.py", line 123, in handle
actions.do_lock(
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/cli/actions.py", line 160, in do_lock
project.lockfile.format_lockfile(result_repo, groups=groups, strategy=lock_strategy)
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/project/lockfile/pylock.py", line 50, in format_lockfile
data = converter.convert(groups)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/formats/pylock.py", line 156, in convert
packages.append(package_table)
File "<frozen _collections_abc>", line 1078, in append
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/tomlkit/items.py", line 1941, in insert
value = item(value, _parent=self)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/tomlkit/items.py", line 138, in item
val[k] = item(v, _parent=val, _sort_keys=_sort_keys)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/tomlkit/items.py", line 138, in item
val[k] = item(v, _parent=val, _sort_keys=_sort_keys)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/test/.local/share/pdm/venv/lib/python3.11/site-packages/tomlkit/items.py", line 212, in item
raise ConvertError(f"Unable to convert an object of {type(value)} to a TOML item")
tomlkit.exceptions.ConvertError: Unable to convert an object of <class 'NoneType'> to a TOML item
Additional Context
When running pdm lock
with the old lock format it works fine.
Are you willing to submit a PR to fix this bug?
- Yes, I would like to submit a PR.
Metadata
Metadata
Assignees
Labels
🐛 bugSomething isn't workingSomething isn't working