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.11.tar.gz (9.9 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.11-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: convert_poetry2uv-0.3.11.tar.gz
  • Upload date:
  • Size: 9.9 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.11.tar.gz
Algorithm Hash digest
SHA256 2d34463038889849aa8d70319a73dbab1a4f459522415b22d56996f34c666fe7
MD5 5af80a1f4a7044e2eac8b95f2163e0fc
BLAKE2b-256 094c5f23584795883bd14145350e68f118878dd6537430ee6f81f1d44da1c78b

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_poetry2uv-0.3.11.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.11-py3-none-any.whl.

File metadata

File hashes

Hashes for convert_poetry2uv-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 3f44477574c6d5eddae36d160c115462dc99a4aef6c9e471167671d6e5a6963e
MD5 80ac53d5e1339002eb6969116949d314
BLAKE2b-256 ed24c231eb97793d61db9112836905545b514afd3bbfb4d116c0acddd6f2323c

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_poetry2uv-0.3.11-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