-
Notifications
You must be signed in to change notification settings - Fork 795
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
Switch from hatch
to uv
for package and environment management
#3577
Comments
FYI we're already using I'd support switching over fully if there was no loss of functionality. A first step would be trying to replace |
I'm also on board with this |
I think moving to uv sounds like a fine direction. One thing to throw out there is that I'm using pixi for VegaFusion, and will soon be using it for vl-convert. Pixi is a very similar idea, but has a few advantages for certain kinds of projects.
Altair development doesn't require any non-Python dependencies, so the advantage of Pixi over uv isn't that strong, but wanted to mention it as an alternative to at least consider. |
@jonmmease I'm quite keen to use
I would say the advantages you listed are interesting but not sure how they'd benefit Also from reading the docs, it seems to be missing building & publishing. |
Yeah, for building a publishing you still use |
Related |
Noting here that switching to If I've understood geopandas/pyogrio#450 correctly, installing |
I've recently been working with
Definitely a joy to work with, but there is one gap we'd need to solve before the switch Either all of our
|
generate-schema-wrapper = [ | |
"mypy tools", | |
"python tools/generate_schema_wrapper.py", | |
"test" | |
] |
Lines 131 to 143 in 9002472
update-init-file = [ | |
"python tools/update_init_file.py", | |
"ruff check .", | |
"ruff format .", | |
] | |
test-fast = [ | |
"ruff check .", "ruff format .", | |
"pytest -p no:randomly -n logical --numprocesses=logical --doctest-modules tests altair tools -m \"not slow\" {args}" | |
] | |
test-slow = [ | |
"ruff check .", "ruff format .", | |
"pytest -p no:randomly -n logical --numprocesses=logical --doctest-modules tests altair tools -m \"slow\" {args}" | |
] |
Lines 145 to 162 in 9002472
[tool.hatch.envs.hatch-test] | |
# https://hatch.pypa.io/latest/tutorials/testing/overview/ | |
features = ["all", "dev", "doc"] | |
# https://pytest-xdist.readthedocs.io/en/latest/distribution.html#running-tests-across-multiple-cpus | |
default-args = ["--numprocesses=logical","--doctest-modules", "tests", "altair", "tools"] | |
parallel = true | |
[[tool.hatch.envs.hatch-test.matrix]] | |
python = ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
[tool.hatch.envs.hatch-test.scripts] | |
run = [ | |
"ruff check .", | |
"ruff format --diff --check .", | |
"mypy altair tests", | |
"pytest{env:HATCH_TEST_ARGS:} {args}" | |
] | |
run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" | |
cov-combine = "coverage combine" | |
cov-report = "coverage report" |
Lines 167 to 196 in 9002472
[tool.hatch.envs.doc.scripts] | |
clean = "rm -rf doc/_build" | |
clean-generated = ["rm -rf doc/user_guide/generated", "rm -rf doc/gallery"] | |
clean-all = ["clean", "clean-generated", "rm -rf doc/_images"] | |
clean-win = "if exist doc\\_build rd /s /q doc\\_build" | |
clean-generated-win = [ | |
"if exist doc\\user_guide\\generated rd /s /q doc\\user_guide\\generated", | |
"if exist doc\\gallery rd /s /q doc\\gallery", | |
] | |
clean-all-win = [ | |
"clean-win", | |
"clean-generated-win", | |
"if exist doc\\_images rd /s /q doc\\_images", | |
] | |
build-html = [ | |
"mkdir -p doc/_images", | |
"sphinx-build -b html -d doc/_build/doctrees doc doc/_build/html", | |
] | |
build-html-win = [ | |
"if not exist doc\\_images md doc\\_images", | |
"sphinx-build -b html -d doc\\_build\\doctrees doc doc\\_build\\html", | |
] | |
doctest = "sphinx-build -b doctest -d doc/_build/doctrees doc doc/_build/doctest" | |
coverage = "sphinx-build -b coverage -d doc/_build/doctrees doc doc/_build/coverage" | |
serve = "(cd doc/_build/html && python -m http.server)" | |
publish-clean-build = [ | |
"clean-all", | |
"build-html", | |
"(cd doc && bash sync_website.sh)", | |
] |
It makes it easier for new Altair contributors to get started as they might already know it from other projects
@binste
I think having all these scripts/commands fragmented between files - rather than centralised in pyproject.toml
- might make it a little more difficult to get started.
Important
This is my only concern. I really want to switch to uv
as soon as we can solve this
hatch
to uv
for package and environment management
Decouples from `bash`, simplifies (#3577 (comment))
Provides 2 interfaces: - `tasks.py`: to define using decorators - `tasks.toml`: an example of defining in a similar way to `hatch` scripts #3577 (comment)
What is your suggestion?
uv
is now a Python packaging manager https://astral.sh/blog/uv-unified-python-packaging. For a while already it had a lot of useful functionality but now it has all the features we'd need to replacehatch
. Paraphrasing @mattijn (correct me if I missed anything!), switching touv
might help us attract new developers. It's very likely that uv is much more popular than hatch, judging based on GitHub stars but also development activity and feature set. Due to this:Have you considered any alternative solutions?
Poetry would be an alternative. uv seems closer to hatch so less of a switching cost and it just has a super fast solver and we have it already installed for the linting and formatting
The text was updated successfully, but these errors were encountered: