Migrate Python tooling to uv, Ruff, ty, and Poe #11
Loading…
Reference in a new issue
No description provided.
Delete branch "mitsimi/BAC-ColorAnalyzer:migrate/proper-tooling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR migrates the project to a modern Python development workflow based on Astral tooling and adds task aliases for the common commands.
The project now uses:
uvfor dependency management, lockfile generation, and running commands inside the project environmentrufffor formatting and lintingtyfor type checkingpoethepoetfor npm-style task aliases such asuv run poe lint,uv run poe lint-fix, anduv run poe devCode Changes
Most Python file changes are the result of running
ruff format, so the codebase now has one consistent formatting style.The non-formatting code changes are small fixes that were required for Ruff and ty to pass:
img_as_floatfromskimage.utilinstead of the top-levelskimagepackage, which matches how the package exposes that function for type checking.SelectedLabelssession-state access explicit by usingst.session_state.setdefault("SelectedLabels", {}), avoiding possibleNonehandling issues.gamenameargument toupload_image.save_imageargument typing because it is called with byte buffers, not only StreamlitUploadedFileobjects.np.ndarray[any, ...]withnumpy.typing.NDArray.Why Add This Tooling?
The project did not have a reproducible Python dependency setup before. With
uv, contributors can install the same dependency set fromuv.lockand run the app without manually assembling a local Python environment.Ruff gives the project a fast formatter and linter, which keeps style consistent and catches simple mistakes early. ty adds a lightweight type-checking step that found several real issues in the existing code, including missing arguments and unsafe optional values.
Poe adds a small npm-like command layer so contributors do not need to remember the underlying tool commands. The README now documents both variants:
and, if Poe is installed globally:
Validation
Ran successfully:
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.