Skip to content

Switch from poetry to uv#1103

Merged
iQuxLE merged 21 commits intomainfrom
poetry-to-uv
Jun 24, 2025
Merged

Switch from poetry to uv#1103
iQuxLE merged 21 commits intomainfrom
poetry-to-uv

Conversation

@glass-ships
Copy link
Collaborator

Updates pyproject.toml, documentation, makefile, and github actions to use uv instead of poetry.

Dependency resolution is much faster since uv is written in Rust, and all poetry functionality we currently use is also available in uv. For instance, in a fresh environment, uv installs monarch-py and all its dependencies in less than 1 minutes, where poetry has historically taken as long as an hour depending on a variety of circumstances.

One minor thing to note is that, similar to the poetry configuration, version in the pyproject.toml is set to 0.0.0, getting automatically set by the github action to be whatever the latest tag number is.

There does exist an equivalent uv-dynamic-versioning and a git issue with uv to track implementation of being able to set dynamic = ["version"] in the pyproject.toml.

However, this is just a nice to have, and shouldn't affect any workflow or git actions.
The locally installed version will just show up as 0.0.0, which also currently happens with poetry.

@netlify
Copy link

netlify bot commented Jun 13, 2025

Deploy Preview for monarch-app ready!

Name Link
🔨 Latest commit 8398d33
🔍 Latest deploy log https://app.netlify.com/projects/monarch-app/deploys/685afefc74f24d00088bd700
😎 Deploy Preview https://deploy-preview-1103--monarch-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 72.05%. Comparing base (5c5badd) to head (1e870fa).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
backend/src/monarch_py/api/main.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1103      +/-   ##
==========================================
- Coverage   72.05%   72.05%   -0.01%     
==========================================
  Files          92       92              
  Lines        3246     3249       +3     
==========================================
+ Hits         2339     2341       +2     
- Misses        907      908       +1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

("ENSEMBL:ENSG00000157764", "identifiers.org/ensembl/ENSG00000157764"),
("OMIM:613647", "identifiers.org/mim/613647"),
("UBERON:0000001", "purl.obolibrary.org/obo/UBERON_0000001"),
("WormBase:WBGene00000001", "identifiers.org/wb/WBGene00000001"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

At some point, some curie expansions started giving http or https where before they were giving the opposite - I'm not sure what resulted in this difference.
These changes just give the test a little more wiggle room while asserting that the important content of the URI itself is correct

"""Abstract interface for grounding text to entities"""

def ground_entity(self, text: str) -> Entity:
def ground_entity(self, text: str) -> List[Entity]:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doesn't affect runtime, but is a useful fix for IDE linters/type checkers

nlp = None
grounding_implementation = None
nlp: Optional[spacy.language.Language] = None
grounding_implementation: Optional[GroundingInterface] = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same thing here - just helps type checking

semsimian()
spacyner()
# oak()
yield
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the on_event("startup") listener was deprecated by FastAPI

@glass-ships glass-ships requested review from kevinschaper and ptgolden and removed request for kevinschaper June 13, 2025 19:34
@iQuxLE iQuxLE self-requested a review June 24, 2025 18:35
@iQuxLE
Copy link
Contributor

iQuxLE commented Jun 24, 2025

Thanks thats great, thanks for being so fast and responsive.
We could also add enable-cache when setting it up and maybe make the uv versions in an env variable on top of each workflow file?


env:
  UV_VERSION: "0.7.x"

- name: Install uv
  uses: astral-sh/setup-uv@v6
  with:
    enable-cache: true
    version: $ {{ env.UV_VERSION}}

@glass-ships
Copy link
Collaborator Author

not sure why the frontend lint test is failing here but it at least is unrelated to changes made in this PR

@iQuxLE
Copy link
Contributor

iQuxLE commented Jun 24, 2025

Yes this looks very good now!
I'll have a look at the front end lint and see if I can find the problem otherwise it's good to merge.

Thank you @glass-ships :)

@iQuxLE iQuxLE self-requested a review June 24, 2025 19:42
@iQuxLE iQuxLE merged commit 4857903 into main Jun 24, 2025
10 checks passed
@iQuxLE iQuxLE deleted the poetry-to-uv branch June 24, 2025 19:44
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.

2 participants