[Python] How can I migrate from Poetry to UV package manager?

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm planning to switch from poetry to the uv Python package manager, but I can't find any migration guides. Currently, I'm using Poetry and already have a pyproject.toml file.

    What key(s) should be modified or added to migrate properly to uv?

    Here’s the current pyproject.toml structure:

    [tool.poetry]
    name = "name"
    version = "1.6.0"
    description = ""
    authors = [
    "...",
    ]
    maintainers = [
    "...",
    ]
    readme = "README.md"

    [tool.poetry.dependencies]
    python = "^3.12"
    fastapi = "^0.115.2"
    uvicorn = { version = "^0.32.0", extras = ["standard"] }
    pydantic = "^2.5.3"
    pydantic-settings = "^2"

    [tool.poetry.group.dev.dependencies]
    pytest = "^8.3.3"
    flake8 = "~7.1.1"
    mypy = "^1.12"

    [tool.isort]
    profile = "black"
    multi_line_output = 3

    [tool.mypy]
    strict = true
    ignore_missing_imports = true


    [tool.pytest.ini_options]
    filterwarnings = [
    "error",
    "ignore::DeprecationWarning",
    "ignore:.*unclosed.*:ResourceWarning",
    ]
    env = [
    "...=...",
    "...=...",
    ]

    [tool.coverage.run]
    omit = [
    "...=...",
    "...=...",
    ]

    [tool.coverage.report]
    exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING",
    ]

    [build-system]
    requires = ["poetry-core>=1.0.0"]
    build-backend = "poetry.core.masonry.api"


    Additionally, in the [build-system] section, I currently have poetry-core. Should this be replaced with something specific for uv during the migration?

    Continue reading...

Compartilhe esta Página