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.12.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.12-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: convert_poetry2uv-0.3.12.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.12.tar.gz
Algorithm Hash digest
SHA256 aa15fa2166574db0ebb3977a9766c41cedfb91b3be42444ffd407a0b26d12900
MD5 6bbec495a381f0ba1f3cf2001155c0d2
BLAKE2b-256 8aa0dffe3360e32d747a2f9ab43325e0ee6112a15cca7a66b51ad61c01b46845

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for convert_poetry2uv-0.3.12-py3-none-any.whl
Algorithm Hash digest
SHA256 6dad780f37a0e5fcb08f71880e8d394aeedc8aeaa79e9243ce49cbc4bea61be3
MD5 244e7376f74395b7033e442b20c2ee3d
BLAKE2b-256 2c21c122d27aa745f7c054337309830df1f3b1605a9a49a356c9347078129b3a

See more details on using hashes here.

Provenance

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