Skip to content

[MNT] Add uv for dependency management#239

Open
surchs wants to merge 7 commits intomainfrom
add_uv
Open

[MNT] Add uv for dependency management#239
surchs wants to merge 7 commits intomainfrom
add_uv

Conversation

@surchs
Copy link
Copy Markdown
Contributor

@surchs surchs commented Mar 28, 2026

Changes proposed in this pull request:

  • added pyproject.toml and moved pre-commit configs in there
  • uv.lock added
  • update CI and Dockerfile with uv

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

Summary by Sourcery

Introduce standardized project metadata and dependency management via pyproject-based configuration and locking.

Build:

  • Add pyproject.toml to define project metadata, runtime and development dependencies, and Hatch-based build/versioning configuration.
  • Move Black and isort configuration from pre-commit into pyproject.toml and simplify corresponding pre-commit hook settings.
  • Add uv.lock to lock Python dependencies for reproducible environments.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 28, 2026

Reviewer's Guide

Introduce uv-based dependency management by defining the project metadata and tooling configuration in a new pyproject.toml, centralizing formatter/linter settings there, and adding a uv.lock file while simplifying the legacy pre-commit configuration.

Flow diagram for new uv-based dependency and dev workflow

flowchart TD
  A["Edit pyproject.toml (metadata, dependencies, tools)"] --> B["Run uv sync / uv pip to resolve dependencies"]
  B --> C["uv updates uv.lock with resolved versions"]
  C --> D["Environment uses locked dependencies"]

  A --> E["Configure black and isort in pyproject.toml"]
  E --> F["pre-commit reads tool configs from pyproject.toml"]
  F --> G["Run pre-commit (black, isort, others) on changed files"]

  A --> H["Configure build-system for hatch / hatch-vcs"]
  H --> I["Run hatch build to create distributions"]
Loading

File-Level Changes

Change Details Files
Introduce pyproject.toml with project metadata, runtime dependencies, dev dependency group, and tool configurations for black, isort, and hatch.
  • Define build system using hatch-vcs and hatchling with VCS-based versioning and version file generation in app/_version.py.
  • Specify project metadata including name, description, authors, maintainers, license, classifiers, and supported Python versions (3.10–3.13).
  • Declare core dependencies such as FastAPI with standard extras, Pydantic v2, PyJWT, typing-extensions, jsonschema, and orjson.
  • Add a dev dependency group containing coverage, pytest, pytest-asyncio, and pre-commit.
  • Configure black line length, isort profile and options, and hatch versioning behavior via [tool.*] sections.
pyproject.toml
Simplify pre-commit hook configuration to rely on tool-specific config in pyproject.toml instead of inline arguments.
  • Remove explicit black arguments for line length and safe mode from the black hook config.
  • Remove explicit isort arguments for black profile and filter-files from the isort hook config, delegating to pyproject.toml settings.
.pre-commit-config.yaml
Add uv lockfile to record resolved dependency versions for uv-based dependency management.
  • Introduce uv.lock file to pin exact dependency versions for reproducible installs with uv.
uv.lock

Assessment against linked issues

Issue Objective Addressed Explanation
#224 Introduce uv-based dependency management by defining project metadata and dependencies in a pyproject.toml compatible with uv.
#224 Add and commit a uv-generated lockfile (uv.lock) to lock dependencies.
#224 Align tooling configuration (e.g., formatting/linting) with pyproject.toml so it works cleanly with uv-based workflows.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.12%. Comparing base (1d2794f) to head (5603f77).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   98.17%   98.12%   -0.05%     
==========================================
  Files          30       26       -4     
  Lines         987      961      -26     
==========================================
- Hits          969      943      -26     
  Misses         18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt uv for dependency management

1 participant