From 803983e6fa2150c4d66954f557282c4fdbbbff6b Mon Sep 17 00:00:00 2001 From: Ronny Vedrilla Date: Wed, 20 Nov 2024 13:25:53 +0100 Subject: [PATCH] v11.5.5 --- .ambient-package-update/metadata.py | 2 +- .gitignore | 33 +++++------------------------ .pre-commit-config.yaml | 10 ++++----- CHANGES.md | 4 ++++ MANIFEST.in | 2 +- README.md | 20 ++++++++--------- ambient_toolbox/__init__.py | 2 +- ambient_toolbox/apps.py | 12 +++++------ docs/conf.py | 2 +- 9 files changed, 34 insertions(+), 53 deletions(-) diff --git a/.ambient-package-update/metadata.py b/.ambient-package-update/metadata.py index d2a7c07..691fc9e 100644 --- a/.ambient-package-update/metadata.py +++ b/.ambient-package-update/metadata.py @@ -11,7 +11,7 @@ from ambient_package_update.metadata.ruff_ignored_inspection import RuffIgnoredInspection METADATA = PackageMetadata( - package_name="ambient_toolbox", + package_name="ambient-toolbox", github_package_group="ambient-innovation", company="Ambient Innovation: GmbH", authors=[ diff --git a/.gitignore b/.gitignore index 070e061..0c50de8 100644 --- a/.gitignore +++ b/.gitignore @@ -82,25 +82,6 @@ target/ profile_default/ ipython_config.py -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock @@ -155,9 +136,12 @@ cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear +# and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ + +# Requirements.txt is managed by pip-tools +requirements.txt # sphinx build folder _build @@ -169,13 +153,6 @@ _build *.dll *.exe *.o -*.so - -# PyCharm -.idea/ - -# Pip-tools creates these files -/requirements.txt # Test databases *.sqlite diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0ce17f..5ed3d60 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.7.4 hooks: # Run the Ruff linter. - id: ruff @@ -12,15 +12,15 @@ repos: - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs - rev: 1.19.0 + rev: 1.19.1 hooks: - id: blacken-docs additional_dependencies: - - black==24.4.2 + - black==24.10.0 files: '(?:README\.md|docs\/.*\.(?:md|rst))' - repo: https://github.com/asottile/pyupgrade - rev: v3.18.0 + rev: v3.19.0 hooks: - id: pyupgrade args: [ --py39-plus ] @@ -34,7 +34,7 @@ repos: stages: [ pre-push ] - repo: https://github.com/adamchainz/djade-pre-commit - rev: 1.3.0 + rev: 1.3.2 hooks: - id: djade args: [--target-version, "4.2"] diff --git a/CHANGES.md b/CHANGES.md index f3284d9..fb280ba 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changelog +**11.5.5** (2024-11-20) + * Moved permission check to "apps.ready()" method + * Internal updates via `ambient-package-update` + **11.5.4** (2024-11-15) * Internal updates via `ambient-package-update` diff --git a/MANIFEST.in b/MANIFEST.in index 753cf3d..dbef239 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include README.md include LICENSE.md recursive-exclude * *.pyc -recursive-include ambient_toolbox *.py *.html *.js *.cfg *.mo *.po +recursive-include ambient-toolbox *.py *.html *.js *.cfg *.mo *.po diff --git a/README.md b/README.md index 90797e5..4988611 100644 --- a/README.md +++ b/README.md @@ -43,20 +43,20 @@ The migration is really simple, just: - Install the package via pip: - `pip install ambient_toolbox` + `pip install ambient-toolbox` or via pipenv: - `pipenv install ambient_toolbox` + `pipenv install ambient-toolbox` - Add module to `INSTALLED_APPS` within the main django `settings.py`: - ```` + ```python INSTALLED_APPS = ( - ... - 'ambient_toolbox', + # ... + "ambient_toolbox", ) - ```` + ``` - Apply migrations by running: @@ -159,12 +159,12 @@ How to compile translation files: - Create pull request / merge to master -- This project uses the flit package to publish to PyPI. Thus publishing should be as easy as running: +- This project uses the flit package to publish to PyPI. Thus, publishing should be as easy as running: ``` flit publish ``` - To publish to TestPyPI use the following ensure that you have set up your .pypirc as + To publish to TestPyPI use the following to ensure that you have set up your .pypirc as shown [here](https://flit.readthedocs.io/en/latest/upload.html#using-pypirc) and use the following command: ``` @@ -174,8 +174,8 @@ How to compile translation files: ### Maintenance Please note that this package supports the [ambient-package-update](https://pypi.org/project/ambient-package-update/). -So you don't have to worry about the maintenance of this package. All important configuration and setup files are -being rendered by this updater. It works similar to well-known updaters like `pyupgrade` or `django-upgrade`. +So you don't have to worry about the maintenance of this package. This updater is rendering all important +configuration and setup files. It works similar to well-known updaters like `pyupgrade` or `django-upgrade`. To run an update, refer to the [documentation page](https://pypi.org/project/ambient-package-update/) of the "ambient-package-update". diff --git a/ambient_toolbox/__init__.py b/ambient_toolbox/__init__.py index 25b989b..4a9feb4 100644 --- a/ambient_toolbox/__init__.py +++ b/ambient_toolbox/__init__.py @@ -1,3 +1,3 @@ """Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets.""" -__version__ = "11.5.4" +__version__ = "11.5.5" diff --git a/ambient_toolbox/apps.py b/ambient_toolbox/apps.py index fa8133d..ad2d555 100644 --- a/ambient_toolbox/apps.py +++ b/ambient_toolbox/apps.py @@ -8,10 +8,10 @@ class AmbientToolboxConfig(AppConfig): name = "ambient_toolbox" verbose_name = _("Ambient Toolbox") + def ready(self): + if getattr(settings, "STATIC_ROLE_PERMISSIONS_PATH", None) and not ( + getattr(settings, "STATIC_ROLE_PERMISSIONS_DISABLE_SYSTEM_CHECK", False) + ): + from ambient_toolbox.static_role_permissions.system_check import check_permissions_against_models -if getattr(settings, "STATIC_ROLE_PERMISSIONS_PATH", None) and not ( - getattr(settings, "STATIC_ROLE_PERMISSIONS_DISABLE_SYSTEM_CHECK", False) -): - from ambient_toolbox.static_role_permissions.system_check import check_permissions_against_models - - register(check_permissions_against_models, Tags.models) + register(check_permissions_against_models, Tags.models) diff --git a/docs/conf.py b/docs/conf.py index 6e2f374..0a19cfe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,7 @@ import django from django.conf import settings -sys.path.insert(0, os.path.abspath("..")) # so that we can access the "ambient_toolbox" package +sys.path.insert(0, os.path.abspath("..")) # so that we can access the "ambient-toolbox" package settings.configure( INSTALLED_APPS=[ "django.contrib.admin",