Skip to content

Conversation

@neo-jesse
Copy link
Collaborator

@neo-jesse neo-jesse commented Nov 12, 2025

Migrate Python dependency management from Pipenv to UV

Summary

Migrates api and shared-data projects from pipenv to uv for faster dependency resolution and installation. All other projects continue using pipenv.

Key Changes for Api and shared-data

  • Migrated api and shared-data from Pipfile to pyproject.toml with uv.lock
  • Created scripts/python-uv.mk for UV projects; scripts/python.mk remains for pipenv projects
  • Updated GitHub Actions setup action to detect project type (UV vs pipenv) and install dependencies accordingly
  • Fixed dependencies: added opentrons-hardware[FLEX] to api dev deps, numpy to shared-data main deps
  • Fixed mypy errors (redundant casts, unused ignores, untyped decorators)
  • Migrated JSON schema validation from jsonschema.RefResolver to referencing library
  • Refactored GitHub Actions Python setup into modular actions (install-uv, cache-uv, setup)
  • Fixed Windows PATH issues for uv in Make commands
  • Added install-dev-deps: 'true' to workflows that run lint/test for UV projects

Changes for Pipenv Projects

  • Updated all pipenv Makefiles to use pipenv sync --dev to ensure dev dependencies are installed
  • Fixed workflows to properly install dev dependencies for lint/test jobs

Benefits

  • Faster dependency resolution and installation for api and shared-data
  • Standardized pyproject.toml configuration for migrated projects
  • Improved CI reliability with proper caching and dev dependency handling
  • Gradual migration path - other projects can be migrated incrementally

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.97%. Comparing base (50eea15) to head (28d0881).

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##           bump-to-scarthgap   #20135      +/-   ##
=====================================================
+ Coverage              25.96%   25.97%   +0.01%     
=====================================================
  Files                   3641     3640       -1     
  Lines                 303277   303167     -110     
  Branches               42379    42588     +209     
=====================================================
+ Hits                   78735    78737       +2     
+ Misses                224519   224407     -112     
  Partials                  23       23              
Flag Coverage Δ
app 2.09% <ø> (-0.01%) ⬇️
protocol-designer 19.38% <ø> (ø)
step-generation 5.62% <ø> (ø)
update-server 63.34% <ø> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@neo-jesse neo-jesse marked this pull request as ready for review November 13, 2025 17:40
@neo-jesse neo-jesse requested review from a team as code owners November 13, 2025 17:40
@neo-jesse neo-jesse requested review from ncdiehl11 and removed request for a team November 13, 2025 17:40
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

let's try and do all we can to avoid changes that aren't necessary for the uv cutover. that's stuff like

  • Altering the pipenv_opts definition requiring changes to all the makefiles to push --dev up
  • Whatever is causing the typechecking to change and requiring some extra casts
  • Whatever made us reformat ot3controller.py

There's also some other little stuff:

  • is there ever a time we would not want to install dev dependencies? can we just remove that argument to the action, or invert it to no-install-dev-deps and specify it more rarely?
  • let's rely on python depspecs for the linux only dependencies
  • some code duplication around path specification i think we can pull
  • let's just double check that the versions of all the dependencies, including dev dependencies, are the same in the new uv and the old pipenv dependency specs. that will let us change fewer things at one time

id: project-type
shell: bash
run: |
# Only api and shared-data use UV for now
Copy link
Member

Choose a reason for hiding this comment

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

can we probe for the existence of a uv.lock file instead, or even cut over the makefile

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

More than just the 2 projects we are looking at have uv.lock, it's not a good indicator.

Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Very much getting there! A couple little nits to pick; the only big things left are some github actions stuff, the thing with the mypy configuration in api, and a weirdness with the dependencies in api.

@sfoster1 sfoster1 changed the title feat(uv, ci): Api and shared-data uv migration chore: python project migration to uv Dec 9, 2025
@neo-jesse neo-jesse force-pushed the api-and-shared-uv-migration branch from ab14763 to 433422a Compare December 9, 2025 20:25
@neo-jesse neo-jesse requested a review from a team as a code owner December 9, 2025 22:59
@neo-jesse neo-jesse changed the base branch from edge to bump-to-scarthgap December 10, 2025 14:45
@neo-jesse neo-jesse force-pushed the api-and-shared-uv-migration branch 3 times, most recently from b1182a9 to 433422a Compare December 10, 2025 17:31
@neo-jesse neo-jesse force-pushed the api-and-shared-uv-migration branch from 433422a to ff23648 Compare December 10, 2025 19:03
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.

4 participants