Skip to main content

Poetry to uv tool. To migrate from a poetry managed repo to uv.

Project description

convert-poetry2uv

The convert_poetry2uv.py script is meant to easily convert the pyproject.toml to be consumed by uv instead of poetry.

Poetry v2 came out after this tool. The tool has been modified to work with poetry v2 format as well. Please create an issue/PR if you find any issues.

It has a dry-run flag, to have a temporary file to validate the output. When not running the dry-run the original file is saved with a .org extension.

uv run convert_poetry2uv.py <path to file> [-n]

You may need to make some manual changes. The layout might not be exactly to your liking. I would recommend using Even better toml in VSCode. Just open the newly generated toml file and save. It will format the file according to the toml specification.

Caveats

  • If you were using the poetry build-system, it is removed in the generated pyproject.toml.
  • if you had optional dev groups, the dev group libraries will be used, the optional flag is removed

Using as a tool

The script can be run as a tool using uvx

uvx convert-poetry2uv --help

uv instructions

Once the pyproject.toml is converted, you can use uv to manage your project. To start fresh, the .venv directory is removed followed by the creation and sync of the .venv directory.

rm -rf .venv
uv venv   # or 'uv venv -p 3.12' to specify a python version
uv sync

With this you are good to go and are able to validate the migration was a success.

Pypi

The script is also available on pypi as convert-poetry2uv

pip install convert-poetry2uv

Contribute

Though I've tried to make it as complete as possible, it is not guaranteed to work for all cases. Feel free to contribute to the code or create an issue with the toml file that is not converted correctly.

Versions/Releases

The version is automatically updated with python-semantic-release. Take note of the pyproject.toml to see which keywords can be added to the commit message to ensure the correct version is released. The release is created when merged to main.

Trusted Publisher

Note to self: When a new github workflow is required, don't forget to add the new workflow to the trusted publisher list.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convert_poetry2uv-0.3.13.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convert_poetry2uv-0.3.13-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file convert_poetry2uv-0.3.13.tar.gz.

File metadata

  • Download URL: convert_poetry2uv-0.3.13.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for convert_poetry2uv-0.3.13.tar.gz
Algorithm Hash digest
SHA256 3dd5d7f390eeccaa291e534efaf8e8d3fa68e891a0a841734b4e1d9500eb3229
MD5 41e78cf8121a7fcb22167c3d7a6125d4
BLAKE2b-256 fbef869b1dae6df95304c3ab712839c83c90460d5ad33d7476b5f1639f5ff1ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_poetry2uv-0.3.13.tar.gz:

Publisher: sem-release.yaml on bartdorlandt/convert_poetry2uv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file convert_poetry2uv-0.3.13-py3-none-any.whl.

File metadata

File hashes

Hashes for convert_poetry2uv-0.3.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1b65d806ab968d33f91a07107dbb92a3ad734a400406cfbbeb7df522167048fc
MD5 d99a3bf890386724aa5968728db34200
BLAKE2b-256 c8c23b886f14b8f01aa458cea1f6243d0ae37ec9b51c18332dd7ea41e5519744

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_poetry2uv-0.3.13-py3-none-any.whl:

Publisher: sem-release.yaml on bartdorlandt/convert_poetry2uv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page