Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency group with non-normalized name does not work in pdm 2.20.0 #3247

Closed
1 task done
DetachHead opened this issue Nov 1, 2024 · 0 comments · Fixed by #3250
Closed
1 task done

dependency group with non-normalized name does not work in pdm 2.20.0 #3247

DetachHead opened this issue Nov 1, 2024 · 0 comments · Fixed by #3250
Assignees
Labels
🐛 bug Something isn't working

Comments

@DetachHead
Copy link
Contributor

  • I have searched the issue tracker and believe that this is not a duplicate.

according to the PEP for the new dependency groups, names are allowed to have underscores but should be normalized when comparing them. this does not seem to be the case as of pdm 2.20.0 (but they did work in 2.19)

Steps to reproduce

# happens with both the new and the old dependency group format
# [dependency-groups]
[tool.pdm.dev-dependencies]
a = [
    "libcst>=1.5.0",
]
a_b = [
    "libcst==1.1.0",
]
pdm lock --update-reuse -G a_b -v

Actual behavior

it ignores the specified dependency group and instead attempts to install both groups, which results in an error in this case because the dependencies are conflicting

> pdm lock --update-reuse -G a_b -v
Ignoring non-existing groups: a_b
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   libcst>=1.5.0
pdm.termui:   libcst==1.1.0
pdm.termui:   Adding requirement python>=3.9
pdm.termui:   Adding requirement libcst>=1.5.0
pdm.termui:   Adding requirement libcst==1.1.0
ERROR: Unable to find a resolution for libcst
because of the following conflicts:
  libcst==1.1.0 (from project)
  libcst>=1.5.0 (from project)
To fix this, you could loosen the dependency version constraints in pyproject.toml. See https://pdm-project.org/en/latest/usage/lockfile/#solve-the-locking-failure for more details.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Scripts\pdm.EXE\__main__.py", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\core.py", line 378, in main
    return core.main(args or sys.argv[1:])
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\core.py", line 267, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\core.py", line 262, in main
    self.handle(project, options)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\core.py", line 194, in handle
    command.handle(project, options)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\cli\commands\lock.py", line 123, in handle
    actions.do_lock(
    ~~~~~~~~~~~~~~~^
        project,
        ^^^^^^^^
    ...<6 lines>...
        append=options.append,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\user\Documents\asdfads\.pyprojectx\venvs\main-c43ab60f3a327ed2433bc961caec408b-py3.13\Lib\site-packages\pdm\cli\actions.py", line 150, in do_lock
    raise ResolutionImpossible("Unable to find a resolution") from None
resolvelib.resolvers.exceptions.ResolutionImpossible: Unable to find a resolution

Expected behavior

Environment Information

PDM version:
  2.20.0.post1
Python Interpreter:
  C:\Users\user\Documents\asdfads\.venv\Scripts\python.exe (3.13)
Project Root:
  C:/Users/user/Documents/asdfads
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.13.0",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "10",
  "platform_system": "Windows",
  "platform_version": "10.0.19045",
  "python_full_version": "3.13.0",
  "platform_python_implementation": "CPython",
  "python_version": "3.13",
  "sys_platform": "win32"
}
@DetachHead DetachHead added the 🐛 bug Something isn't working label Nov 1, 2024
DetachHead added a commit to DetachHead/basedpyright that referenced this issue Nov 1, 2024
DetachHead added a commit to DetachHead/basedpyright that referenced this issue Nov 1, 2024
DetachHead added a commit to DetachHead/basedpyright that referenced this issue Nov 1, 2024
@frostming frostming self-assigned this Nov 4, 2024
frostming added a commit that referenced this issue Nov 4, 2024
….20.0

Fixes #3247

Signed-off-by: Frost Ming <me@frostming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants