Skip to content

Commit

Permalink
Template upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Feb 3, 2024
1 parent 67245fa commit 6fd0fe0
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 44 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Auto-fix
on:
push:
pull_request:
jobs:
style:
runs-on: ubuntu-latest
steps:
- name: Download source
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Hatch
run: |
pip install hatch
- name: Install dependencies
run: |
hatch run style:pip freeze
- name: Fix code style
run: |
hatch run style:fix --fix-only
- name: Check if any edits are necessary
run: |
git diff --color --exit-code
- name: Apply automatic fixes using pre-commit-ci-lite
if: failure() && github.event_name == 'pull_request'
uses: pre-commit-ci/[email protected]
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Download source
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
- name: Pin to lowest versions
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Download source
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Hatch
Expand All @@ -68,11 +68,7 @@ jobs:
- name: Check style
if: always()
run: |
hatch run style:fix
- name: Check formatting
if: always()
run: |
git diff --color --exit-code
hatch run style:check
- name: Check types
if: always()
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Download source
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .tools/copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_commit: 8ebfc313a
_commit: 0903da199
_src_path: gh:oprypin/py-project-template
copyright_date: '2020'
mkdocs: true
Expand Down
46 changes: 25 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ include = ["/mkdocs_gen_files", "/tests"]
[tool.hatch.env]
requires = [
"hatch-mkdocs",
"hatch-pip-compile",
"hatch-pip-compile >=1.7.0",
]

[tool.hatch.envs.default.scripts]
Expand All @@ -70,58 +70,62 @@ dependencies = [
]
[tool.hatch.envs.test.scripts]
test = [
"pytest -q",
"pytest -q {args}",
]

[tool.hatch.envs.types]
dependencies = [
"mypy",
]
[tool.hatch.envs.types.scripts]
check = [
"mypy mkdocs_gen_files"
]
check = "mypy {args} mkdocs_gen_files"

[tool.hatch.envs.style]
skip-install = true
type = "pip-compile"
detached = true
dependencies = [
"ruff",
]
[tool.hatch.envs.style.scripts]
check = "ruff check mkdocs_gen_files tests {args}"
format = "ruff format -q mkdocs_gen_files tests"
fix = [
"ruff check --fix mkdocs_gen_files tests",
"check --fix --unsafe-fixes",
"format",
]
format = [
"ruff format -q mkdocs_gen_files tests",
]

[tool.hatch.env.collectors.mkdocs.docs]
[tool.hatch.envs.docs]
type = "pip-compile"
pip-compile-hashes = false
detached = false

[tool.ruff]
line-length = 100
[tool.ruff.lint]
preview = true
select = [
"F", "W", "E", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
"F", "E", "W", "I", "UP", "YTT", "C4", "DTZ", "T10", "FA", "ISC", "PIE", "T20", "RSE", "TCH",
"N803", "N804", "N805", "N806", "N807", "N815", "N816", "N999",
"B002", "B003", "B005", "B007", "B008", "B009", "B010", "B011", "B012", "B013", "B014", "B015", "B016", "B017", "B018", "B020", "B021", "B022", "B023", "B025", "B026", "B029", "B030", "B031", "B032", "B033", "B034", "B905",
"B002", "B003", "B005", "B007", "B008", "B009", "B010", "B011", "B012", "B013", "B014", "B015", "B016", "B017", "B018", "B020", "B021", "B022", "B023", "B025", "B026", "B029", "B030", "B031", "B032", "B033", "B034", "B035", "B905",
"COM818",
"G001", "G010", "G202",
"RET502",
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910",
"PGH002", "PGH003", "PGH004", "PGH005",
"PLC", "PLE",
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0406", "PLW0602", "PLW0603", "PLW0711", "PLW1508", "PLW3301",
"Q004",
"RET502", "RET504",
"SIM101", "SIM103", "SIM105", "SIM107", "SIM118", "SIM201", "SIM202", "SIM208", "SIM210", "SIM211", "SIM212", "SIM220", "SIM221", "SIM222", "SIM223", "SIM300", "SIM401", "SIM910", "SIM911",
"PGH003", "PGH004", "PGH005",
"PLC0105", "PLC0131", "PLC0132", "PLC0205", "PLC0208", "PLC0414", "PLC2401", "PLC2403", "PLC2701", "PLC2801", "PLC3002",
"PLE0100", "PLE0101", "PLE0116", "PLE0117", "PLE0118", "PLE0241", "PLE0302", "PLE0307", "PLE0604", "PLE0605", "PLE0704", "PLE1132", "PLE1142", "PLE1205", "PLE1206", "PLE1300", "PLE1307", "PLE1310", "PLE1507", "PLE1700", "PLE2502", "PLE2510", "PLE2512", "PLE2513", "PLE2514", "PLE2515",
"PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1701", "PLR1722", "PLR1733", "PLR1736",
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW0131", "PLW0245", "PLW0406", "PLW0602", "PLW0603", "PLW0604", "PLW0711", "PLW1501", "PLW1508", "PLW1514", "PLW2101", "PLW3301",
"TRY302", "TRY401",
"FLY002",
"PERF101", "PERF102", "PERF402",
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF011", "RUF013", "RUF015", "RUF016", "RUF100", "RUF200",
"PERF101", "PERF102", "PERF402", "PERF403",
"FURB105", "FURB118", "FURB131", "FURB132", "FURB148", "FURB163", "FURB167", "FURB168", "FURB169",
"LOG001", "LOG009",
"RUF001", "RUF005", "RUF007", "RUF008", "RUF009", "RUF010", "RUF013", "RUF015", "RUF016", "RUF017", "RUF018", "RUF019", "RUF020", "RUF021", "RUF022", "RUF100", "RUF200",
]
ignore = ["E501", "E731"]
[tool.ruff.flake8-comprehensions]
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true

[tool.mypy]
Expand Down
8 changes: 8 additions & 0 deletions requirements/requirements-style.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# This file is autogenerated by hatch-pip-compile with Python 3.11
#
# - ruff
#

ruff==0.2.0
# via hatch.envs.style
13 changes: 0 additions & 13 deletions setup.py

This file was deleted.

0 comments on commit 6fd0fe0

Please sign in to comment.