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

fix: move "version" to [project] as per pyproject.toml spec #387

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

metazool
Copy link

We tried installing a label-studio-ml-backend project that depends on this SDK using the uv python environment and package management system.

The installation (with uv sync) failed in the same way as this issue; uv has a strict interpretation of the pyproject.toml spec and will bail out if the [project] table has no version information.

  • Moves the version property from tools.poetry into project
  • Change the dev-dependencies table name to group-dev-dependencies to avoid a deprecation warning
  • Update the README to suggest poetry install rather than poetry add label-studio-sdk which also throws an error

uv is getting more uptake and it's worth ensuring your package is installable with it!

Thanks for your work on the project

@metazool metazool changed the title Move "version" to [project] as per pyproject.toml spec fix: move "version" to [project] as per pyproject.toml spec Jan 16, 2025
@metazool
Copy link
Author

Example of the traceback we see without this - given a project with "label-studio-ml@git+https://github.com/HumanSignal/label-studio-ml-backend" in its list of dependencies in pyproject.toml

$ uv sync
Using CPython 3.12.7 interpreter at: ...
Creating virtual environment at: .venv
 Updated https://github.com/HumanSignal/label-studio-ml-backend (e86eedf)
 Updated https://github.com/HumanSignal/label-studio-sdk.git (cef5f5d)
  × Failed to download and build `label-studio-sdk @ git+https://github.com/HumanSignal/label-studio-sdk.git`
  ├─▶ Failed to parse: `/home/.../.cache/uv/git-v0/checkouts/73f42ed57643abd9/cef5f5d/pyproject.toml`
  ╰─▶ TOML parse error at line 1, column 1
        |
      1 | [project]
        | ^^^^^^^^^
      `pyproject.toml` is using the `[project]` table, but the required `project.version` field is neither set nor present in the `project.dynamic` list

@metazool
Copy link
Author

I added a duplicate version in tools.poetry in order for the pipeline to pass, though this doesn't really feel right.

I'm just told by @jmarshrossney that as of a month ago, poetry has changed its behaviour to be PEP 621 compliant and so this shouldn't be needed with poetry>=2.0.0 :) https://python-poetry.org/blog/announcing-poetry-2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants