Skip to content

Commit 6a943f3

Browse files
authored
Merge pull request #62 from bckohan/dj6
Dj6
2 parents 3644463 + 564c596 commit 6a943f3

File tree

10 files changed

+325
-217
lines changed

10 files changed

+325
-217
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
push:
88
tags-ignore:
99
- '*'
10-
branches:
11-
- '*'
10+
branches: ['main']
1211
pull_request:
12+
branches: ['main']
1313
workflow_call:
1414
workflow_dispatch:
1515
inputs:

.github/workflows/test.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
push:
88
tags-ignore:
99
- '*'
10-
branches:
11-
- '*'
10+
branches: ['main']
1211
pull_request:
12+
branches: ['main']
1313
workflow_call:
1414
workflow_dispatch:
1515
inputs:
@@ -29,13 +29,14 @@ jobs:
2929
actions: write
3030
strategy:
3131
matrix:
32-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14.0-rc.3']
32+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
3333
django-version:
3434
- '3.2' # LTS April 2024
3535
- '4.2' # LTS April 2026
3636
- '5.0' # April 2025
3737
- '5.1' # December 2025
3838
- '5.2' # LTS April 2028
39+
- '6.0a1' # prerelease
3940
exclude:
4041
- python-version: '3.11'
4142
django-version: '3.2'
@@ -55,14 +56,25 @@ jobs:
5556
django-version: '4.2'
5657
- python-version: '3.13'
5758
django-version: '5.0'
58-
- python-version: '3.14.0-rc.3'
59+
- python-version: '3.14'
5960
django-version: '3.2'
60-
- python-version: '3.14.0-rc.3'
61+
- python-version: '3.14'
6162
django-version: '4.2'
62-
- python-version: '3.14.0-rc.3'
63+
- python-version: '3.14'
6364
django-version: '5.0'
64-
- python-version: '3.14.0-rc.3'
65+
- python-version: '3.14'
6566
django-version: '5.1'
67+
68+
- python-version: '3.9'
69+
django-version: '6.0a1'
70+
- python-version: '3.10'
71+
django-version: '6.0a1'
72+
- python-version: '3.11'
73+
django-version: '6.0a1'
74+
- python-version: '3.12'
75+
django-version: '6.0a1'
76+
- python-version: '3.13'
77+
django-version: '6.0a1'
6678
env:
6779
COVERAGE_FILE: linux-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
6880
TEST_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -78,16 +90,22 @@ jobs:
7890
id: sp
7991
with:
8092
python-version: ${{ matrix.python-version }}
93+
allow-prereleases: true
8194
- name: Install uv
8295
uses: astral-sh/setup-uv@v6
8396
with:
8497
enable-cache: true
8598
- name: Setup Just
8699
uses: extractions/setup-just@v3
87100
- name: Install Dependencies
101+
shell: bash
88102
run: |
89103
just setup ${{ steps.sp.outputs.python-path }}
90-
just test-lock "Django~=${{ matrix.django-version }}.0"
104+
if [[ "${{ matrix.django-version }}" =~ (a|b|rc) ]]; then
105+
just test-lock Django==${{ matrix.django-version }}
106+
else
107+
just test-lock Django~=${{ matrix.django-version }}.0
108+
fi
91109
just install
92110
- name: Install Emacs
93111
if: ${{ github.event.inputs.debug == 'true' }}
@@ -116,14 +134,14 @@ jobs:
116134
actions: write
117135
strategy:
118136
matrix:
119-
python-version: ['3.9', '3.13']
137+
python-version: ['3.9', '3.14']
120138
django-version:
121139
- '3.2' # LTS April 2024
122140
- '5.2' # LTS April 2028
123141
exclude:
124142
- python-version: '3.9'
125143
django-version: '5.2'
126-
- python-version: '3.13'
144+
- python-version: '3.14'
127145
django-version: '3.2'
128146
env:
129147
COVERAGE_FILE: macos-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
@@ -140,6 +158,7 @@ jobs:
140158
id: sp
141159
with:
142160
python-version: ${{ matrix.python-version }}
161+
allow-prereleases: true
143162
- name: Install uv
144163
uses: astral-sh/setup-uv@v6
145164
with:
@@ -205,6 +224,7 @@ jobs:
205224
id: sp
206225
with:
207226
python-version: ${{ matrix.python-version }}
227+
allow-prereleases: true
208228
- name: Install uv
209229
uses: astral-sh/setup-uv@v6
210230
with:

doc/source/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Change Log
33
==========
44

5+
v1.6.2 (2025-09-27)
6+
===================
7+
8+
* `Boolean flags on routine runners are broken on click 8.3+ <https://github.com/bckohan/django-routines/issues/63>`_
9+
* Support Django 6.0 - test against alpha
10+
11+
512
v1.6.1 (2025-07-25)
613
===================
714

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "django-routines"
7-
version = "1.6.1"
7+
version = "1.6.2"
88
description = "Define named groups of management commands in Django settings files for batched execution."
99
requires-python = ">=3.9,<4.0"
1010
authors = [
@@ -17,7 +17,7 @@ repository = "https://github.com/bckohan/django-routines"
1717
homepage = "https://django-routines.readthedocs.io"
1818
keywords = ["django", "CLI", "management", "routine", "routines", "batch", "commands", "deploy", "tasks", "package", "backup"]
1919
dependencies = [
20-
"Django>=3.2,<6.0",
20+
"Django>=3.2,<6.1",
2121
"django-typer>=3.2.2,<4.0"
2222
]
2323
classifiers = [
@@ -33,6 +33,7 @@ classifiers = [
3333
"Framework :: Django :: 5.0",
3434
"Framework :: Django :: 5.1",
3535
"Framework :: Django :: 5.2",
36+
"Framework :: Django :: 6.0",
3637
"Intended Audience :: Developers",
3738
"License :: OSI Approved :: MIT License",
3839
"Natural Language :: English",
@@ -82,7 +83,7 @@ dev = [
8283
"mypy>=1.10.0",
8384
"pre-commit>=4.0.1",
8485
"django-render-static>=3.2.1",
85-
"pywinpty>=2.0.14,<3.0.0; sys_platform == 'win32'",
86+
"pywinpty>=3.0.0; sys_platform == 'win32'",
8687
"tomlkit>=0.13.2",
8788
"readme-renderer[md]>=44.0",
8889
"packaging>=24.2",

src/django_routines/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from django.core.exceptions import ImproperlyConfigured
3131
from django.utils.functional import Promise
3232

33-
VERSION = (1, 6, 1)
33+
VERSION = (1, 6, 2)
3434

3535
__title__ = "Django Routines"
3636
__version__ = ".".join(str(i) for i in VERSION)

src/django_routines/management/commands/routine.py

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,30 @@
4444
def {routine_func}(
4545
self,
4646
ctx: typer.Context,
47-
subprocess: Annotated[bool, typer.Option("{subprocess_opt}", help="{subprocess_help}", show_default=False)] = {subprocess},
48-
atomic: Annotated[bool, typer.Option("{atomic_opt}", help="{atomic_help}", show_default=False)] = {atomic},
49-
continue_on_error: Annotated[bool, typer.Option("{continue_opt}", help="{continue_help}", show_default=False)] = {continue_on_error},
47+
subprocess: Annotated[
48+
bool,
49+
typer.Option(
50+
"{subprocess_opt}",
51+
help="{subprocess_help}",
52+
show_default=False
53+
)
54+
] = None,
55+
atomic: Annotated[
56+
bool,
57+
typer.Option(
58+
"{atomic_opt}",
59+
help="{atomic_help}",
60+
show_default=False
61+
)
62+
] = None,
63+
continue_on_error: Annotated[
64+
bool,
65+
typer.Option(
66+
"{continue_opt}",
67+
help="{continue_help}",
68+
show_default=False
69+
)
70+
] = None,
5071
all: Annotated[bool, typer.Option("--all", help="{all_help}")] = False,
5172
{switch_args}
5273
):
@@ -192,14 +213,16 @@ def _run_routine(
192213
def noop():
193214
yield
194215

195-
subprocess = subprocess if subprocess is not None else self.routine.subprocess
196-
is_atomic = atomic if atomic is not None else self.routine.atomic
216+
subprocess = (
217+
not self.routine.subprocess if subprocess else self.routine.subprocess
218+
)
219+
is_atomic = not self.routine.atomic if atomic else self.routine.atomic
197220
continue_on_error = (
198-
continue_on_error
199-
if continue_on_error is not None
221+
not self.routine.continue_on_error
222+
if continue_on_error
200223
else self.routine.continue_on_error
201224
)
202-
cli_options = {
225+
self._routine_options = {
203226
**self._routine_options,
204227
# we pass the resolved version of these options below
205228
# these will be based on the defaults for the routine if unspecified on the
@@ -208,7 +231,9 @@ def noop():
208231
"atomic": is_atomic,
209232
"continue_on_error": continue_on_error,
210233
}
211-
routine_started.send(sender=self, routine=self.routine.name, **cli_options)
234+
routine_started.send(
235+
sender=self, routine=self.routine.name, **self._routine_options
236+
)
212237

213238
ctx = transaction.atomic if is_atomic else noop
214239
with ctx(): # type: ignore
@@ -241,7 +266,7 @@ def noop():
241266
routine=self.routine.name,
242267
failed_command=idx,
243268
exception=routine_exc,
244-
**cli_options,
269+
**self._routine_options,
245270
)
246271
):
247272
continue
@@ -252,15 +277,15 @@ def noop():
252277
routine=self.routine.name,
253278
early_exit=True,
254279
last_command=idx,
255-
**cli_options,
280+
**self._routine_options,
256281
)
257282
return
258283
routine_finished.send(
259284
sender=self,
260285
routine=self.routine.name,
261286
early_exit=False,
262287
last_command=last,
263-
**cli_options,
288+
**self._routine_options,
264289
)
265290

266291
def _call_command(

tests/test_hooks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"settings": "",
3535
"pythonpath": None,
3636
"traceback": False,
37-
"subprocess": False,
38-
"atomic": False,
39-
"continue_on_error": False,
37+
"subprocess": None,
38+
"atomic": None,
39+
"continue_on_error": None,
4040
"all": False,
4141
}
4242
if find_spec("rich"):
@@ -130,6 +130,8 @@ def test_routine_hooks(self):
130130
expected = {
131131
**DEFAULT_OPTIONS,
132132
"continue_on_error": True,
133+
"atomic": False,
134+
"subprocess": False,
133135
"no_color": True,
134136
"switch": True,
135137
}

tests/test_initialize_finalize.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"settings": "",
2929
"pythonpath": None,
3030
"traceback": False,
31-
"subprocess": False,
32-
"atomic": False,
33-
"continue_on_error": False,
31+
"subprocess": None,
32+
"atomic": None,
33+
"continue_on_error": None,
3434
"all": False,
3535
}
3636
if find_spec("rich"):
@@ -154,6 +154,9 @@ def test_initialize_finalize_callbacks(self):
154154
**DEFAULT_OPTIONS,
155155
"no_color": True,
156156
"switch": True,
157+
"subprocess": False,
158+
"atomic": False,
159+
"continue_on_error": False,
157160
}
158161
init_opts = init_data["options"]
159162
del init_opts["manage_script"] # Remove variable path

tests/test_runs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from io import StringIO
6+
import pytest
67
import sys
78
import subprocess
89
from django.core.management import call_command
@@ -91,6 +92,7 @@ def test_subprocess_opt_error():
9192
from winpty import PtyProcess
9293
import time
9394

95+
@pytest.mark.skip(reason="winpty 3.0 is not working")
9496
def test_option_toggle():
9597
result = subprocess.run(
9698
[
@@ -123,7 +125,7 @@ def test_option_toggle():
123125
)
124126
)
125127
time.sleep(3)
126-
initial_output = proc.read(1024)
128+
initial_output = proc.read(4096)
127129
assert "Type 'yes' to continue, or 'no' to cancel:" in initial_output
128130
proc.write("yes\r\n")
129131
time.sleep(3)

0 commit comments

Comments
 (0)