Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump template to 2024.24 #52

Merged
merged 6 commits into from
Aug 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bump template to 2024.24
joshuadavidthomas committed Aug 1, 2024
commit bbf2c4feafefc45b5897b9aad049a9ef309636db
3 changes: 2 additions & 1 deletion .copier/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2024.18
_commit: v2024.24
_src_path: gh:westerveltco/django-twc-package
author_email: [email protected]
author_name: Josh Thomas
@@ -19,5 +19,6 @@ python_versions:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
test_django_main: true
versioning_scheme: SemVer
19 changes: 0 additions & 19 deletions .github/workflows/labels.yml

This file was deleted.

45 changes: 12 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -4,53 +4,32 @@ on:
release:
types: [released]

jobs:
check:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
permissions:
contents: write

- name: Check most recent test run on `main`
id: latest-test-result
run: |
echo "result=$(gh run list \
--branch=main \
--workflow=test.yml \
--json headBranch,workflowName,conclusion \
--jq '.[] | select(.headBranch=="main" and .conclusion=="success") | .conclusion' \
| head -n 1)" >> $GITHUB_OUTPUT
- name: OK
if: ${{ (contains(steps.latest-test-result.outputs.result, 'success')) }}
run: exit 0

- name: Fail
if: ${{ !contains(steps.latest-test-result.outputs.result, 'success') }}
run: exit 1
jobs:
test:
uses: ./.github/workflows/test.yml

pypi:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: check
needs: test
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.12
extra-python-dependencies: hatch
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system hatch
- name: Build package
run: |
48 changes: 27 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: test

on:
pull_request:
push:
branches: [main]
pull_request:
workflow_call:

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

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox
- id: set-matrix
run: |
@@ -42,14 +44,16 @@ jobs:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
extra-python-dependencies: nox
use-uv: true
allow-prereleases: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox
- name: Run tests
run: |
@@ -71,14 +75,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox
- name: Run mypy
run: |
@@ -88,14 +93,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox
- name: Run coverage
run: |
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,12 +11,12 @@ A Django app to register periodic Django Q tasks.

## Requirements

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

## Getting Started
## Installation

1. Install the package from PyPI:

@@ -34,7 +34,7 @@ INSTALLED_APPS = [
]
```

## Usage
## Getting Started

### Registering Periodic Tasks

3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@
PY310 = "3.10"
PY311 = "3.11"
PY312 = "3.12"
PY_VERSIONS = [PY38, PY39, PY310, PY311, PY312]
PY313 = "3.13"
PY_VERSIONS = [PY38, PY39, PY310, PY311, PY312, PY313]
PY_DEFAULT = PY_VERSIONS[0]
PY_LATEST = PY_VERSIONS[-1]

24 changes: 21 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython"
]
dependencies = ["django>=4.2", "django_q2>=1.4.3"]
@@ -48,7 +49,8 @@ dev = [
"pytest-django",
"pytest-randomly",
"pytest-reverse",
"pytest-xdist"
"pytest-xdist",
"ruff"
]
docs = [
"cogapp",
@@ -102,7 +104,12 @@ django_settings_module = "tests.settings"
strict_settings = false

[tool.djlint]
blank_line_after_tag = "endblock,endpartialdef,extends,load"
blank_line_before_tag = "block,partialdef"
custom_blocks = "partialdef"
ignore = "H031" # Don't require `meta` tag keywords
indent = 2
profile = "django"

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

[tool.mypy]
check_untyped_defs = true
exclude = "docs/.*\\.py$"
exclude = [
"docs",
"tests",
"migrations",
"venv",
".venv"
]
mypy_path = "src/"
no_implicit_optional = true
plugins = ["mypy_django_plugin.main"]
@@ -126,7 +139,12 @@ warn_unused_ignores = true
[[tool.mypy.overrides]]
ignore_errors = true
ignore_missing_imports = true
module = ["django_q.*", "django_q_registry.*.migrations.*", "tests.*"]
module = [
"*.migrations.*",
"django_q.*",
"docs.*",
"tests.*"
]

[tool.mypy_django_plugin]
ignore_missing_model_attributes = true
12 changes: 12 additions & 0 deletions src/django_q_registry/_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from __future__ import annotations

import sys

if sys.version_info >= (3, 12):
from typing import override as typing_override
else: # pragma: no cover
from typing_extensions import (
override as typing_override, # pyright: ignore[reportUnreachable]
)

override = typing_override
24 changes: 12 additions & 12 deletions src/django_q_registry/conf.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
from __future__ import annotations

from typing import Any
from typing import ClassVar
from dataclasses import dataclass

from django.conf import settings

from ._typing import override

DJANGO_Q_REGISTRY_SETTINGS_NAME = "Q_REGISTRY"

class AppSettings:
DEFAULT_SETTINGS: ClassVar[dict[str, Any]] = {
"PERIODIC_TASK_SUFFIX": " - QREGISTRY",
"TASKS": [],
}

def __getattr__(self, key):
return self.get(key)
@dataclass(frozen=True)
class AppSettings:
PERIODIC_TASK_SUFFIX = "- QREGISTRY"
TASKS = []

def get(self, key):
user_settings = getattr(settings, "Q_REGISTRY", {})
return user_settings.get(key, self.DEFAULT_SETTINGS.get(key))
@override
def __getattribute__(self, __name: str) -> object:
user_settings = getattr(settings, DJANGO_Q_REGISTRY_SETTINGS_NAME, {})
return user_settings.get(__name, super().__getattribute__(__name)) # pyright: ignore[reportAny]


app_settings = AppSettings()