Migrating pyproject.toml from Poetry to uv

TL;DR Link to heading

pipx install uv
uvx pdm import pyproject.toml
uvx tomlq 'del(.tool.poetry)' -i -t pyproject.toml
uvx tomlq 'del(."build-system")' -i -t pyproject.toml
uvx tomlq 'del(.tool.pdm)' -i -t pyproject.toml

Migration Link to heading

I managed to migrate my project from Poetry to uv using PDM import command.

  1. You will need uv installed
  2. Run PDM import
    uvx pdm import pyproject.toml
    
  3. Remove all [tool.poetry.*] sections from your pyproject.toml
    uvx tomlq 'del(.tool.poetry)' -i -t pyproject.toml
    
  4. Remove build-system section from your pyproject.toml
    uvx tomlq 'del(."build-system")' -i -t pyproject.toml
    
  5. Remove tool.pdm sections from your pyproject.toml
    uvx tomlq 'del(.tool.pdm)' -i -t pyproject.toml
    

Another tools Link to heading

poetry-to-uv Link to heading

PyPI | GitHub

The code looks fine. I tried, but it failed with this error:

$ uvx poetry_to_uv pyproject.toml
...
  File "~/.cache/uv/archive-v0/6p7woB22YMNNr2cWH9v7v/lib/python3.13/site-packages/poetry_to_uv/poetry.py", line 57, in _process_poetry_export_command
    dependency, version = dependency_version.split("@")
    ^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

I guess it was because my pyproject.toml had some dependencies installed using git, but I didn’t investigated further.

uv-migrator Link to heading

crates.io | GitHub

I didn’t try this one.

migrate-to-uv Link to heading

PyPI | GitHub

I didn’t try this one.

References Link to heading