Skip to content

Commit a9f374e

Browse files
authored
100 character width (#4)
1 parent 68063c7 commit a9f374e

File tree

7 files changed

+132
-18
lines changed

7 files changed

+132
-18
lines changed

.github/workflows/check.yml

+32-7
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,40 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-python@v4
12-
- uses: actions/cache@v3
12+
13+
- uses: actions/cache/restore@v4
14+
id: restore-pip
1315
with:
16+
key: |
17+
${{ runner.os }}-pip
18+
${{ hashFiles('pyproject.toml') }}
19+
${{ hashFiles('requirements.in') }}
1420
path: ~/.cache/pip
15-
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.in') }}
16-
restore-keys: ${{ runner.os }}-pip-
17-
- uses: actions/cache@v3
21+
- run: pip install --upgrade pip && pip install --upgrade 'pip-tools>7' && pip-sync
22+
env:
23+
PIP_PROGRESS_BAR: 'off'
24+
- uses: actions/cache/save@v4
1825
with:
26+
key: ${{ steps.restore-pip.outputs.cache-primary-key }}
27+
path: ~/.cache/pip
28+
29+
- uses: actions/cache/restore@v4
30+
id: restore-pre-commit
31+
with:
32+
key: |
33+
${{ runner.os }}-pre-commit
34+
${{ hashFiles('.pre-commit-config.yaml') }}
35+
path: ~/.cache/pre-commit
36+
- run: pre-commit install-hooks
37+
- uses: actions/cache/save@v3
38+
with:
39+
key: ${{ steps.restore-pre-commit.outputs.cache-primary-key }}
1940
path: ~/.cache/pre-commit
20-
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21-
restore-keys: ${{ runner.os }}-pre-commit-
22-
- run: pip install pip-tools && pip-sync
41+
2342
- run: source includes.sh && pcam --color always --show-diff-on-failure
43+
- run: python -m build
44+
- run: twine check dist/*
45+
- run: python -m manage check
46+
- run: python -m manage makemigrations --check
47+
- run: docker compose build
48+
- run: docker compose run web python -m manage test

.pre-commit-config.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
hooks:
2020
- id: black
2121
- repo: https://github.com/jazzband/pip-tools
22-
rev: 6.13.0
22+
rev: 7.3.0
2323
hooks:
2424
- id: pip-compile
2525
args:
@@ -34,6 +34,10 @@ repos:
3434
- json
3535
- yaml
3636
- toml
37+
- repo: https://github.com/stephen-ra-king/piptools-sync
38+
rev: v1.0.4
39+
hooks:
40+
- id: piptools_sync
3741

3842
# Linters
3943
- repo: https://github.com/abravalheri/validate-pyproject
@@ -50,7 +54,9 @@ repos:
5054
- repo: local
5155
hooks:
5256
- id: gitignore
53-
entry: curl -so .gitignore https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
57+
entry: |
58+
curl -so .gitignore
59+
https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
5460
language: system
5561
name: gitignore
5662
pass_filenames: false

.prettierrc.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ trailingComma = 'all'
22
tabWidth = 4
33
semi = false
44
singleQuote = true
5-
printWidth = 120
5+
printWidth = 100

.yamllint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ rules:
77
indentation:
88
spaces: 4
99
line-length:
10-
max: 120
10+
max: 100
1111
truthy:
1212
level: error

includes.sh

+37-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,20 @@ if ! [[ -x $(command -v nvm) ]]; then
1616
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" || echo ERROR: nvm missing
1717
fi
1818

19+
# F: no-op for single page, R: color, X: keep text when exiting, i: case insensitive searching
20+
LESS="-FRXi"
21+
export LESS
22+
1923
# Aliases only work in interactive shells
24+
alias jq='jq --color-output'
2025
alias ls='ls --color=auto'
2126

27+
pathver() {
28+
: Print path and version
29+
(type "$1" && "$1" --version) |
30+
sed -Ee N -e 's,^[^/(]*,,' -e 's,\((.+)\),\1,' -e 's/\n/ /'
31+
}
32+
2233
a() {
2334
: Activate virtual environment after changing directory
2435

@@ -35,12 +46,24 @@ a() {
3546

3647
cd "$directory" || return 1
3748

49+
# TODO pyenv-virtualenv wants `. deactivate`
50+
# TODO conda wants `conda deactivate`
3851
[[ $(command -v deactivate) ]] && deactivate
3952

40-
if [[ -f $directory/.venv/bin/activate ]]; then
53+
if [[ -f .venv/bin/activate ]]; then
4154
# shellcheck disable=SC1091
42-
source "$directory/.venv/bin/activate"
43-
python --version
55+
source .venv/bin/activate
56+
pathver python
57+
elif [[ -d conda ]]; then
58+
# shellcheck disable=SC1091
59+
source "$HOME/miniconda3/etc/profile.d/conda.sh"
60+
conda activate "$(basename "$directory")"
61+
pathver python
62+
fi
63+
64+
if [[ -f .nvmrc ]]; then
65+
nvm install && nvm use
66+
pathver node
4467
fi
4568
}
4669

@@ -53,16 +76,26 @@ devready() {
5376
[[ $(git config --global push.default) == current ]] || echo WARNING: git push.default != current
5477
}
5578

79+
pc() {
80+
: run Pre-Commit on modified files
81+
pre-commit run "$@"
82+
}
83+
5684
pca() {
5785
: run Pre-Commit on All files
5886
pre-commit run --all-files "$@"
5987
}
6088

6189
pcam() {
62-
: run Pre-Commit on All files but just Manual stage hooks
90+
: run Pre-Commit on All files including Manual stage hooks
6391
pre-commit run --all-files --hook-stage manual "$@"
6492
}
6593

94+
pcm() {
95+
: run Pre-Commit on modified files including Manual stage hooks
96+
pre-commit run --hook-stage manual "$@"
97+
}
98+
6699
resourcerun() {
67100
: RE-SOURCE this file and RUN the specified function with tracing enabled
68101
# shellcheck source=includes.sh

requirements.in

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ django-stubs
1010
mypy
1111
pre-commit
1212
types-requests
13+
twine
1314

1415
# pip-tools and wheel will be installed by Dockerfile

requirements.txt

+52-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ cfgv==3.3.1
1515
charset-normalizer==3.1.0
1616
# via requests
1717
cryptography==41.0.5
18-
# via -r requirements.in
18+
# via
19+
# -r requirements.in
20+
# secretstorage
1921
distlib==0.3.6
2022
# via virtualenv
2123
django==4.2.1
@@ -30,34 +32,77 @@ django-stubs==4.2.0
3032
# via -r requirements.in
3133
django-stubs-ext==4.2.0
3234
# via django-stubs
35+
docutils==0.20.1
36+
# via readme-renderer
3337
filelock==3.12.0
3438
# via virtualenv
3539
identify==2.5.24
3640
# via pre-commit
3741
idna==3.4
3842
# via requests
43+
importlib-metadata==7.0.1
44+
# via
45+
# keyring
46+
# twine
47+
jaraco-classes==3.3.0
48+
# via keyring
49+
jeepney==0.8.0
50+
# via
51+
# keyring
52+
# secretstorage
53+
keyring==24.3.0
54+
# via twine
55+
markdown-it-py==3.0.0
56+
# via rich
57+
mdurl==0.1.2
58+
# via markdown-it-py
59+
more-itertools==10.2.0
60+
# via jaraco-classes
3961
mypy==1.3.0
4062
# via
4163
# -r requirements.in
4264
# django-stubs
4365
mypy-extensions==1.0.0
4466
# via mypy
67+
nh3==0.2.15
68+
# via readme-renderer
4569
nodeenv==1.8.0
4670
# via pre-commit
71+
pkginfo==1.9.6
72+
# via twine
4773
platformdirs==3.5.1
4874
# via virtualenv
4975
pre-commit==3.3.2
5076
# via -r requirements.in
5177
pycparser==2.21
5278
# via cffi
79+
pygments==2.17.2
80+
# via
81+
# readme-renderer
82+
# rich
5383
pyjwt==2.8.0
5484
# via -r requirements.in
5585
pyyaml==6.0.1
5686
# via pre-commit
87+
readme-renderer==42.0
88+
# via twine
5789
requests==2.31.0
58-
# via -r requirements.in
90+
# via
91+
# -r requirements.in
92+
# requests-toolbelt
93+
# twine
94+
requests-toolbelt==1.0.0
95+
# via twine
96+
rfc3986==2.0.0
97+
# via twine
98+
rich==13.7.0
99+
# via twine
100+
secretstorage==3.3.3
101+
# via keyring
59102
sqlparse==0.4.4
60103
# via django
104+
twine==4.0.2
105+
# via -r requirements.in
61106
types-pytz==2023.3.0.0
62107
# via django-stubs
63108
types-pyyaml==6.0.12.10
@@ -72,9 +117,13 @@ typing-extensions==4.6.3
72117
# django-stubs-ext
73118
# mypy
74119
urllib3==2.0.3
75-
# via requests
120+
# via
121+
# requests
122+
# twine
76123
virtualenv==20.23.0
77124
# via pre-commit
125+
zipp==3.17.0
126+
# via importlib-metadata
78127

79128
# The following packages are considered to be unsafe in a requirements file:
80129
# setuptools

0 commit comments

Comments
 (0)