Skip to content

chore(package): uvify#805

Open
aekasitt wants to merge 1 commit intocashubtc:mainfrom
aekasitt:uvify
Open

chore(package): uvify#805
aekasitt wants to merge 1 commit intocashubtc:mainfrom
aekasitt:uvify

Conversation

@aekasitt
Copy link
Copy Markdown

This PR does exactly four things which will be broken down to separate PRs for review working with current package managers.

  • Change package manager from Poetry to Uv
  • Include uv.lock file as part of version control to prevent later builds breaking as seen by PydanticV1 -> PydanticV2 breaking changes
  • Locks Pydantic version to below 2; Otherwise the following code will break
from pydantic import BaseSettings

because the above BaseSettings class has been modularized into separate library called pydantic_settings

@a1denvalu3
Copy link
Copy Markdown
Collaborator

Why is uv better than poetry?

Include uv.lock file as part of version control to prevent later builds breaking as seen by PydanticV1 -> PydanticV2 breaking changes

We are now on pydanticV2 as of #866

@aekasitt
Copy link
Copy Markdown
Author

aekasitt commented Feb 6, 2026

The basic answer is speed since uv is written in Rust so dependency resolution when synchronizing lockfile (from poetry.lock to uv.lock) is much faster and so is adding new packages.

The more expounded answers include PEP-621 and unifying tools. Poetry normally does not handle virtual environment creation and hands off that task to pyenv according to documentation while uv handles virtual environment creation with subcommand uv venv and type-checking configuration can be relocated inside pyproject.toml instead of mypy.ini as well under key [tool.mypy] as such

[tool.mypy]
python_version = "3.10"
# disallow_incomplete_defs = true
# disallow_untyped_calls = true
# disallow_untyped_defs = true
ignore_missing_imports = true
# strict = true

So that is one file fewer under root folder mypy.ini

According to PEP-621 , we can squash requirements.txt as well.
And here are some examples of fields that Python Poetry took liberty with that diverged from standard.

[tool.poetry.dependencies]
pydantic = "^2.5.3"
pydantic-settings = "^2.1.0"

should actually be

[project]
dependencies = [
    "pydantic >=2.5.3",
    "pydantic-settings >=2.1.0",
]

and

[tool.poetry.dev.dependencies]
pytest-asyncio = "^0.24.0"
pytest-cov = "^6.0.0"

could just be

[dependency-groups.dev]
dependencies = [
    "pytest-asyncio >=0.24.0",
    "pytest-cov >=6.0.0",
]

following PEP-735 though I think Poetry also supports this, but not by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants