Conversation
There was a problem hiding this comment.
Pull request overview
This exploratory PR evaluates migrating project/env management from Hatch to uv, and replacing Hatch scripts with Poe the Poet tasks, updating CI/publish workflows and contributor docs accordingly.
Changes:
- Switch build backend from
hatchlingtouv_buildand make the project version static inpyproject.toml. - Add Poe tasks for install/check/test/coverage/docs and update contributing docs to use
uv+poe. - Update GitHub Actions workflows to use
uvfor CI runs and building distributions.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/sklearn_raster/__init__.py |
Derive __version__ from installed distribution metadata. |
pyproject.toml |
Move to uv_build, define dependency groups, and add Poe tasks. |
docs/pages/contributing.md |
Update contributor commands from Hatch to uv + poe. |
.github/workflows/publish.yaml |
Build dists via uv build instead of hatch build. |
.github/workflows/ci.yaml |
Run tests/lint via uv + poe and add workflow_dispatch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@aazuspan, I obviously have left this one hanging for a while. I'm sure I can adapt to this new system if you think this is a good way forward. If you feel like you want to move on this, that is good by me. Otherwise, I'll carve out some time to play around with this setup. |
|
No worries, @grovduck! I'll admit I have become a little biased towards this toolset and have been adopting it in my new projects, but I'm still happy to stick with Hatch and call this a learning experience that we can revisit later if there's not enough bandwidth for a tooling change right now. While |
|
@aazuspan, found a bit of time to mess around with this today and I'm getting a bit more comfortable with it (assuming I keep your cheat sheet close by).
Thinking about lemma-osu/sknnr#119 and how we had different runtime and test dependencies for [dependency-groups]
dev = [
"sklearn-raster[test]",
"sklearn-raster[docs]",
"pre-commit",
"poethepoet",
]So if
Yep, I would like this quite a bit more as well. It's always a bit problematic to set the default interpreter to some deep hatch directory location.
I followed your guidance here and restarted my machine, but I'm still getting the warning. Independently, I've verified that I can create symbolic links, so I'm not sure what I'm doing wrong. EDIT: On this one, are you using
I don't think this one impacted me. I only have a single global The only other thing I've noticed in playing around is that my tests seem to run a bit slower than previously and than what I'm seeing in the CI. Using |
|
Thanks for giving this a closer look!
Yeah, that tracks. I think
Let me know if I'm misunderstanding, but is the concern that if your tests pin to
I hadn't seen that symlinks are problematic -- sorry to lead us down that rabbit hole! I just checked and I must have set It sounds like you still have issues with hardlinks? Does moving the
Yeah, I'm surprised there's a difference in test execution time between How big of a difference are you seeing between |
Yep, this was exactly my concern.
I think I'm reading that you are OK with shifting that responsibility onto users given 1) our pinned versions for a dependency are likely not going to be too far apart; and 2) our user base is "small". Let me know if I've misread that. I think the benefits of having a single
No worries. I just set
I hadn't yet tested against the hatch environment, but running it three times each both ways gave me an average of 47s with I'm not sure I understand it either - I guess the hatch env that I use is sitting in my |
This is an exploratory PR to demonstrate the possibility of migrating from Hatch to UV for project and environment management, with Poe as a task runner to replace Hatch scripts. I think we should both try to test this on our different dev machines and decide if it's worth the switch. For consistency, I imagine we'd want to keep the same tooling in
sknnr, so it's worth keeping that in mind as well.Some specific changes and notes below.
Equivalent Hatch script commands
hatch run pre-commit installuv run poe installhatch run pre-commit run --all-filesuv run poe checkhatch run test:alluv run poe testhatch run test:covuv run poe coveragehatch run test_matrix:alluv run --python=3.11 poe test, etc.hatch run docs:serveuv run poe docshatch run docs:build*I only removed this to simplify command names, since I rarely use it. I'm happy to add it back in if it's worth having.
Other general Hatch commands
hatch -e test run ...,hatch -e docs run ...uv run ...(there's only one dev environment)hatch env prunerm -rf .venvOne
devenvironment to rule them allOne tradeoff with the new system is that all
poetasks run with the fulldevenvironment rather than dedicated docs/test environments. The downside is that a fresh install for a specific task will pull in more dependencies, but I think that will be outweighed by 1) the speed ofuvand 2) the simplicity of only managing and syncing a single environment.Just looking at recent Github Actions, CI runs on this branch are about 25% faster than other recent runs, despite the extra dependencies.
Local
.venvfolderuvbuilds the environment in the project folder rather than in a dedicated external directory like Hatch. I've always found that works better for my workflows (e.g. environment discovery in Jupyter notebooks is simpler), but there might be downsides for other workflows. This is probably configurable, although I've never looked into it.Additional arguments
Passing additional arguments to the underlying commands should work transparently, but I haven't tested this exhaustively. I know the common commands like
uv run poe test tests/test_datasets.py -n 6work as expected.Symlink permissions
This is a Windows issue I ran into where my user didn't have permissions to create symlinks, which interferes with UV's caching and slows down installs, resulting in the warning:
To fix that, I ran "Local Security Policy", added my user to
Local Policies > User Rights Assignment > Create symbolic links, and restarted my machine.Removing conflicting
uvbinariesThis is probably just an issue with my setup where I had a global
uvinstall and an install through Hatch, but I was running into problems with an olduvversion that wouldn't update. My heavy handed solution was: