Before you can build AMT you first need to clone the git repository:
git clone https://github.com/MinBZK/amt.git
cd amt/
There are several ways to build and run AMT.
- Poetry & NPM
- Container
AMT uses 2 build systems within its project. One for the frontend (NPM) and one for the backend (Poetry).
Poetry is a Python package and dependency manager. Before you can install Poetry you first need to install Python. Please follow these instructions to install Python 3.12.
Once you have Python available you can install Poetry. See here.
NPM (Node package manager) is a node package and dependency manager. Before you can use NPM we recommend you install NVM (node version manager). Please followthese instructions.
once NVM is install you can execute the following commands to install node and NPM
nvm install
nvm use
Note that the .nvmrc is used to determine the version that is being installed for this project.
Once you have Poetry and NPM installed you can start installing the dependencies with the following shell commands.
npm install
poetry install
When poetry and npm are done installing all dependencies you can start using the tool. you need to start 2 processes
npm start
poetry run python -m uvicorn amt.server:app --log-level warning
Containers allows to package software, make it portable, and isolated. Before you can run a container you first need a container runtime. There are several available, but al lot of users use docker desktop.
After installing a Docker runtime like Docker Desktop you can start building the applications with this command:
docker compose build
To run the application you use this command:
docker compose up
To use a development environment during local development, you can use the following environment options.
export AUTO_CREATE_SCHEMA=true
We support most SQL database types. You can use the variable APP_DATABASE_SCHEME
to change the database. The default
scheme is sqlite.
If you change the models
at amt/models of the application you can generate a new migration file
alembic revision --autogenerate -m "a message"
Please make sure you check the auto generated file in amt/migrations/
to upgrade to the latest version of the database schema use
alembic upgrade head
We use babel for translations and a custom yaml for dynamic translations. Babel does not support Frysian, so we added a custom piece of code to support this. To generate, update or compile the language files, use the script in ./script/translate.
When running the script/translate update command, Python may give the error
ValueError: Unknown extraction method 'jinja2'
The solution for this error, is to upgrade/install the setuptools:
pip install --upgrade setuptools
For testing, linting and other feature we use several tools. You can look up the documentation on how to use these:
- pytest
poetry run pytest
- ruff
poetry run ruff format
orpoetry run ruff check --fix
- coverage
poetry run coverage report
- pyright
poetry run pyright
VSCode has great support for devcontainers. If your editor has support for devcontainers you can also use them to start the devcontainer. Devcontaines offer great standardized environments for development.
Use poetry to update all python project dependencies
poetry update
Use pre-commit to update all hooks
pre-commit autoupdate