Describe the bug
A clear and concise description of what the bug is.
Getting AttributeError: 'list' object has no attribute 'name' when running on the latest PDM
To Reproduce
Steps to reproduce the behavior:
I've created a repo with the code here: https://github.com/amitkparekh/pdm-sync-commit-lock-error-jul-24
I have ruff in my pre-commit but running pdm add ruff -G lint results in the above error. It prevents me from adding any package, regardless of whether or not it's in the pre-commit-config.yaml.
Expected behavior
A clear and concise description of what you expected to happen.
Ruff installs and the pre-commit version updates.
Screenshots
If applicable, add screenshots to help explain your problem.
Traceback
❯ pdm add ruff -G lint -v
INFO: Adding group lint to lockfile
Adding packages to lint dependencies: ruff
STATUS: Resolving dependencies
STATUS: Resolve for environment (>=3.12)
pdm.termui: ======== Start resolving requirements ========
pdm.termui: ruff
pdm.termui: Adding requirement ruff
pdm.termui: Adding requirement python>=3.12
pdm.termui: ======== Starting round 0 ========
STATUS: Resolving: new pin python>=3.12
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
STATUS: Resolving: new pin ruff 0.5.5
pdm.termui: Pinning: ruff 0.5.5
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: Stable pins:
pdm.termui: python None
pdm.termui: ruff 0.5.5
pdm.termui: Fetching hashes for ruff@0.5.5
🔒 Lock successful.
Traceback (most recent call last):
File "/Users/amit/.local/share/mise/installs/pdm/latest/bin/pdm", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/core.py", line 346, in main
return core.main(args or sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/core.py", line 264, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/core.py", line 259, in main
self.handle(project, options)
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/core.py", line 195, in handle
command.handle(project, options)
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/cli/commands/add.py", line 71, in handle
self.do_add(
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/cli/commands/add.py", line 172, in do_add
hooks.try_emit("post_lock", resolution=resolved, dry_run=dry_run)
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/pdm/cli/hooks.py", line 54, in try_emit
pdm_signals.signal(name).send(self.project, hooks=self, **kwargs)
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/blinker/base.py", line 307, in send
result = receiver(sender, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/amit/.local/share/mise/installs/pdm/2.17.1/venv/lib/python3.12/site-packages/sync_pre_commit_lock/pdm_plugin.py", line 130, in on_pdm_lock_check_pre_commit
k: GenericLockedPackage(v.name, v.version) for k, v in resolution.items() if v.name and v.version
^^^^^^
AttributeError: 'list' object has no attribute 'name'
Desktop (please complete the following information):
- OS: macOS
- Package Manager: PDM@2.17.1
- Python@3.12.4
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug is.
Getting
AttributeError: 'list' object has no attribute 'name'when running on the latest PDMTo Reproduce
Steps to reproduce the behavior:
I've created a repo with the code here: https://github.com/amitkparekh/pdm-sync-commit-lock-error-jul-24
I have
ruffin my pre-commit but runningpdm add ruff -G lintresults in the above error. It prevents me from adding any package, regardless of whether or not it's in thepre-commit-config.yaml.Expected behavior
A clear and concise description of what you expected to happen.
Ruff installs and the pre-commit version updates.
Screenshots
If applicable, add screenshots to help explain your problem.
Traceback
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.