Repository navigation
Build: Move type checking and test suites to tox - #4494
oresttokovenko wants to merge 2 commits into
Conversation
|
Thanks @oresttokovenko for raising this PR, and joining the PyIceberg sync the other day. Sorry for the reviewing taking some time, but I wanted to take the time to dive into it, and let it sink in a bit. I hate to be that guy that dismisses changes, but I want to make sure that we're heading into the right direction. Couple of things:
Again, I would also like to invite others to get their opinion. |
|
@Fokko thank you for the review!
Makes sense, I'm happy to keep thin
3 part answer:
Replacing everything in one shot is tough to get reviewed in practice, and I want to create PRs that are easy to understand and review, and not ask maintainers to take huge risks when smaller risks are safer. This is a path to consolidating tooling in the long run, so I would think it's beneficial to the project as a whole. uv is a dependency manager, while tox (via tox-uv) is a test runner that delegates environment creation and locking to uv, so they complement rather than duplicate each other. I did look into this, and there is a way, via Regarding the type checker, I'm also working on that! I opened this issue and mentioned it during our last python sync but it still hasn't received any feedback. That issue relates to this PR because type checking is currently broken and integrating it into nox would be a great way to incrementally improve it (it would be harder via the current approach with prek due to how it manages dependencies) |
What
This PR moves mypy type checking and the test suites out of
Makefileand.pre-commit-config.yamlinto a dedicatedtox.toml, backed bytox-uv-bare(uv-venv-lock-runner) and PEP 735[dependency-groups]inpyproject.toml.Makefilestays for setup, linting, docs, interactive notebooks, andclean;prekstays for formatting and fast linters.tox.tomlwith defaultenv_list(typecheckandtest-3.11–test-3.14) plusunit,integration,s3,adls,gcs,notebook, andcoverage[dependency-groups](lint,tox,types,coverage) inpyproject.tomland updatesuv.lock, so every tox environment installs strictly fromuv.lockmirrors-mypyfrom.pre-commit-config.yamlMakefile(retaininginstall*,lint,check-license,docs-*,notebook*,clean).github/workflows/python-ci.yml,.github/workflows/python-integration.yml,dev/release/verify_rc.sh,MANIFEST.in,dev/.rat-excludes,AGENTS.md,mkdocs/docs/contributing.md, andmkdocs/docs/verify-release.mdWhy
Following the Nov 24 community sync, this scopes the tooling cleanup down from #4208 to just testing and type checking using
tox(rather than replacingMakefileandprekwholesale withnoxandjust).Previously, test and type-checking logic was split across
Makefile,.pre-commit-config.yaml, and the CI workflows:mirrors-mypypinnedmypyand itstypes-*stubs outsidepyproject.toml/uv.lock, so Dependabot'suvecosystem did not bump them and localuv runcould not reproduce the isolated CI mypy environment--no-extra hive-kerberoson Windows) anduv sync/pytest/coverageinvocations across workflows andMakefiletox.toml+uv-venv-lock-runner, CI and local runs invoke the same environments with the same locked dependencies fromuv.lock, andtypecheckruns as its own fast job instead of hiding behindmatrix.python == '3.11'Where the old recipes and checks live now
mirrors-mypy(prek)uv run tox -e typecheckmake testuv run tox -e unit(oruv run tox -pfor 3.11–3.14)make test PYTEST_ARGS="..."uv run tox -e unit -- ...make test-integrationuv run tox -e integration(KEEP_COMPOSE=1to keep containers up)make test-s3/test-adls/test-gcsuv run tox -e s3/adls/gcsmake test-notebookuv run tox -e notebookmake coverage-reportuv run tox -e coveragemake test-coverageCOVERAGE=1 uv run tox -e unit,integration,s3,adls,gcs,coveragemake install,make lint,make check-license,make docs-serve,make docs-build,make notebook,make notebook-infra, andmake cleanremain inMakefileTests
uv lock --checkpassedCOVERAGE=1 COVERAGE_FAIL_UNDER=0 uv run --locked --only-group tox tox run -r -e typecheck,test-3.13,coverage -- tests/avro/test_decoder.pypassed (typecheck: 0 issues across 222 files;test-3.13: 68 passed;coverage: combined and reported)uv run --locked --only-group tox tox run --notest -e unitsynced cleanly fromuv.lockuv run --locked --only-group lint prek run -apassed all 10 remaining hookszizmorreported 0 findings on.github/workflows/python-ci.ymland.github/workflows/python-integration.yml