Skip to content

Commit c50a117

Browse files
authored
Merge pull request #152 from boxine/update-req
Apply project updates via manageprojects
2 parents 1886fa9 + acd7945 commit c50a117

13 files changed

+3843
-3558
lines changed

.github/workflows/tests.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.12", "3.11", "3.10"]
19-
django-version: ["5.0", "4.2", "3.2"]
18+
python-version: ['3.12', '3.11']
19+
django-version: ['5.1', '5.0', '4.2']
2020
steps:
2121
- name: Checkout
2222
run: |
@@ -26,7 +26,7 @@ jobs:
2626
git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA)
2727
2828
- name: 'Set up Python ${{ matrix.python-version }}'
29-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v5
3030
# https://github.com/marketplace/actions/setup-python
3131
with:
3232
python-version: '${{ matrix.python-version }}'
@@ -42,10 +42,9 @@ jobs:
4242
run: |
4343
./manage.py --help
4444
45-
# FIXME:
46-
#- name: 'Safety'
47-
# run: |
48-
# ./manage.py safety
45+
- name: 'pip-audit'
46+
run: |
47+
./manage.py pip_audit
4948
5049
- name: 'Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}'
5150
env:
@@ -55,7 +54,7 @@ jobs:
5554
./manage.py tox -e $(echo py${{ matrix.python-version }}-django${{ matrix.django-version }} | tr -d .)
5655
5756
- name: 'Upload coverage report'
58-
uses: codecov/codecov-action@v3
57+
uses: codecov/codecov-action@v4
5958
# https://github.com/marketplace/actions/codecov
6059
with:
6160
fail_ci_if_error: false

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ __pycache__
2323
# Django
2424
secret.txt
2525

26+
# Include all test snapshot files:
27+
!**/*.snapshot.*
2628

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,19 @@ without docker:
193193

194194
| Huey Monitor | Django | Python |
195195
|--------------|------------------|--------------------|
196+
| >0.10.0 | v4.2, v5.0, v5.1 | v3.11, v3.12 |
196197
| >v0.7.0 | v3.2, v4.1, v4.2 | v3.9, v3.10, v3.11 |
197198
| >v0.6.0 | v3.2, v4.0, v4.1 | v3.9, v3.10, v3.11 |
198199
| >v0.5.0 | v2.2, v3.1, v3.2 | v3.7, v3.8, v3.9 |
199200
| <=v0.4.0 | v2.2, v3.0, v3.1 | v3.7, v3.8, v3.9 |
200201

201202

203+
### v0.10.0
204+
205+
Set min. Python to v3.11.
206+
Remove Django 3.2.x and add Django v5.1.x to text matrix.
207+
208+
202209
### v0.6.0
203210

204211
We refactor the project setup: Developer must reinit the repository.

huey_monitor/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
Django based tool for monitoring huey task queue: https://github.com/coleifer/huey
55
"""
66

7-
__version__ = '0.9.1'
7+
__version__ = '0.10.0'
88
__author__ = 'Jens Diemer <[email protected]>'

huey_monitor_project/tests/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
from pathlib import Path
44

55
from bx_py_utils.test_utils.deny_requests import deny_any_real_request
6+
from typeguard import install_import_hook
7+
8+
9+
# Check type annotations via typeguard in all tests:
10+
install_import_hook(packages=('huey_monitor', 'huey_monitor_project'))
611

712

813
def pre_configure_tests() -> None:

manage.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def print_no_pip_error():
4242
BIN_NAME = 'Scripts'
4343
FILE_EXT = '.exe'
4444
else:
45-
# Files under Linux/Mac and all other than Windows, e.g.: .../.venv/bin/python
45+
# Files under Linux/Mac and all other than Windows, e.g.: .../.venv/bin/python3
4646
BIN_NAME = 'bin'
4747
FILE_EXT = ''
4848

4949
BASE_PATH = Path(__file__).parent
5050
VENV_PATH = BASE_PATH / '.venv'
5151
BIN_PATH = VENV_PATH / BIN_NAME
52-
PYTHON_PATH = BIN_PATH / f'python{FILE_EXT}'
52+
PYTHON_PATH = BIN_PATH / f'python3{FILE_EXT}'
5353
PIP_PATH = BIN_PATH / f'pip{FILE_EXT}'
5454
PIP_SYNC_PATH = BIN_PATH / f'pip-sync{FILE_EXT}'
5555

@@ -62,7 +62,7 @@ def print_no_pip_error():
6262

6363

6464
def get_dep_hash():
65-
"""Get SHA512 hash from poetry.lock content."""
65+
"""Get SHA512 hash from lock file content."""
6666
return hashlib.sha512(DEP_LOCK_PATH.read_bytes()).hexdigest()
6767

6868

@@ -98,31 +98,31 @@ def main(argv):
9898
print(f'Create virtual env here: {VENV_PATH.absolute()}')
9999
builder = venv.EnvBuilder(symlinks=True, upgrade=True, with_pip=True)
100100
builder.create(env_dir=VENV_PATH)
101+
102+
if not PROJECT_SHELL_SCRIPT.is_file() or not venv_up2date():
101103
# Update pip
102104
verbose_check_call(PYTHON_PATH, '-m', 'pip', 'install', '-U', 'pip')
103105

104-
if not PIP_SYNC_PATH.is_file():
105106
# Install pip-tools
106107
verbose_check_call(PYTHON_PATH, '-m', 'pip', 'install', '-U', 'pip-tools')
107108

108-
if not PROJECT_SHELL_SCRIPT.is_file() or not venv_up2date():
109109
# install requirements via "pip-sync"
110110
verbose_check_call(PIP_SYNC_PATH, str(DEP_LOCK_PATH))
111111

112112
# install project
113113
verbose_check_call(PIP_PATH, 'install', '--no-deps', '-e', '.')
114114
store_dep_hash()
115115

116-
if 'run_dev_server' not in argv and 'run_huey' not in argv:
117-
# ignore "Interrupt from keyboard" signals
118-
# But not if we run the dev server or Huey consumer (respect watchfiles signals)
119-
signal.signal(signal.SIGINT, noop_sigint_handler)
116+
signal.signal(signal.SIGINT, noop_sigint_handler) # ignore "Interrupt from keyboard" signals
120117

121118
# Call our entry point CLI:
122119
try:
123120
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
124121
except subprocess.CalledProcessError as err:
125122
sys.exit(err.returncode)
123+
except KeyboardInterrupt:
124+
print('Bye!')
125+
sys.exit(130)
126126

127127

128128
if __name__ == '__main__':

pyproject.toml

+28-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ readme = "README.md"
77
authors = [
88
{name = 'Jens Diemer', email = '[email protected]'}
99
]
10-
requires-python = ">=3.10"
10+
requires-python = ">=3.11"
1111
dependencies = [
1212
"huey", # https://github.com/coleifer/huey
1313
"django",
@@ -34,27 +34,29 @@ dev = [
3434
"pyflakes", # https://github.com/PyCQA/pyflakes
3535
"codespell", # https://github.com/codespell-project/codespell
3636
"EditorConfig", # https://github.com/editorconfig/editorconfig-core-py
37-
"safety", # https://github.com/pyupio/safety
37+
"pip-audit", # https://github.com/pypa/pip-audit
3838
"mypy", # https://github.com/python/mypy
3939
"twine", # https://github.com/pypa/twine
40+
"typeguard", # https://github.com/agronholm/typeguard/
4041

4142
# https://github.com/akaihola/darker
4243
# https://github.com/ikamensh/flynt
4344
# https://github.com/pycqa/isort
4445
# https://github.com/pygments/pygments
4546
"darker[flynt, isort, color]",
4647

47-
"tomli", # https://github.com/hukkin/tomli
48-
# tomli only needed for Python <3.11, but see bug:
49-
# https://github.com/pypa/pip/issues/9644#issuecomment-1456583402
50-
#"tomli;python_version<\"3.11\"", # https://github.com/hukkin/tomli
51-
5248
"model_bakery", # https://github.com/model-bakers/model_bakery
5349
"requests-mock",
50+
"django-override-storage", # https://github.com/danifus/django-override-storage
51+
52+
# Work-a-round for: https://github.com/jazzband/pip-tools/issues/1866
53+
# see also: https://github.com/jazzband/pip-tools/issues/994#issuecomment-1321226661
54+
# backports.tarfile is needed for python <3.12
55+
'backports.tarfile', # via jaraco-context -> keyring -> twine
5456
]
55-
django32=["django>=3.2,<3.3"]
5657
django42=["django>=4.2,<4.3"]
5758
django50=["django>=5.0,<5.1"]
59+
django51=["django>=5.1,<5.2"]
5860

5961
[project.urls]
6062
Documentation = "https://github.com/boxine/django-huey-monitor/"
@@ -75,6 +77,16 @@ local_settings='huey_monitor_project.settings.local'
7577
test_settings='huey_monitor_project.settings.tests'
7678

7779

80+
[tool.cli_base.pip_audit]
81+
requirements=["requirements.dev.txt"]
82+
strict=true
83+
require_hashes=true
84+
ignore-vuln=[
85+
# "CVE-2019-8341", # Jinja2: Side Template Injection (SSTI)
86+
]
87+
88+
89+
7890
[build-system]
7991
requires = ["setuptools>=61.0", "setuptools_scm>=7.1"]
8092
build-backend = "setuptools.build_meta"
@@ -91,14 +103,12 @@ version = {attr = "huey_monitor.__version__"}
91103
src = ['.']
92104
revision = "origin/main..."
93105
line_length = 119
94-
verbose = true
95106
color = true
96107
skip_string_normalization = true
97108
diff = false
98109
check = false
99110
stdout = false
100111
isort = true
101-
flynt = true
102112
lint = [
103113
"flake8",
104114
]
@@ -115,7 +125,7 @@ line_length=119
115125
lines_after_imports=2
116126

117127

118-
[tool.coverage.run]
128+
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html#run
119129
branch = true
120130
parallel = true
121131
concurrency = ["multiprocessing"]
@@ -139,21 +149,22 @@ exclude_lines = [
139149
legacy_tox_ini = """
140150
[tox]
141151
isolated_build = True
142-
envlist = py{312,311,310}-django{50,42,32}
152+
envlist = py{312,311}-django{52,51,42}
143153
skip_missing_interpreters = True
144154
145155
[testenv]
146156
passenv = *
147157
skip_install = true
148158
commands_pre =
159+
pip install -U pip
149160
pip install -U pip-tools
150-
django32: pip-sync requirements.django32.txt
151161
django42: pip-sync requirements.django42.txt
152162
django50: pip-sync requirements.django50.txt
163+
django51: pip-sync requirements.django51.txt
153164
commands =
154-
django32: {envpython} -m coverage run --context='{envname}' -m huey_monitor_project test --buffer
155-
django42: {envpython} -m coverage run --context='{envname}' -m huey_monitor_project test --buffer --shuffle --parallel
156-
django50: {envpython} -m coverage run --context='{envname}' -m huey_monitor_project test --buffer --shuffle --parallel
165+
django42: {envpython} -m coverage run --context='{envname}'
166+
django50: {envpython} -m coverage run --context='{envname}'
167+
django51: {envpython} -m coverage run --context='{envname}'
157168
"""
158169

159170

@@ -173,6 +184,7 @@ cookiecutter_template = "https://github.com/jedie/cookiecutter_templates/"
173184
cookiecutter_directory = "managed-django-project"
174185
applied_migrations = [
175186
"3c16cf7", # 2023-12-21T22:22:06+01:00
187+
"e2b20e5", # 2024-09-26T19:43:41+02:00
176188
]
177189

178190
[manageprojects.cookiecutter_context.cookiecutter]

0 commit comments

Comments
 (0)