Replace hatch environments with direct uv/pip commands - #442
Conversation
|
In all the project I used I find hatch + precommit and all the indirections more of a problems than anything else. I'm usually already in a env and hatch create and env, to install pre-commit that install things in a env... it's madness. Plus mypy in pre-commit forget some types errors if we don't pay attention to install the curent dev version and install all deps. |
|
Good call — you called it exactly. Moving
All fixed and pushed ( Generated by Claude Code |
Replace tool.hatch.envs.* and `hatch run` CI calls with plain uv pip install + direct pytest/pre-commit/sphinx invocations. hatchling and hatch-nodejs-version remain as the build backend/version source.
All test jobs (including Windows) now use pytest's default filterwarnings config (error) instead of overriding with -W default.
uv is already the package manager used throughout this workflow, so route the one-off tool invocations (hatch, interrogate, doc8) through uv tool run instead of pulling in pipx.
ruff-check/ruff-format already run on every PR via pre-commit.ci (default stage), so re-running them through pre-commit in test_lint was redundant. mypy is pinned to stages: [manual] specifically because pre-commit.ci skips manual-stage hooks, so it still needs to run in CI, but directly via `python -m mypy` rather than through pre-commit.
…commit Running mypy outside pre-commit's isolated additional_dependencies env exposed real gaps: fastjsonschema has no stubs (add an override), jsonschema needed types-jsonschema installed, sign.py's pysqlite2 fallback import used the wrong ignore code, json_compat.py's _validator attribute needed an explicit Any annotation (its type narrowed to Draft4Validator from the base class otherwise), and NotebookValidationError had a now-stale unused ignore.
74eb873 to
5972cc5
Compare
for more information, see https://pre-commit.ci
PY007 (task runner) and PP006 (dev dependency group) no longer apply now that hatch's env runner is gone and there's no tox/nox in its place, per the ongoing hatch/pre-commit indirection cleanup on this PR. PP304 (pytest log_level) and PC902 (custom pre-commit.ci autofix message) are stylistic preferences we don't need.
Summary
This PR removes the hatch environment configurations and replaces all hatch-based task execution with direct
uv pipandpythoncommands in the CI workflows. This simplifies the development and CI setup by eliminating the intermediate hatch layer.Key Changes
[tool.hatch.envs.*]configuration sections (default, docs, test, cov, lint, typing)hatch run cov:testwith direct pytest invocation with coverage flagshatch run docs:buildwith directmake -C docs htmlcommandhatch run typing:testwith directpython -m mypycommandhatch run lint:buildwith direct linting commandshatch run test:nowarnwith direct pytest invocationpipx runwithuv tool runfor interrogate and doc8uv pip install --system -e ".[test]"anduv pip install --system -e ".[docs]"steps to install dependencies before running tasksNotable Details
PYTHONWARNDEFAULTENCODING=1where needed--cov-fail-under 75) is now enforced in all test runsuv pipwith extras (test, docs) rather than through hatch environment definitionsuv tool run hatchinstead ofhatchdirectlyhttps://claude.ai/code/session_01GNegkQJzxWvFd2sekqB13q