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

build: use uv and ruff #160

Merged
merged 11 commits into from
Apr 13, 2024
Merged

build: use uv and ruff #160

merged 11 commits into from
Apr 13, 2024

Conversation

slevang
Copy link
Contributor

@slevang slevang commented Mar 31, 2024

So this would be replacing poetry with yet another new shiny tool, but I would argue the benefits are worth it. uv is a drop-in replacement for pip, and ruff is their linter/formatter tool. Both are incredibly fast (written in rust), have a lot of convenient options, and are seeing rapid adoption across the python ecosystem.

One really nice feature of uv is the --resolution arg which I've used here to run tests on a "minimal" version, using lowest supported python version of 3.10 and lowest specified versions of all our primary dependencies. Then the 3.11 and 3.12 jobs run with --resolution=highest which will always have us testing against new versions.

The substantive changes of this PR are the pyproject.toml and the GH Actions. Everything else is only the result of running ruff's linter (almost all of them auto-fixed). Mostly unused imports, trimming whitespace, and a few other random things like truthy/falsy checks and unused f-strings.

I did mess with the docs a little to get that running, and rebuilt all the sphinx. Hopefully didn't screw anything up there.

Only thing I haven't tested is the build_command and uploading of wheels to pypi, but it should work fine.

@slevang slevang requested a review from nicrie March 31, 2024 19:16
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 9 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@5c554a6). Click here to learn what that means.

❗ Current head cc4e73f differs from pull request most recent head 4dbe872. Consider uploading reports for the commit 4dbe872 to get more accurate results

Files Patch % Lines
xeofs/preprocessing/stacker.py 0.00% 6 Missing ⚠️
xeofs/models/gwpca.py 0.00% 2 Missing ⚠️
xeofs/utils/xarray_utils.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage        ?   25.60%           
=======================================
  Files           ?       41           
  Lines           ?     3007           
  Branches        ?        0           
=======================================
  Hits            ?      770           
  Misses          ?     2237           
  Partials        ?        0           

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

@nicrie
Copy link
Contributor

nicrie commented Apr 2, 2024

Hey @slevang that's awesome ! I heard about these things recently coming out from Astral and would love to give it a try and see how they work. Expecting my first child literally today :) - so I won't have time to review anytime soon. I'm OK giving it a try 👍

@slevang
Copy link
Contributor Author

slevang commented Apr 2, 2024

Amazing, congrats! Hope all goes smoothly, and enjoy those early days 🥰

- pip:
- xeofs
- -e ../.[docs]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This is so much cleaner!

Copy link
Contributor

@nicrie nicrie left a comment

Choose a reason for hiding this comment

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

That's great - looking forward to see it in action! Thank you @slevang !

Copy link
Contributor

@nicrie nicrie left a comment

Choose a reason for hiding this comment

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

One additional thought: we probably want to update the contributing guide, specifically the section about how to create a local env. Instead of poetry, would you prefer pip install -e . and pip install -e .[docs] or rather uv?

@slevang
Copy link
Contributor Author

slevang commented Apr 12, 2024

Good point. I went with basic pip to keep things simple. I also had to add those two system dependencies to the conda env creation to get the docs dependencies to install properly.

@nicrie nicrie merged commit a9ba9ff into main Apr 13, 2024
6 checks passed
@nicrie nicrie deleted the use-uv branch August 25, 2024 10:24
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