Package: ai-django-core
Disclaimer: Package was superseded by ambient-toolbox!This package was renamed, moved and deprecated under the old name. The successor is the "Ambient Toolbox".PyPIMigration docsOverviewThis package contains various useful helper functions. You can read up on all the fancy things atreadthedocs.io.InstallationInstall the package via pip:pip install ai-django-coreor via pipenv:pipenv install ai-django-coreAdd module toINSTALLED_APPSwithin the main djangosettings.py:INSTALLED_APPS = (
    ...
    'ai_django_core',
)ContributeSetup package for developmentCreate a Python 3.11 virtualenvActivate the virtualenv (take care that you needScripts/activate.ps1for Windows users instead ofScripts/activate)Install dependencies withpip install .[dev,docs,view-layer,drf,graphql]Add functionalityClone the project locallyCreate 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/ai-django-coreor via pippip install -e /Users/workspace/ai-django-coreEnsure the code passes the testsCreate a pull requestRun testsCheck coveragepytest --cov=.Run testspytestGit 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 generate new auto-docs for new modules run:sphinx-apidoc -o ./docs/modules/ ./ai_django_core/(in the current
set up an auto doc for the antivirus module is not supported due to installation and import problems. Since it might
be removed in the future, that should be fine for now).To build the documentation run:sphinx-build docs/ docs/_build/html/or go into thedocsfolder and
run:make 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 toai_django_core/ai_django_core(the inner directory!)python manage.py makemessages -l deHave a look at the new/changed files withinai_django_core/ai_django_core/localeHow to compile translation files:Navigate toai_django_core/ai_django_core(the inner directory!)python manage.py compilemessagesHave a look at the new/changed files withinai_django_core/ai_django_core/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 testpypi