pdm icon indicating copy to clipboard operation
pdm copied to clipboard

Unable to pdm sync / install an application with uv without a project name / version

Open taborsarah opened this issue 10 months ago • 1 comments

Describe the bug

When uv is enabled, I am unable to pdm sync or install an applicaction without a project name and version.

To reproduce

Create a new project with a pyproject.toml file w/ no project name or version.

[project]
description = "A demonstration."
authors = [
    {name = "Sarah Tabor", email = "[email protected]"},
]
dependencies = [
    "pandas>=2.2.3"
]
requires-python = ">=3.11,<3.13"
license = {text = "MIT"}

[[tool.pdm.source]]
url = "https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple"
verify_ssl = true
name = "pypi"

Ensure uv is enabled for the project. pdm config use_uv true

Try to pdm install

Expected Behavior

I should be able to use pdm for an application with uv enabled

Environment Information

PDM version: 2.22.3 Python Interpreter: /Users/stabor/Downloads/pdm_uv/.venv/bin/python (3.12) Project Root: /Users/stabor/Downloads/pdm_uv Local Packages:

Usage: pdm info [-h] [-v | -q] [-g] [-p PROJECT_PATH] [--venv [NAME]] [--python | --where | --packages | --env | --json] pdm info: error: unrecognized arguments: -- env

Verbose Command Output

❯ pdm install -v WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated Updating the lock file... WARNING: inherit_metadata strategy is not supported by uv resolver, it will be ignored INFO: Using uv is experimental and might break due to uv updates. Running uv lock command: ['/Users/stabor/.local/bin/uv', 'lock', '-p', '/Users/stabor/Downloads/pdm_uv/.venv/bin/python', '--verbose', '--index-url', 'https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple', '--index-strategy=unsafe-best-match'] DEBUG uv 0.6.5 (bcbcd0a1e 2025-03-06) error: Failed to parse: pyproject.toml Caused by: TOML parse error at line 1, column 1 | 1 | [project] | ^^^^^^^^^ pyproject.toml is using the [project] table, but the required project.name field is not set Traceback (most recent call last): File "/Users/stabor/.local/bin/pdm", line 8, in sys.exit(main()) File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 392, in main return core.main(args or sys.argv[1:]) File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 270, in main raise cast(Exception, err).with_traceback(traceback) from None File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 265, in main self.handle(project, options) File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 195, in handle command.handle(project, options) File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/commands/install.py", line 95, in handle actions.do_lock( File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 133, in do_lock resolved, collected_groups = resolver.resolve() File "/Users/stabor/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/uv.py", line 188, in resolve subprocess.run(uv_lock_command, cwd=self.project.root, check=True) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/Users/stabor/.local/bin/uv', 'lock', '-p', '/Users/stabor/Downloads/pdm_uv/.venv/bin/python', '--verbose', '--index-url', 'https://gitlab.beta.team/api/v4/projects/beta%2Fpypi/packages/pypi/simple', '--index-strategy=unsafe-best-match']' returned non-zero exit status 2.

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • [ ] Yes, I would like to submit a PR.

taborsarah avatar Mar 12 '25 13:03 taborsarah

According to this specification, name is a required key within [project] table.

o-moe avatar Oct 25 '25 08:10 o-moe