Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Avoid using requirements.txt files and rely on uv.lock #2911

Merged
merged 4 commits into from
Mar 21, 2025

Conversation

edgarrmondragon
Copy link
Collaborator

@edgarrmondragon edgarrmondragon commented Mar 21, 2025

Summary by Sourcery

Migrate from requirements.txt files to uv.lock for dependency management. This change leverages uv sync to install dependencies based on the lockfile, and removes the usage of requirements.txt files.

Build:

  • Replace requirements.txt files with uv sync for dependency installation in noxfile.py.
  • Use uv sync for ReadTheDocs dependency installation.
  • Export codspeed requirements on the fly in .github/workflows/codspeed.yml.
  • Remove uv-export pre-commit hooks.
  • Remove now unused requirements files.
  • Update xdoctest extra to include colors

CI:

  • Update Codspeed workflow to export requirements on the fly.

Copy link
Contributor

sourcery-ai bot commented Mar 21, 2025

Reviewer's Guide by Sourcery

This pull request migrates the project from using requirements.txt files to uv sync for dependency management. It updates the Noxfile, pre-commit configuration, ReadTheDocs configuration, and Codspeed workflow to use uv sync for installing dependencies. It also removes the requirements.txt files and updates the pyproject.toml file to include xdoctest[colors] as a testing dependency.

Flow Diagram: pre-commit configuration changes

graph LR
    A[Start] --> B{Use uv-lock and uv-sync?}
    B -- Yes --> C[Remove uv-export hooks]
    C --> D[End]
    B -- No --> D

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style C fill:#ccf,stroke:#333,stroke-width:2px
Loading

File-Level Changes

Change Details Files
Replaced the usage of requirements.txt files with uv sync for dependency management in Nox sessions.
  • Removed the installation of dependencies using -r requirements/requirements.txt.
  • Installed dependencies using uv sync with appropriate flags for frozen dependencies, no development dependencies, and specific groups or extras.
  • Set the UV_PROJECT_ENVIRONMENT environment variable to the session's virtual environment location.
noxfile.py
Removed pre-commit hooks for exporting requirements files.
  • Removed the uv-export hooks that generated requirements.txt files for different dependency groups (docs, package, testing, typing, Codspeed).
.pre-commit-config.yaml
Configured ReadTheDocs to use uv sync for installing dependencies.
  • Added steps to install and use uv for dependency synchronization within the ReadTheDocs build process.
  • Removed the previous method of installing dependencies using pip and a requirements.docs.txt file.
.readthedocs.yml
Modified the Codspeed workflow to generate the requirements file on the fly using uv export.
  • Added a step to generate requirements.codspeed.txt using uv export with specific flags.
  • Installed dependencies from the generated requirements.codspeed.txt using uv pip install.
.github/workflows/codspeed.yml
Removed all requirements.txt files.
  • Deleted requirements/requirements.codspeed.txt.
  • Deleted requirements/requirements.docs.txt.
  • Deleted requirements/requirements.test.txt.
  • Deleted requirements/requirements.txt.
  • Deleted requirements/requirements.typing.txt.
requirements/requirements.codspeed.txt
requirements/requirements.docs.txt
requirements/requirements.test.txt
requirements/requirements.txt
requirements/requirements.typing.txt
Updated pyproject.toml to include xdoctest[colors] as a testing dependency.
  • Added [colors] to xdoctest in the testing dependencies group.
pyproject.toml

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@edgarrmondragon edgarrmondragon changed the title Export codspeed requirements on the fly chore(deps): Avoid redundant using requirements.txt files and rely on uv.lock Mar 21, 2025
@edgarrmondragon edgarrmondragon self-assigned this Mar 21, 2025
@edgarrmondragon edgarrmondragon changed the title chore(deps): Avoid redundant using requirements.txt files and rely on uv.lock chore(deps): Avoid using requirements.txt files and rely on uv.lock Mar 21, 2025
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.40%. Comparing base (b6eab32) to head (698bff2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2911   +/-   ##
=======================================
  Coverage   91.40%   91.40%           
=======================================
  Files          63       63           
  Lines        5291     5291           
  Branches      676      676           
=======================================
  Hits         4836     4836           
  Misses        321      321           
  Partials      134      134           

☔ 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.

Copy link

codspeed-hq bot commented Mar 21, 2025

CodSpeed Performance Report

Merging #2911 will not alter performance

Comparing uv-sync-noxfile (698bff2) with main (b6eab32)

Summary

✅ 7 untouched benchmarks

@edgarrmondragon edgarrmondragon marked this pull request as ready for review March 21, 2025 15:07
@edgarrmondragon edgarrmondragon requested a review from a team as a code owner March 21, 2025 15:07
@edgarrmondragon edgarrmondragon requested a review from Copilot March 21, 2025 15:07
Copy link
Contributor

@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.

Hey @edgarrmondragon - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a uv pip compile step to pre-compile the dependencies before syncing, potentially speeding up the installation process.
  • It might be worth exploring whether uv pip install can replace uv sync in some cases, as it could simplify the configuration.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates dependency management by replacing requirements.txt file usage with uv.lock–based workflows and commands. Key changes include:

  • Updating .readthedocs.yml to use asdf and uv sync for dependency installation.
  • Modifying uv export and sync usage in GitHub workflows and noxfile.py sessions.
  • Adjusting the pyproject.toml dependency for xdoctest to include color support.

Reviewed Changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.readthedocs.yml Replaces pip install with uv sync for ReadTheDocs dependencies
pyproject.toml Updates xdoctest dependency to include the "colors" extra
.pre-commit-config.yaml Removes uv-export hooks for exporting requirements files
.github/workflows/codspeed.yml Updates the codspeed workflow to use uv export and changes file path
noxfile.py Replaces session.install with uv sync across various sessions
Files not reviewed (2)
  • requirements/requirements.codspeed.txt: Language not supported
  • requirements/requirements.typing.txt: Language not supported
Comments suppressed due to low confidence (3)

noxfile.py:60

  • The 'mypy' session uses '--group=typing' along with extras that appear unrelated to type checking; please verify if the correct group is intended or if a different group (e.g., testing) should be used.
        "--group=typing",

noxfile.py:148

  • The 'dependencies' session's uv sync call does not specify a group, which may result in installing unintended sets of extras; consider adding the appropriate '--group' parameter if a specific group should be used.
        "uv",

.github/workflows/codspeed.yml:57

  • Ensure that the updated output file path (omitting the 'requirements/' prefix) is intentional and consistent with other parts of the workflow configuration.
        uv export --no-editable --frozen --no-hashes --no-dev --all-extras --group benchmark --output-file requirements.codspeed.txt
@edgarrmondragon edgarrmondragon merged commit 0f93c2e into main Mar 21, 2025
36 checks passed
@edgarrmondragon edgarrmondragon deleted the uv-sync-noxfile branch March 21, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant