pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.86k stars 392 forks source link

2.8.0 breaks resolution overrides #2111

Closed nvllsvm closed 1 year ago

nvllsvm commented 1 year ago

Steps to reproduce

pyproject.toml

[project]
dependencies = [
    "aiormq==4.3.1",
]
requires-python = ">=3.9,<=3.11"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pdm.resolution.overrides]
aiormq = "4.3.1"

Then run pdm install -v

Actual behavior

pdm install -v

Lock file does not exist
Updating the lock file...
python.use_venv is on, creating a virtualenv for this project...
Run command: ['/home/ar/.local/pipx/venvs/pdm/bin/python', '-m', 'virtualenv', '/home/ar/example/.venv', '-p', '/home/ar/.local/share/pyenv/versions/3.9.16/bin/python3.9',
'--prompt=example-3.9', '--no-pip', '--no-setuptools', '--no-wheel']
created virtual environment CPython3.9.16.final.0-64 in 21ms
  creator CPython3Posix(dest=/home/ar/example/.venv, clear=False, no_vcs_ignore=False, global=False)
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Virtualenv is created successfully at /home/ar/example/.venv
STATUS: Resolving dependencies
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   aiormq==4.3.1
pdm.termui:   python>=3.9,<3.11.1
pdm.termui:   Adding requirement aiormq==4.3.1
/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py:234: FutureWarning: .* suffix can only be used with `==` or `!=` operators
  PySpecSet(requires_python)
pdm.termui:   Adding requirement python>=3.9,<3.11.1
pdm.termui: ======== Starting round 0 ========
STATUS: Resolving: new pin python>=3.9,<3.11.1
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
pdm.termui:   Adding requirement pamqp==3.0.1(from aiormq 4.3.1)
pdm.termui:   Adding requirement yarl(from aiormq 4.3.1)
STATUS: Resolving: new pin aiormq 4.3.1
pdm.termui: Pinning: aiormq 4.3.1
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
STATUS: Resolving: new pin pamqp 3.0.1
pdm.termui: Pinning: pamqp 3.0.1
pdm.termui: ======== Ending round 2 ========
pdm.termui: ======== Starting round 3 ========
pdm.termui:   Adding requirement multidict>=4.0(from yarl 1.9.2)
pdm.termui:   Adding requirement idna>=2.0(from yarl 1.9.2)
STATUS: Resolving: new pin yarl 1.9.2
pdm.termui: Pinning: yarl 1.9.2
pdm.termui: ======== Ending round 3 ========
pdm.termui: ======== Starting round 4 ========
STATUS: Resolving: new pin idna 3.4
pdm.termui: Pinning: idna 3.4
pdm.termui: ======== Ending round 4 ========
pdm.termui: ======== Starting round 5 ========
STATUS: Resolving: new pin multidict 6.0.4
pdm.termui: Pinning: multidict 6.0.4
pdm.termui: ======== Ending round 5 ========
pdm.termui: ======== Starting round 6 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: Stable pins:
pdm.termui:      python None
pdm.termui:      aiormq 4.3.1
pdm.termui:       pamqp 3.0.1
pdm.termui:        yarl 1.9.2
pdm.termui:        idna 3.4
pdm.termui:   multidict 6.0.4
STATUS: Fetching hashes for resolved packages...
pdm.termui: Fetching hashes for aiormq@4.3.1
pdm.termui: Fetching hashes for pamqp@3.0.1
pdm.termui: Fetching hashes for idna@3.4
pdm.termui: Fetching hashes for yarl@1.9.2
pdm.termui: Fetching hashes for multidict@6.0.4
πŸ”’ Lock successful
Changes are written to pdm.lock.
STATUS: Resolving packages from lockfile...
STATUS: Fetching hashes for resolved packages...
Synchronizing working set with lock file: 5 to add, 0 to update, 0 to remove

  βœ– Install aiormq 4.3.1 failed
pdm.termui: Error occurs:
Traceback (most recent call last):
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 277, in install_candidate
    self.manager.install(can)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/manager.py", line 33, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
                  ^^^^^^^^^^^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 379, in build
    self.obtain(allow_all=False)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 420, in obtain
    raise CandidateNotFound(
pdm.exceptions.CandidateNotFound: No candidate is found for `aiormq` that matches the environment or hashes
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl (from https://pypi.org/simple/idna/)>
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/1c/c3/b4088361557895542dd353e7d47f6e1d87b00a4c597fd4fa59856e62b4b3/pamqp-3.0.1.tar.gz (from https://pypi.org/simple/pamqp/)>
pdm.termui: Using cached wheel: /home/ar/.cache/pdm/wheels/4c/40/97/19561e2a7a7302766e16d9681c6a0fa53d6b87b8a361d665b5/pamqp-3.0.1-py3-none-any.whl
  βœ” Install idna 3.4 successful
  βœ” Install pamqp 3.0.1 successful
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/11/3d/785761e64dc90fda6feb9bd0459dc55ebe282a7d4564642a4a8ee277e0c0/yarl-1.9.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from https://pypi.org/simple/yarl/)>
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/69/48/2750fd3ace4d778b4e1f7110db3ad637906de3496abc9c450ce726b97337/multidict-6.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from https://pypi.org/simple/multidict/)>
  βœ” Install multidict 6.0.4 successful
  βœ” Install yarl 1.9.2 successful
Retry failed jobs
  βœ– Install aiormq 4.3.1 failed
pdm.termui: Error occurs:
Traceback (most recent call last):
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 277, in install_candidate
    self.manager.install(can)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/manager.py", line 33, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
                  ^^^^^^^^^^^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 379, in build
    self.obtain(allow_all=False)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 420, in obtain
    raise CandidateNotFound(
pdm.exceptions.CandidateNotFound: No candidate is found for `aiormq` that matches the environment or hashes
Traceback (most recent call last):
  File "/home/ar/.local/pipx/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 290, in main
    return Core().main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 208, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 203, in main
    self.handle(project, options)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 157, in handle
    command.handle(project, options)
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/commands/install.py", line 95, in handle
    actions.do_sync(
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 213, in do_sync
    synchronizer.synchronize()
  File "/home/ar/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 445, in synchronize
    raise InstallationError("Some package operations are not complete yet")
pdm.exceptions.InstallationError: Some package operations are not complete yet

Running without the -v flag results in an error log containing this important info:

unearth.evaluator: Skipping link <Link https://files.pythonhosted.org/packages/33/32/9e0f51c6119d668b02832f80fe1f1496e9990717e125a2e9eaea99182685/aiormq-4.3.1-py3-none-any.whl (from https://pypi.org/simple/aiormq/)>: Invalid requires-python: >3.6.*
unearth.evaluator: Skipping link <Link https://files.pythonhosted.org/packages/f2/1b/b59ca6a5e3754793ba3ee691aa310182693a0b4aff3a0c7db7db8d4011cc/aiormq-4.3.1.tar.gz (from https://pypi.org/simple/aiormq/)>: Invalid requires-python: >3.6.*

Expected behavior

I expect pdm install aiorm==4.3.1 regardless of any incompatible/invalid requires-python the package specifies.

Environment Information

PDM version:
  2.8.0
Python Interpreter:
  /home/ar/example/.venv/bin/python (3.9)
Project Root:
  /home/ar/example
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.9.16",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.4.3-zen1-2-zen",
  "platform_system": "Linux",
  "platform_version": "#1 ZEN SMP PREEMPT_DYNAMIC Sat, 15 Jul 2023 20:18:15 +0000",
  "python_full_version": "3.9.16",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}
nvllsvm commented 1 year ago

fixed after upgrading to unearth==0.9.3

nvllsvm commented 1 year ago

Also worth noting that the resolution override isn't necessary when the dependency itself is defined as aiormq==4.3.1.