Skip to content

Commit a5bb5c3

Browse files
bump template to 2024.24 (#52)
1 parent cc90ef8 commit a5bb5c3

File tree

10 files changed

+124
-114
lines changed

10 files changed

+124
-114
lines changed

.copier/package.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v2024.18
2+
_commit: v2024.24
33
_src_path: gh:westerveltco/django-twc-package
44
author_email: [email protected]
55
author_name: Josh Thomas
@@ -19,5 +19,6 @@ python_versions:
1919
- '3.10'
2020
- '3.11'
2121
- '3.12'
22+
- '3.13'
2223
test_django_main: true
2324
versioning_scheme: SemVer

.github/workflows/labels.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,32 @@ on:
44
release:
55
types: [released]
66

7-
jobs:
8-
check:
9-
runs-on: ubuntu-latest
10-
permissions:
11-
actions: read
12-
contents: read
13-
env:
14-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15-
steps:
16-
- uses: actions/checkout@v4
7+
permissions:
8+
contents: write
179

18-
- name: Check most recent test run on `main`
19-
id: latest-test-result
20-
run: |
21-
echo "result=$(gh run list \
22-
--branch=main \
23-
--workflow=test.yml \
24-
--json headBranch,workflowName,conclusion \
25-
--jq '.[] | select(.headBranch=="main" and .conclusion=="success") | .conclusion' \
26-
| head -n 1)" >> $GITHUB_OUTPUT
27-
28-
- name: OK
29-
if: ${{ (contains(steps.latest-test-result.outputs.result, 'success')) }}
30-
run: exit 0
31-
32-
- name: Fail
33-
if: ${{ !contains(steps.latest-test-result.outputs.result, 'success') }}
34-
run: exit 1
10+
jobs:
11+
test:
12+
uses: ./.github/workflows/test.yml
3513

3614
pypi:
3715
if: ${{ github.event_name == 'release' }}
3816
runs-on: ubuntu-latest
39-
needs: check
17+
needs: test
4018
environment: release
4119
permissions:
4220
contents: read
4321
id-token: write
4422
steps:
4523
- uses: actions/checkout@v4
46-
with:
47-
persist-credentials: false
4824

49-
- uses: westerveltco/setup-ci-action@v0
25+
- uses: actions/setup-python@v5
5026
with:
5127
python-version: 3.12
52-
extra-python-dependencies: hatch
53-
use-uv: true
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install -U pip uv
32+
python -m uv pip install --system hatch
5433
5534
- name: Build package
5635
run: |

.github/workflows/test.yml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: test
22

33
on:
4+
pull_request:
45
push:
56
branches: [main]
6-
pull_request:
7+
workflow_call:
78

89
concurrency:
910
group: test-${{ github.head_ref }}
@@ -20,14 +21,15 @@ jobs:
2021
matrix: ${{ steps.set-matrix.outputs.matrix }}
2122
steps:
2223
- uses: actions/checkout@v4
23-
with:
24-
persist-credentials: false
2524

26-
- uses: westerveltco/setup-ci-action@v0
25+
- uses: actions/setup-python@v5
2726
with:
2827
python-version: 3.8
29-
extra-python-dependencies: nox
30-
use-uv: true
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install -U pip uv
32+
python -m uv pip install --system nox
3133
3234
- id: set-matrix
3335
run: |
@@ -42,14 +44,16 @@ jobs:
4244
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
4345
steps:
4446
- uses: actions/checkout@v4
45-
with:
46-
persist-credentials: false
4747

48-
- uses: westerveltco/setup-ci-action@v0
48+
- uses: actions/setup-python@v5
4949
with:
5050
python-version: ${{ matrix.python-version }}
51-
extra-python-dependencies: nox
52-
use-uv: true
51+
allow-prereleases: true
52+
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install -U pip uv
56+
python -m uv pip install --system nox
5357
5458
- name: Run tests
5559
run: |
@@ -71,14 +75,15 @@ jobs:
7175
runs-on: ubuntu-latest
7276
steps:
7377
- uses: actions/checkout@v4
74-
with:
75-
persist-credentials: false
7678

77-
- uses: westerveltco/setup-ci-action@v0
79+
- uses: actions/setup-python@v5
7880
with:
7981
python-version: 3.8
80-
extra-python-dependencies: nox
81-
use-uv: true
82+
83+
- name: Install dependencies
84+
run: |
85+
python -m pip install -U pip uv
86+
python -m uv pip install --system nox
8287
8388
- name: Run mypy
8489
run: |
@@ -88,14 +93,15 @@ jobs:
8893
runs-on: ubuntu-latest
8994
steps:
9095
- uses: actions/checkout@v4
91-
with:
92-
persist-credentials: false
9396

94-
- uses: westerveltco/setup-ci-action@v0
97+
- uses: actions/setup-python@v5
9598
with:
9699
python-version: 3.8
97-
extra-python-dependencies: nox
98-
use-uv: true
100+
101+
- name: Install dependencies
102+
run: |
103+
python -m pip install -U pip uv
104+
python -m uv pip install --system nox
99105
100106
- name: Run coverage
101107
run: |

CHANGELOG.md

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,77 +18,86 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
1818

1919
## [Unreleased]
2020

21+
### Added
22+
23+
- Support for Python 3.13.
24+
25+
### Changed
26+
27+
- Bumped `django-twc-package` template version to 2024.24.
28+
- Refactored how app settings are accessed within library to use a frozen `dataclass`.
29+
2130
## [0.3.2]
2231

2332
### Added
2433

25-
- Added a `py.typed` file for static type checkers.
34+
- Added a `py.typed` file for static type checkers.
2635

2736
## [0.3.1]
2837

2938
### Fixed
3039

31-
- Correctly JSON serialize `Task` kwargs when going from the in-memory representation contained in the task registry to actual model instances in the database. First reported by [@joshuadavidthomas](https://github.com/joshuadavidthomas) in [#30](https://github.com/westerveltco/django-q-registry/issues/30).
40+
- Correctly JSON serialize `Task` kwargs when going from the in-memory representation contained in the task registry to actual model instances in the database. First reported by [@joshuadavidthomas](https://github.com/joshuadavidthomas) in [#30](https://github.com/westerveltco/django-q-registry/issues/30).
3241

3342
## [0.3.0]
3443

3544
### Changed
3645

37-
- Now using v2024.18 of `django-twc-package`.
46+
- Now using v2024.18 of `django-twc-package`.
3847

3948
### Removed
4049

41-
- Dropped support for Django 3.2.
50+
- Dropped support for Django 3.2.
4251

4352
## [0.2.1]
4453

4554
### Added
4655

47-
- Added a `TaskRegistry.created_tasks` attribute to store the `Task` instances created by the `TaskRegistry`.
56+
- Added a `TaskRegistry.created_tasks` attribute to store the `Task` instances created by the `TaskRegistry`.
4857

4958
### Changed
5059

51-
- Now using v2024.12 of `django-twc-package`.
60+
- Now using v2024.12 of `django-twc-package`.
5261

5362
### Fixed
5463

55-
- Fixed a bug in the `setup_periodic_tasks` management command where newly created tasks via `Task.objects.create_from_registry` were immediately deleted via `Task.objects.delete_dangling_objects`. Newly created tasks are now added to the `TaskRegistry.created_tasks` attribute and are only deleted if they are not in the `TaskRegistry.created_tasks` attribute.
64+
- Fixed a bug in the `setup_periodic_tasks` management command where newly created tasks via `Task.objects.create_from_registry` were immediately deleted via `Task.objects.delete_dangling_objects`. Newly created tasks are now added to the `TaskRegistry.created_tasks` attribute and are only deleted if they are not in the `TaskRegistry.created_tasks` attribute.
5665

5766
## [0.2.0]
5867

5968
### Added
6069

61-
- Refactored the `django_q_registry.registry.Task` dataclass into a `django_q_registry.models.Task` Django model. This should make it more flexible and robust for registering tasks and the associated `django_q.models.Schedule` instances.
70+
- Refactored the `django_q_registry.registry.Task` dataclass into a `django_q_registry.models.Task` Django model. This should make it more flexible and robust for registering tasks and the associated `django_q.models.Schedule` instances.
6271

6372
### Changed
6473

65-
- Now using [`django-twc-package`](https://github.com/westerveltco/django-twc-package) template for repository and package structure.
66-
- The default for the `Q_REGISTRY["PERIOIDIC_TASK_SUFFIX"]` app setting has been changed from `"- CRON"` to `"- QREGISTRY"`.
67-
- All database logic has been moved from the `TaskRegistry` to the `setup_periodic_tasks` management command.
68-
- GitHub Actions `test` workflow now uses the output of `nox -l --json` to dynamically generate the test matrix.
74+
- Now using [`django-twc-package`](https://github.com/westerveltco/django-twc-package) template for repository and package structure.
75+
- The default for the `Q_REGISTRY["PERIOIDIC_TASK_SUFFIX"]` app setting has been changed from `"- CRON"` to `"- QREGISTRY"`.
76+
- All database logic has been moved from the `TaskRegistry` to the `setup_periodic_tasks` management command.
77+
- GitHub Actions `test` workflow now uses the output of `nox -l --json` to dynamically generate the test matrix.
6978

7079
### Fixed
7180

72-
- Fixed a bug in the hashing of a `Task` where the `hash` function was passed unhashable values (e.g. a `dict`). Thanks to [@Tobi-De](https://github.com/Tobi-De) for the bug report ([#6](https://github.com/westerveltco/django-q-registry/issues/6)).
81+
- Fixed a bug in the hashing of a `Task` where the `hash` function was passed unhashable values (e.g. a `dict`). Thanks to [@Tobi-De](https://github.com/Tobi-De) for the bug report ([#6](https://github.com/westerveltco/django-q-registry/issues/6)).
7382

7483
## [0.1.0]
7584

7685
Initial release!
7786

7887
### Added
7988

80-
- Initial documentation.
81-
- Initial tests.
82-
- Initial CI/CD (GitHub Actions).
83-
- A registry for Django Q2 periodic tasks.
84-
- `registry.register` function for registering periodic tasks with a convenience decorator `register_task`.
85-
- A `TASKS` setting for registering periodic tasks from Django settings.
86-
- Autodiscovery of periodic tasks from a Django project's `tasks.py` files.
87-
- A `setup_periodic_tasks` management command for setting up periodic tasks in the Django Q2 broker.
89+
- Initial documentation.
90+
- Initial tests.
91+
- Initial CI/CD (GitHub Actions).
92+
- A registry for Django Q2 periodic tasks.
93+
- `registry.register` function for registering periodic tasks with a convenience decorator `register_task`.
94+
- A `TASKS` setting for registering periodic tasks from Django settings.
95+
- Autodiscovery of periodic tasks from a Django project's `tasks.py` files.
96+
- A `setup_periodic_tasks` management command for setting up periodic tasks in the Django Q2 broker.
8897

8998
### New Contributors
9099

91-
- Josh Thomas <[email protected]> (maintainer)
100+
- Josh Thomas <[email protected]> (maintainer)
92101

93102
[unreleased]: https://github.com/westerveltco/django-q-registry/compare/v0.3.2...HEAD
94103
[0.1.0]: https://github.com/westerveltco/django-q-registry/releases/tag/v0.1.0

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ A Django app to register periodic Django Q tasks.
1111

1212
## Requirements
1313

14-
- Python 3.8, 3.9, 3.10, 3.11, 3.12
14+
- Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
1515
- Django 4.2, 5.0
1616
- Django Q2 1.4.3+
1717
- This package has only been tested with the Django ORM broker.
1818

19-
## Getting Started
19+
## Installation
2020

2121
1. Install the package from PyPI:
2222

@@ -34,7 +34,7 @@ INSTALLED_APPS = [
3434
]
3535
```
3636

37-
## Usage
37+
## Getting Started
3838

3939
### Registering Periodic Tasks
4040

noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
PY310 = "3.10"
1414
PY311 = "3.11"
1515
PY312 = "3.12"
16-
PY_VERSIONS = [PY38, PY39, PY310, PY311, PY312]
16+
PY313 = "3.13"
17+
PY_VERSIONS = [PY38, PY39, PY310, PY311, PY312, PY313]
1718
PY_DEFAULT = PY_VERSIONS[0]
1819
PY_LATEST = PY_VERSIONS[-1]
1920

pyproject.toml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers = [
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2223
"Programming Language :: Python :: Implementation :: CPython"
2324
]
2425
dependencies = ["django>=4.2", "django_q2>=1.4.3"]
@@ -48,7 +49,8 @@ dev = [
4849
"pytest-django",
4950
"pytest-randomly",
5051
"pytest-reverse",
51-
"pytest-xdist"
52+
"pytest-xdist",
53+
"ruff"
5254
]
5355
docs = [
5456
"cogapp",
@@ -102,7 +104,12 @@ django_settings_module = "tests.settings"
102104
strict_settings = false
103105

104106
[tool.djlint]
107+
blank_line_after_tag = "endblock,endpartialdef,extends,load"
108+
blank_line_before_tag = "block,partialdef"
109+
custom_blocks = "partialdef"
110+
ignore = "H031" # Don't require `meta` tag keywords
105111
indent = 2
112+
profile = "django"
106113

107114
[tool.hatch.build]
108115
exclude = [".*", "Justfile"]
@@ -115,7 +122,13 @@ path = "src/django_q_registry/__init__.py"
115122

116123
[tool.mypy]
117124
check_untyped_defs = true
118-
exclude = "docs/.*\\.py$"
125+
exclude = [
126+
"docs",
127+
"tests",
128+
"migrations",
129+
"venv",
130+
".venv"
131+
]
119132
mypy_path = "src/"
120133
no_implicit_optional = true
121134
plugins = ["mypy_django_plugin.main"]
@@ -126,7 +139,12 @@ warn_unused_ignores = true
126139
[[tool.mypy.overrides]]
127140
ignore_errors = true
128141
ignore_missing_imports = true
129-
module = ["django_q.*", "django_q_registry.*.migrations.*", "tests.*"]
142+
module = [
143+
"*.migrations.*",
144+
"django_q.*",
145+
"docs.*",
146+
"tests.*"
147+
]
130148

131149
[tool.mypy_django_plugin]
132150
ignore_missing_model_attributes = true

0 commit comments

Comments
 (0)