diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3698e0f..39241fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: run: pip install pre-commit - name: Run pre-commit hooks - run: pre-commit run --all-files --hook-stage push + run: pre-commit run --all-files tests: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d1dd65..7e95662 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,12 +3,12 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.11.11 hooks: # Run the Ruff formatter. - id: ruff-format # Run the Ruff linter. - - id: ruff + - id: ruff-check args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/adamchainz/blacken-docs @@ -20,19 +20,19 @@ repos: files: '(?:README\.md|\.ambient-package-update\/templates\/snippets\/.*\.tpl|docs\/.*\.(?:md|rst))' - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v3.20.0 hooks: - id: pyupgrade args: [ --py310-plus ] - repo: https://github.com/adamchainz/django-upgrade - rev: 1.24.0 + rev: 1.25.0 hooks: - id: django-upgrade args: [--target-version, "4.2"] - repo: https://github.com/adamchainz/djade-pre-commit - rev: 1.3.2 + rev: 1.4.0 hooks: - id: djade args: [--target-version, "4.2"] @@ -45,10 +45,15 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - - id: no-commit-to-branch - args: - [ - "--pattern", - '^^(?!(?:feature|hotfix|bugfix|refactor|maintenance)/[\w\d\-_#]+).*$', - ] - stages: [ pre-commit ] + - id: check-ast + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace diff --git a/CHANGES.md b/CHANGES.md index 6501ab5..bf5ad5d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,8 @@ # Changelog +**0.3.4** (2025-05-29) + * Maintenance updates via ambient-package-update + **0.3.3** (2025-04-03) * Clarified package tagline diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a511bab --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contribute + +## Setup package for development + +- Create a Python virtualenv and activate it +- Install "pip-tools" with `pip install -U pip-tools` +- Compile the requirements with `pip-compile --extra dev, -o requirements.txt pyproject.toml --resolver=backtracking` +- Sync the dependencies with your virtualenv with `pip-sync` + +## Add functionality + +- Create a new branch for your feature +- Change the dependency in your requirements.txt to a local (editable) one that points to your local file system: + `-e /Users/workspace/django-queuebie` or via pip `pip install -e /Users/workspace/django-queuebie` +- Ensure the code passes the tests +- Create a pull request + +## Run tests + +- Run tests + ```` + pytest --ds settings tests + ```` + +- Check coverage + ```` + coverage run -m pytest --ds settings tests + coverage report -m + ```` + +## Git hooks (via pre-commit) + +We use pre-push hooks to ensure that only linted code reaches our remote repository and pipelines aren't triggered in +vain. + +To enable the configured pre-push hooks, you need to [install](https://pre-commit.com/) pre-commit and run once: + + pre-commit install -t pre-push -t pre-commit --install-hooks + +This will permanently install the git hooks for both, frontend and backend, in your local +[`.git/hooks`](./.git/hooks) folder. +The hooks are configured in the [`.pre-commit-config.yaml`](templates/.pre-commit-config.yaml.tpl). + +You can check whether hooks work as intended using the [run](https://pre-commit.com/#pre-commit-run) command: + + pre-commit run [hook-id] [options] + +Example: run single hook + + pre-commit run ruff --all-files + +Example: run all hooks of pre-push stage + + pre-commit run --all-files + +## Update documentation + +- To build the documentation, run: `sphinx-build docs/ docs/_build/html/`. +- Open `docs/_build/html/index.html` to see the documentation. + + +### Translation files + +If you have added custom text, make sure to wrap it in `_()` where `_` is +gettext_lazy (`from django.utils.translation import gettext_lazy as _`). + +How to create translation file: + +* Navigate to `django-queuebie` +* `python manage.py makemessages -l de` +* Have a look at the new/changed files within `queuebie/locale` + +How to compile translation files: + +* Navigate to `django-queuebie` +* `python manage.py compilemessages` +* Have a look at the new/changed files within `queuebie/locale` diff --git a/README.md b/README.md index 13166a3..b466d0b 100644 --- a/README.md +++ b/README.md @@ -88,85 +88,6 @@ handle_message( -## Contribute - -### Setup package for development - -- Create a Python virtualenv and activate it -- Install "pip-tools" with `pip install -U pip-tools` -- Compile the requirements with `pip-compile --extra dev, -o requirements.txt pyproject.toml --resolver=backtracking` -- Sync the dependencies with your virtualenv with `pip-sync` - -### Add functionality - -- Create a new branch for your feature -- Change the dependency in your requirements.txt to a local (editable) one that points to your local file system: - `-e /Users/workspace/django-queuebie` or via pip `pip install -e /Users/workspace/django-queuebie` -- Ensure the code passes the tests -- Create a pull request - -### Run tests - -- Run tests - ```` - pytest --ds settings tests - ```` - -- Check coverage - ```` - coverage run -m pytest --ds settings tests - coverage report -m - ```` - -### Git hooks (via pre-commit) - -We use pre-push hooks to ensure that only linted code reaches our remote repository and pipelines aren't triggered in -vain. - -To enable the configured pre-push hooks, you need to [install](https://pre-commit.com/) pre-commit and run once: - - pre-commit install -t pre-push -t pre-commit --install-hooks - -This will permanently install the git hooks for both, frontend and backend, in your local -[`.git/hooks`](./.git/hooks) folder. -The hooks are configured in the [`.pre-commit-config.yaml`](templates/.pre-commit-config.yaml.tpl). - -You can check whether hooks work as intended using the [run](https://pre-commit.com/#pre-commit-run) command: - - pre-commit run [hook-id] [options] - -Example: run single hook - - pre-commit run ruff --all-files - -Example: run all hooks of pre-push stage - - pre-commit run --all-files --hook-stage push - -### Update documentation - -- To build the documentation, run: `sphinx-build docs/ docs/_build/html/`. -- Open `docs/_build/html/index.html` to see the documentation. - - -### Translation files - -If you have added custom text, make sure to wrap it in `_()` where `_` is -gettext_lazy (`from django.utils.translation import gettext_lazy as _`). - -How to create translation file: - -* Navigate to `django-queuebie` -* `python manage.py makemessages -l de` -* Have a look at the new/changed files within `queuebie/locale` - -How to compile translation files: - -* Navigate to `django-queuebie` -* `python manage.py compilemessages` -* Have a look at the new/changed files within `queuebie/locale` - - ### Publish to ReadTheDocs.io - Fetch the latest changes in GitHub mirror and push them @@ -203,4 +124,3 @@ configuration and setup files. It works similar to well-known updaters like `pyu To run an update, refer to the [documentation page](https://pypi.org/project/ambient-package-update/) of the "ambient-package-update". - diff --git a/SECURITY.md b/SECURITY.md index bdb2d87..2f69f75 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,7 +4,7 @@ The maintainers of this package take security bugs seriously. We appreciate your disclose your findings, and will make every effort to acknowledge your contributions. To report a security issue, please use the GitHub Security -Advisory ["Report a Vulnerability"](https://github.com/ambient-innovation/django-queuebie/security/advisories/new) +Advisory ["Report a Vulnerability"](https://github.com/ambient-innovation/django-queuebie/security/advisories/new) tab. The maintainers will send a response indicating the next steps in handling your report. After the initial reply to diff --git a/pyproject.toml b/pyproject.toml index fca9f23..9f131c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,14 +42,14 @@ dev = [ 'pytest-django~=4.9', 'pytest-mock~=3.14', 'coverage~=7.6', - 'pre-commit~=4.0', - 'ruff~=0.6', + 'pre-commit~=4.2', + 'ruff~=0.11', 'sphinx~=7.1', 'sphinx-rtd-theme~=2.0', 'm2r2==0.3.3.post2', 'mistune<2.0.0', - 'flit~=3.9', - 'keyring~=25.4', + 'flit~=3.12', + 'keyring~=25.6', 'ambient-package-update', ] @@ -90,7 +90,8 @@ lint.select = [ "ANN401", # Checks that function arguments are annotated with a more specific type than Any "TRY", # Clean try/except "ERA", # Commented out code - "INP" # Ban PEP-420 implicit namespace packages + "INP", # Ban PEP-420 implicit namespace packages + "C90", # McCabe code complexity ] lint.ignore = [ "TD002", # Missing author in TODO @@ -124,7 +125,8 @@ lint.fixable = [ "ANN401", # Checks that function arguments are annotated with a more specific type than Any "TRY", # Clean try/except "ERA", # Commented out code - "INP" # Ban PEP-420 implicit namespace packages + "INP", # Ban PEP-420 implicit namespace packages + "C90", # McCabe code complexity ] lint.unfixable = [] diff --git a/queuebie/__init__.py b/queuebie/__init__.py index e394403..78f1a9e 100644 --- a/queuebie/__init__.py +++ b/queuebie/__init__.py @@ -1,6 +1,6 @@ """A simple and synchronous message queue for commands and events for Django""" -__version__ = "0.3.3" +__version__ = "0.3.4" from queuebie.registry import MessageRegistry diff --git a/queuebie/registry.py b/queuebie/registry.py index ce298e3..27fbb9e 100644 --- a/queuebie/registry.py +++ b/queuebie/registry.py @@ -86,7 +86,7 @@ def decorator(decoratee): return decorator - def autodiscover(self) -> None: + def autodiscover(self) -> None: # noqa: C901 """ Detects message registries which have been registered via the "register_*" decorator. """