Skip to content

Handle missing project.version field in pyproject.toml #299

@nathanjmcdougall

Description

@nathanjmcdougall

Motivation
When trying to subprocess uv add on this pyproject.toml file:

[project]
name = "example"

I get this error:

E               usethis._integrations.uv.errors.UVDepGroupError: Failed to add 'ruff' to the 'dev' dependency group:
E               Failed to run uv subprocess:
E               stderr='error: Failed to parse: `pyproject.toml`\n  Caused by: TOML parse error at line 5, column 1\n  |\n5 | [project]\r\n  | ^^^^^^^^^^\n`pyproject.toml` is using the `[project]` table, but the required `project.version` field is neither set nor present in the `project.dynamic` list\n'

Summary of desired enhancement
If project.version is missing and project.dynamic does not include "version", then we should add the version as 0.1.0 automatically.

The only question would be whether this is a pre-check; if so, whether it affects performance.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions