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

Uploaded Python 3

File details

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

File metadata

  • Download URL: convert_poetry2uv-0.3.14.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.14.tar.gz
Algorithm Hash digest
SHA256 efc2a8d2e74b20c76350f5653fbdcb937ce0a0d3dfea0cfdd2448b1342df4f28
MD5 89a79aa3029052940634059593eb195a
BLAKE2b-256 e4d6e2c6f039232276747aef5ddc71ea3ebdfafbeadb4a00d697827db99c893f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for convert_poetry2uv-0.3.14-py3-none-any.whl
Algorithm Hash digest
SHA256 20e0960a5f3104d9f455185d543082c944211f0b532e5a1ea848cb8a68bac254
MD5 cd80fff541e2763f7b74d0a7e56e5ef2
BLAKE2b-256 7a32240615689ea14a7ecfadcc2fbd25bc3dfee8b906f67d872be581191ec6f9

See more details on using hashes here.

Provenance

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