generated from sco1/py-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from sco1/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
- Loading branch information
Showing
13 changed files
with
1,033 additions
and
1,092 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,14 @@ | ||
[flake8] | ||
max-line-length=100 | ||
docstring-convention=all | ||
import-order-style=pycharm | ||
application-import-names=pylox,tests | ||
extend-ignore= | ||
P102,B311,W503,E203,E226,S311, | ||
# Missing Docstrings | ||
D100,D104,D105,D107, | ||
# Docstring Whitespace | ||
D203,D212,D214,D215, | ||
# Docstring Quotes | ||
D301,D302, | ||
# Docstring Content | ||
D400,D401,D402,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D416,D417, | ||
# Type Annotations | ||
# pycodestyle | ||
E203,E226,E701 | ||
# flake8-annotations | ||
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206, | ||
# pep8-naming | ||
N802,N806,N815, | ||
exclude= | ||
__pycache__,.cache, | ||
venv,.venv, | ||
extend-exclude= | ||
.venv, | ||
per-file-ignores = | ||
pylox/protocols/*.py:D101 D102, | ||
pylox/ast_printer.py:D102, | ||
pylox/builtins/py_builtins.py:D101 D102, | ||
pylox/callable.py: D101 D102, | ||
pylox/error.py:D101, | ||
pylox/grammar.py:D101 D102, | ||
pylox/interpreter.py:D102, | ||
pylox/lox.py:B008, | ||
pylox/resolver.py:D101 D102, | ||
tests/*/test_*.py:D103 E501, | ||
tool/generate_ast.py:B008, | ||
tool/generate_tests.py:B008 E501, | ||
tests/*/test_*.py:E501, | ||
tool/generate_tests.py:E501, |
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 |
---|---|---|
|
@@ -12,82 +12,127 @@ jobs: | |
lint: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
UV_CACHE_DIR: /tmp/.uv-cache | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up uv | ||
run: curl -LsSf https://astral.sh/uv/0.4.18/install.sh | sh | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Restore uv cache | ||
uses: actions/cache@v4 | ||
with: | ||
python-version: '3.x' | ||
path: /tmp/.uv-cache | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools importlib-metadata | ||
pip install poetry | ||
poetry install | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Run mypy | ||
run: poetry run mypy . | ||
run: uv run mypy . | ||
if: always() | ||
|
||
- name: Minimize uv cache | ||
run: uv cache prune --ci | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
python-version: ["3.10", "3.11", "3.12", "3.13-dev"] | ||
fail-fast: false | ||
|
||
env: | ||
UV_CACHE_DIR: /tmp/.uv-cache | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up uv | ||
run: curl -LsSf https://astral.sh/uv/0.4.18/install.sh | sh | ||
|
||
- name: Set up (release) Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
if: "!endsWith(matrix.python-version, '-dev')" | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set up (deadsnakes) Python ${{ matrix.python-version }} | ||
uses: deadsnakes/[email protected] | ||
if: endsWith(matrix.python-version, '-dev') | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Restore uv cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.uv-cache | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools importlib-metadata | ||
pip install tox-gh-actions | ||
uv venv | ||
uv pip install tox-gh-actions tox-uv | ||
- name: Run tests w/tox | ||
run: tox | ||
run: uv run tox | ||
|
||
- name: Cache coverage for ${{ matrix.python-version }} | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cov_py${{ matrix.python-version }} | ||
path: .coverage | ||
if-no-files-found: error | ||
include-hidden-files: true | ||
|
||
- name: Minimize uv cache | ||
run: uv cache prune --ci | ||
|
||
combine-cov: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Pull coverage workflow artifacts | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: cov_cache/ | ||
|
||
- name: Install cov & combine | ||
run: | | ||
pip install coverage | ||
python -m pip install coverage | ||
coverage combine ./cov_cache/**/.coverage | ||
- name: Report coverage | ||
run: | | ||
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
coverage report -m --skip-covered >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
coverage html | ||
# Report a markdown version to the action summary | ||
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY | ||
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | ||
- name: Publish cov HTML | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: htmlcov/ | ||
name: cov_report_html |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
line-length = 100 | ||
fix = false | ||
output-format = "grouped" | ||
|
||
extend-exclude = [ | ||
"__pycache__", | ||
".cache", | ||
] | ||
|
||
[lint] | ||
select = [ | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"D", # pydocstyle/flake8-docstrings | ||
"F", # Pyflakes | ||
"FIX", # flake8-fixme | ||
"N", # pep8-naming | ||
] | ||
|
||
ignore = [ | ||
# pydocstyle | ||
"D100", | ||
"D104", | ||
"D105", | ||
"D107", | ||
"D203", | ||
"D212", | ||
"D214", | ||
"D215", | ||
"D301", | ||
"D400", | ||
"D401", | ||
"D402", | ||
"D404", | ||
"D405", | ||
"D406", | ||
"D407", | ||
"D408", | ||
"D409", | ||
"D410", | ||
"D411", | ||
"D412", | ||
"D413", | ||
"D414", | ||
"D416", | ||
"D417", | ||
# pep8-naming | ||
"N802", | ||
"N806", | ||
"N815", | ||
] | ||
|
||
[lint.per-file-ignores] | ||
"pylox/protocols/*.py" = ["D101", "D102",] | ||
"pylox/ast_printer.py" = ["D102",] | ||
"pylox/builtins/py_builtins.py" = ["D101", "D102",] | ||
"pylox/callable.py" = ["D101", "D102"] | ||
"pylox/error.py" = ["D101",] | ||
"pylox/grammar.py" = ["D101", "D102",] | ||
"pylox/interpreter.py" = ["D102",] | ||
"pylox/lox.py" = ["B008",] | ||
"pylox/resolver.py" = ["D101", "D102",] | ||
"tests/*/test_*.py" = ["D101", "D103",] | ||
"tool/generate_ast.py" = ["B008",] | ||
"tool/generate_tests.py" = ["B008"] | ||
|
||
[lint.flake8-bugbear] | ||
extend-immutable-calls = [ | ||
# Typer CLI | ||
"typer.Option", | ||
"typer.Argument", | ||
] |
Oops, something went wrong.