Skip to content

Commit ce9bb9d

Browse files
authored
End of year clean up (#177)
* Update pre-commit-config Version update (autoupdate) Remove hooks `debug-statements` and `mixed-line-endings` as rarely used. * Remove development requirements Both `black` and `flake8` are enforced by pre-commit in the CI and are not requirements for developing. `mypy` remains here for support of editor setups that have extensions to use mypy while working but require the library to be installed. * Use venv to ensure pip is updated Use the venv `--update-deps` flag to ensure pip is updated when a new venv is created. * Update black configuration Allow line lengths of 100 for black and remove flake8's config on length. flake8 is already configured to ignore line length violations. Reasoning of 100: A line length of 88 is the default which is 8 more than PEP-8 recommendations. This comes from the default recommendation plus two indents worth which amount to a class and method. 100 allows for three more indents. The goal here is not to encourage deeper nesting but to encourage more verbose naming without trying to trim those few characteres. Overall expectation is to keep using a visual guide of 88 characters. * Update github action versions Adds the flag `include-hidden-files: true` to the upload artifact action as behavior was changed in 4.4.1.
1 parent 7ac97c4 commit ce9bb9d

File tree

6 files changed

+22
-26
lines changed

6 files changed

+22
-26
lines changed

.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
extend-ignore =
55
E501
66
E203
7-
max-line-length = 88

.github/workflows/python-tests.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: "python tests and coverage"
22
# Uses:
3-
# https://github.com/actions/setup-python
4-
# https://github.com/actions/checkout
5-
# https://github.com/actions/download-artifact
6-
# https://github.com/actions/upload-artifact
3+
# https://github.com/actions/setup-python : 0b93645e9fea7318ecaed2b359559ac225c90a2b
4+
# https://github.com/actions/checkout : 11bd71901bbe5b1630ceea73d27597364c9af683
5+
# https://github.com/actions/download-artifact : fa0a91b85d4f404e444e00e005971372dc801d16
6+
# https://github.com/actions/upload-artifact : 6f51ac03b9356f520e9adb1b1b7802705f340c2b
77

88
on:
99
pull_request:
@@ -33,10 +33,10 @@ jobs:
3333

3434
steps:
3535
- name: "Repo checkout"
36-
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11"
36+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
3737

3838
- name: "Set up Python ${{ matrix.python-version }}"
39-
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c"
39+
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
4040
with:
4141
python-version: "${{ matrix.python-version }}"
4242
allow-prereleases: true
@@ -50,22 +50,23 @@ jobs:
5050
nox --session tests_with_coverage-${{ matrix.python-version }}
5151
5252
- name: "Save coverage artifact"
53-
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3"
53+
uses: "actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b"
5454
with:
5555
name: "coverage-artifact-${{ matrix.os}}-${{ matrix.python-version}}"
5656
path: ".coverage.*"
5757
retention-days: 1
58+
include-hidden-files: true
5859

5960
coverage-compile:
6061
name: "coverage compile"
6162
needs: "run-tests-and-coverage"
6263
runs-on: "ubuntu-latest"
6364
steps:
6465
- name: "Repo checkout"
65-
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11"
66+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
6667

6768
- name: "Set up Python"
68-
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c"
69+
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
6970
with:
7071
python-version: "3.12"
7172

@@ -74,7 +75,7 @@ jobs:
7475
python -m pip install --upgrade pip nox
7576
7677
- name: "Download coverage artifacts"
77-
uses: "actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427"
78+
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16"
7879
with:
7980
pattern: "coverage-artifact-*"
8081
merge-multiple: true
@@ -91,10 +92,10 @@ jobs:
9192
runs-on: "ubuntu-latest"
9293
steps:
9394
- name: "Repo checkout"
94-
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11"
95+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
9596

9697
- name: "Set up Python"
97-
uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c"
98+
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
9899
with:
99100
python-version: "3.12"
100101

.pre-commit-config.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ ci:
44
repos:
55
# Batch of helpful formatters and patterns
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: "v4.6.0"
7+
rev: "v5.0.0"
88
hooks:
99
- id: check-json
1010
- id: check-toml
1111
- id: check-yaml
1212
- id: trailing-whitespace
1313
- id: end-of-file-fixer
1414
- id: check-docstring-first
15-
- id: debug-statements
16-
- id: mixed-line-ending
1715

1816
# Adds a standard feel to import segments
1917
- repo: https://github.com/pycqa/isort
@@ -29,7 +27,7 @@ repos:
2927

3028
# Format code. No, I don't like everything black does either.
3129
- repo: https://github.com/psf/black-pre-commit-mirror
32-
rev: 24.4.2
30+
rev: 24.10.0
3331
hooks:
3432
- id: black
3533

@@ -45,6 +43,6 @@ repos:
4543

4644
# Type enforcement for Python
4745
- repo: https://github.com/pre-commit/mirrors-mypy
48-
rev: v1.11.1
46+
rev: v1.14.0
4947
hooks:
5048
- id: mypy

noxfile.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ def install(session: nox.Session) -> None:
107107
activate_command = f"source {venv_path}/activate"
108108

109109
if not os.path.exists(VENV_PATH):
110-
session.run(py_command, "-m", "venv", VENV_PATH)
111-
session.run(f"{venv_path}/python", "-m", "pip", "install", "--upgrade", "pip")
110+
session.run(py_command, "-m", "venv", VENV_PATH, "--upgrade-deps")
112111

113112
session.run(f"{venv_path}/python", "-m", "pip", "install", "-e", ".[dev,test]")
114113
session.run(f"{venv_path}/pre-commit", "install")
115114

116-
if not os.environ.get("VIRTUAL_ENV"):
115+
if not venv_path:
117116
session.log(f"\n\nRun '{activate_command}' to enter the virtual environment.\n")
118117

119118

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ homepage = "https://github.com/[ORG NAME]/[REPO NAME]"
3838
# [project.scripts]
3939
# python-src-example = "module_name.sample:main"
4040

41+
[tool.black]
42+
line-length = 100
43+
target-version = ['py39']
44+
4145
[tool.setuptools.package-data]
4246
"module_name" = ["py.typed"]
4347

requirements/requirements-dev.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
# Development Requirements - linting, formatting, etc.
22

33
pre-commit
4-
black
54
mypy
6-
flake8
7-
flake8-builtins
8-
flake8-pep585
9-
pep8-naming

0 commit comments

Comments
 (0)