Skip to content
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

Clean up check.sh, move stuff to pre-commit #3157

Merged
merged 10 commits into from
Dec 24, 2024
21 changes: 4 additions & 17 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,11 @@ if [ $MYPY -ne 0 ]; then
fi

# Check pip compile is consistent
echo "::group::Pip Compile - Tests"
uv pip compile --universal --python-version=3.9 test-requirements.in -o test-requirements.txt
echo "::endgroup::"
echo "::group::Pip Compile - Docs"
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
echo "::group::Pip Compile - Tests & Docs"
pre-commit run pip-compile --all-files \
|| EXIT_STATUS=$?
echo "::endgroup::"

if git status --porcelain | grep -q "requirements.txt"; then
echo "::error::requirements.txt changed."
echo "::group::requirements.txt changed"
echo "* requirements.txt changed" >> "$GITHUB_STEP_SUMMARY"
git status --porcelain
git --no-pager diff --color ./*requirements.txt
EXIT_STATUS=1
echo "::endgroup::"
fi

echo "::group::Pyright interface tests"
python src/trio/_tests/check_type_completeness.py || EXIT_STATUS=$?

Expand All @@ -79,8 +67,7 @@ Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run

uv pip install -r test-requirements.txt
black src/trio
ruff check src/trio
pre-commit run --all-files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hook stage manual?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?
We don't have any manual hooks anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, it might be worth using hook stage manual here, just in case any get added

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels kinda weird suggesting people do stuff that is completely redundant/ineffective. And if we do add manual stages there's perhaps gonna be a decent reason we make them manual? Idk I'll leave it as is /shrug

./check.sh

in your local checkout.
Expand Down
1 change: 1 addition & 0 deletions test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ruff >= 0.8.0
astor # code generation
uv >= 0.2.24
codespell
pre-commit

# https://github.com/python-trio/trio/pull/654#issuecomment-420518745
mypy-extensions
Expand Down
25 changes: 21 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ black==24.10.0 ; implementation_name == 'cpython'
# via -r test-requirements.in
certifi==2024.8.30
# via requests
cffi==1.17.1 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
cffi==1.17.1 ; os_name == 'nt' or platform_python_implementation != 'PyPy'
# via
# -r test-requirements.in
# cryptography
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.4.0
# via requests
click==8.1.7 ; implementation_name == 'cpython'
# via black
codespell==2.3.0
# via -r test-requirements.in
colorama==0.4.6 ; (implementation_name != 'cpython' and sys_platform == 'win32') or (platform_system != 'Windows' and sys_platform == 'win32') or (implementation_name == 'cpython' and platform_system == 'Windows')
colorama==0.4.6 ; (implementation_name == 'cpython' and platform_system == 'Windows') or sys_platform == 'win32'
# via
# click
# pylint
Expand All @@ -44,12 +46,18 @@ cryptography==43.0.3
# types-pyopenssl
dill==0.3.9
# via pylint
distlib==0.3.9
# via virtualenv
docutils==0.21.2
# via sphinx
exceptiongroup==1.2.2 ; python_full_version < '3.11'
# via
# -r test-requirements.in
# pytest
filelock==3.16.1
# via virtualenv
identify==2.6.3
# via pre-commit
idna==3.10
# via
# -r test-requirements.in
Expand Down Expand Up @@ -79,7 +87,9 @@ mypy-extensions==1.0.0
# black
# mypy
nodeenv==1.9.1
# via pyright
# via
# pre-commit
# pyright
orjson==3.10.12 ; implementation_name == 'cpython'
# via -r test-requirements.in
outcome==1.3.0.post0
Expand All @@ -97,9 +107,12 @@ platformdirs==4.3.6
# via
# black
# pylint
# virtualenv
pluggy==1.5.0
# via pytest
pycparser==2.22 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
pre-commit==4.0.1
# via -r test-requirements.in
pycparser==2.22 ; os_name == 'nt' or platform_python_implementation != 'PyPy'
# via cffi
pygments==2.18.0
# via sphinx
Expand All @@ -111,6 +124,8 @@ pyright==1.1.389
# via -r test-requirements.in
pytest==8.3.3
# via -r test-requirements.in
pyyaml==6.0.2
# via pre-commit
requests==2.32.3
# via sphinx
ruff==0.8.2
Expand Down Expand Up @@ -168,5 +183,7 @@ urllib3==2.2.3
# via requests
uv==0.5.5
# via -r test-requirements.in
virtualenv==20.28.0
# via pre-commit
zipp==3.21.0 ; python_full_version < '3.10'
# via importlib-metadata
Loading