-
Notifications
You must be signed in to change notification settings - Fork 80
Pin test tool versions #447
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7cdc3ad
Pin dev requirements #331
gkreitz 2f7f92d
Also test on python 3.14
gkreitz d9da143
Add command to easily run tests locally
gkreitz bc9402b
Pull in requirements as dynamic property in pyproject.toml instead of…
gkreitz 0a3a5ca
Add script to ensure pre-commit and pinned ruff version stay in sync
gkreitz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.11.8 | ||
| rev: v0.15.22 | ||
| hooks: | ||
| - id: ruff | ||
| - id: ruff-format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| all: | ||
| make -C support | ||
|
|
||
| test: | ||
| ./run_tests.sh | ||
|
|
||
| builddeb: | ||
| dpkg-buildpackage -us -uc -tc -b | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Run from your venv with repo root as cwd. E.g., venv/bin/python3 admin/check_ruff_version.py | ||
| """Fail if the installed ruff version differs from .pre-commit-config.yaml's pinned rev.""" | ||
|
|
||
| import pathlib | ||
| import subprocess | ||
| import sys | ||
|
|
||
| import yaml | ||
|
|
||
|
|
||
| def installed_ruff_version() -> str: | ||
| ruff = pathlib.Path(sys.executable).parent / 'ruff' | ||
| output = subprocess.check_output([ruff, '--version'], text=True) | ||
| return output.strip().split()[-1] | ||
|
|
||
|
|
||
| def precommit_ruff_rev() -> str: | ||
| with open('.pre-commit-config.yaml') as f: | ||
| config = yaml.safe_load(f) | ||
| for repo in config['repos']: | ||
| if 'ruff-pre-commit' in repo['repo']: | ||
| return repo['rev'].lstrip('v') | ||
| raise RuntimeError('ruff-pre-commit repo not found in .pre-commit-config.yaml') | ||
|
|
||
|
|
||
| def main() -> int: | ||
| installed = installed_ruff_version() | ||
| pinned = precommit_ruff_rev() | ||
| if installed != pinned: | ||
| print( | ||
| f'ruff version mismatch: installed ruff is {installed}, but ' | ||
| f'.pre-commit-config.yaml pins v{pinned}. Keep requirements-dev.in ' | ||
| f'and .pre-commit-config.yaml in sync.', | ||
| file=sys.stderr, | ||
| ) | ||
| return 1 | ||
| print(f'ruff version {installed} matches .pre-commit-config.yaml') | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(main()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # ruff 0.16 adds a ton of new default rules that our codebase doesn't yet pass; | ||
| # holding at the latest 0.15.x release until we've triaged those. | ||
| ruff==0.15.22 | ||
| mypy | ||
| pytest |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
| venv/bin/pip install -q -r requirements-dev.txt | ||
| if [ -f requirements.txt ]; then venv/bin/pip install -q -r requirements.txt; fi | ||
| venv/bin/python admin/check_ruff_version.py | ||
| venv/bin/ruff check . | ||
| venv/bin/ruff format --check . | ||
| venv/bin/pytest | ||
| venv/bin/mypy --non-interactive --config-file mypy.ini -p problemtools |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.