Package: ambient-toolbox
Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets.PyPIGitHubFull documentationCreator & Maintainer:Ambient DigitalFeaturesUseful classes and mixins for Django adminCoverage script for GitLabExtensions for DRF and GraphQLMailing backends for DjangoManagement commands for validating a projects test structureObject ownership tracking with timestampingPattern for improved workflow with Django ORMHelper and util functions for many different use-casesSentry pluginsdjango-scrubber wrapper classMixins and test classes for django (class-based) viewsMigration from "ai_django_core"This package was previously known asai_django_core. Due to the
misleading nature of the name, we chose to rename it with something more meaningful.The migration is really simple, just:Install ambient-toolbox and remove the dependency to ai-django-coreSearch and replace all usages offrom ai_django_core...tofrom ambient_toolbox...The class-based mail functionality was moved to a separate package calleddjango-pony-express.InstallationInstall the package via pip:pip install ambient-toolboxor via pipenv:pipenv install ambient-toolboxAdd module toINSTALLED_APPSwithin the main djangosettings.py:INSTALLED_APPS = (
    ...
    'ambient_toolbox',
)Apply migrations by running:python ./manage.py migrateContributeSetup package for developmentCreate a Python virtualenv and activate itInstall "pip-tools" withpip install -U pip-toolsCompile the requirements withpip-compile --extra dev,drf,graphql,sentry,view-layer, -o requirements.txt pyproject.toml --resolver=backtrackingSync the dependencies with your virtualenv withpip-syncAdd functionalityCreate a new branch for your featureChange the dependency in your requirements.txt to a local (editable) one that points to your local file system:-e /Users/workspace/ambient-toolboxor via pippip install -e /Users/workspace/ambient-toolboxEnsure the code passes the testsCreate a pull requestRun testsRun testspytest --ds settings testsCheck coveragecoverage run -m pytest --ds settings tests
coverage report -mGit 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 toinstallpre-commit and run once:pre-commit install -t pre-push -t pre-commit --install-hooksThis will permanently install the git hooks for both, frontend and backend, in your local.git/hooksfolder.
The hooks are configured in the.pre-commit-config.yaml.You can check whether hooks work as intended using theruncommand:pre-commit run [hook-id] [options]Example: run single hookpre-commit run ruff --all-files --hook-stage pushExample: run all hooks of pre-push stagepre-commit run --all-files --hook-stage pushUpdate documentationTo build the documentation run:sphinx-build docs/ docs/_build/html/.Opendocs/_build/html/index.htmlto see the documentation.Translation filesIf 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 toambient-toolboxpython manage.py makemessages -l deHave a look at the new/changed files withinambient_toolbox/localeHow to compile translation files:Navigate toambient-toolboxpython manage.py compilemessagesHave a look at the new/changed files withinambient_toolbox/localePublish to ReadTheDocs.ioFetch the latest changes in GitHub mirror and push themTrigger new build at ReadTheDocs.io (follow instructions in admin panel at RTD) if the GitHub webhook is not yet set
up.Publish to PyPiUpdate documentation about new/changed functionalityUpdate theChangelogIncrement version in main__init__.pyCreate pull request / merge to masterThis project uses the flit package to publish to PyPI. Thus publishing should be as easy as running:flit publishTo publish to TestPyPI use the following ensure that you have set up your .pypirc as
shownhereand use the following command:flit publish --repository testpypiMaintenancePlease note that this package supports theambient-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 likepyupgradeordjango-upgrade.To run an update, refer to thedocumentation pageof the "ambient-package-update".