-
Notifications
You must be signed in to change notification settings - Fork 388
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
Use ruff #1994
Merged
Merged
Use ruff #1994
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1178d77
Update config files
adamjstewart e3256e0
Fix deviations
adamjstewart da80104
Update requirements files
adamjstewart 4730e0c
Update CI
adamjstewart 4262342
Update devcontainer
adamjstewart d397f2a
Update pre-commit
adamjstewart b529a16
Check Jupyter notebooks too
adamjstewart 57db8c9
Better safe than sorry
adamjstewart 92848ed
Update docs
adamjstewart 6be2348
Undo removal of mypy
adamjstewart 479725a
Test a bug
adamjstewart b104d32
Also format
adamjstewart 9cc5051
pre-commit: fix indentation
adamjstewart bcbd3fa
Test a bug
adamjstewart 372d06e
Fix the bug
adamjstewart 4737c84
Run format too
adamjstewart f82d06f
Fix typo
adamjstewart 717d39f
mypy requires pytest
adamjstewart 3b48fd6
Fix docs link
adamjstewart 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 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 was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
|
@@ -9,81 +9,6 @@ on: | |
- main | ||
- release** | ||
jobs: | ||
black: | ||
name: black | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/[email protected] | ||
- name: Set up python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
- name: Cache dependencies | ||
uses: actions/[email protected] | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }} | ||
- name: Install pip dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install -r requirements/style.txt | ||
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run black checks | ||
run: black . --check --diff | ||
flake8: | ||
name: flake8 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/[email protected] | ||
- name: Set up python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
- name: Cache dependencies | ||
uses: actions/[email protected] | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }} | ||
- name: Install pip dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install -r requirements/style.txt | ||
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run flake8 checks | ||
run: flake8 | ||
isort: | ||
name: isort | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/[email protected] | ||
- name: Set up python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
- name: Cache dependencies | ||
uses: actions/[email protected] | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }} | ||
- name: Install pip dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install -r requirements/style.txt | ||
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run isort checks | ||
run: isort . --check --diff | ||
mypy: | ||
name: mypy | ||
runs-on: ubuntu-latest | ||
|
@@ -99,18 +24,18 @@ jobs: | |
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/required.txt') }}-${{ hashFiles('requirements/datasets.txt') }}-${{ hashFiles('requirements/tests.txt') }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/required.txt') }}-${{ hashFiles('requirements/datasets.txt') }}-${{ hashFiles('requirements/style.txt') }}-${{ hashFiles('requirements/tests.txt') }} | ||
- name: Install pip dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install -r requirements/required.txt -r requirements/datasets.txt -r requirements/tests.txt | ||
pip install -r requirements/required.txt -r requirements/datasets.txt -r requirements/style.txt -r requirements/tests.txt | ||
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run mypy checks | ||
run: mypy . | ||
pydocstyle: | ||
name: pydocstyle | ||
ruff: | ||
name: ruff | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
|
@@ -132,33 +57,10 @@ jobs: | |
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run pydocstyle checks | ||
run: pydocstyle | ||
pyupgrade: | ||
name: pyupgrade | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/[email protected] | ||
- name: Set up python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
- name: Cache dependencies | ||
uses: actions/[email protected] | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }} | ||
- name: Install pip dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
- name: Run ruff checks | ||
run: | | ||
pip install -r requirements/style.txt | ||
pip cache purge | ||
- name: List pip dependencies | ||
run: pip list | ||
- name: Run pyupgrade checks | ||
run: pyupgrade --py310-plus $(find . -path ./docs/src -prune -o -name "*.py" -print) | ||
ruff check --output-format=github --no-fix . | ||
isaaccorley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ruff format --diff | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }} | ||
cancel-in-progress: true |
This file contains 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,38 +1,35 @@ | ||
repos: | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py310-plus] | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
additional_dependencies: ['.[colors]'] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black | ||
args: [--skip-magic-trailing-comma] | ||
|
||
- repo: https://github.com/pycqa/flake8.git | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
|
||
- repo: https://github.com/pycqa/pydocstyle | ||
rev: 6.3.0 | ||
hooks: | ||
- id: pydocstyle | ||
exclude: (tests|docs|experiments) | ||
additional_dependencies: ['.[toml]'] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.9.0 | ||
hooks: | ||
- id: mypy | ||
args: [--strict, --ignore-missing-imports, --show-error-codes] | ||
additional_dependencies: [einops>=0.6.0, kornia>=0.6.9, lightning>=2.0.9, matplotlib>=3.8.1, numpy>=1.22, pillow>=10.3.0, pytest>=6.1.2, pyvista>=0.34.2, scikit-image>=0.18.0, torch>=2.2, torchmetrics>=0.10] | ||
exclude: (build|data|dist|logo|logs|output)/ | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.3.7 | ||
hooks: | ||
- id: ruff | ||
types_or: | ||
- python | ||
- jupyter | ||
args: | ||
- --fix | ||
- id: ruff-format | ||
types_or: | ||
- python | ||
- jupyter | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.9.0 | ||
hooks: | ||
- id: mypy | ||
args: | ||
- --strict | ||
- --ignore-missing-imports | ||
- --show-error-codes | ||
additional_dependencies: | ||
- einops>=0.6.0 | ||
- kornia>=0.6.9 | ||
- lightning>=2.0.9 | ||
- matplotlib>=3.8.1 | ||
- numpy>=1.22 | ||
- pillow>=10.3.0 | ||
- pytest>=6.1.2 | ||
- pyvista>=0.34.2 | ||
- scikit-image>=0.18.0 | ||
- torch>=2.2 | ||
- torchmetrics>=0.10 | ||
exclude: (build|data|dist|logo|logs|output)/ |
This file contains 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 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 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 |
---|---|---|
|
@@ -79,8 +79,8 @@ | |
"from lightning.pytorch import Trainer\n", | ||
"\n", | ||
"from torchgeo.datamodules import EuroSAT100DataModule\n", | ||
"from torchgeo.trainers import ClassificationTask\n", | ||
"from torchgeo.models import ResNet18_Weights" | ||
"from torchgeo.models import ResNet18_Weights\n", | ||
"from torchgeo.trainers import ClassificationTask" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like isort and pyupgrade did not have Jupyter notebook support |
||
] | ||
}, | ||
{ | ||
|
This file contains 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 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 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got rid of pylance since we aren't currently using it anywhere else. Also, haven't tested this file since I don't know how to use it.