AiiDA REST API for data queries and workflow management.
Uses pydantic for models/validation and fastapi for the ASGI application.
Serve e.g. using uvicorn.
/users(GET/POST) and/users/<id>(GET) endpoints- Authentication via JSON web tokens (see
test_auth.pyfor the flow; also works via interactive docs) Userpydanticmodel for validation- Automatic documentation at
http://127.0.0.1:8000/docs - Full specification at
http://127.0.0.1:8000/openapi.json
pip install aiida-restapi[auth]# start rest api
uvicorn aiida_restapi:app
# start rest api and reload for changes (for development)
uvicorn aiida_restapi:app --reloadSee the examples directory.
git clone https://github.com/aiidateam/aiida-restapi .
cd aiida-restapiWe use pre-commit to take care for the formatting, type checking and linting.
pip install -e .[pre-commit] # install extra dependencies
pre-commit run # running pre-commit on changes
pre-commit run --all-files # running pre-commit on every file
pre-commit run pylint --all-files # run only the linter on every fileOne can also set up pre-commit to be run on every commit
pre-commit install
# pre-commit uninstall # to disable it againWith tox the tests can be run
pip install tox
tox -e py311 # run all tests for Python 3.11
tox -av # see all supported environmentstox will creat a custom environment to run the tests in. If you want to run the tests inside your current environment
pip install -e .[testing] # install extra dependencies
pytest -vSee the developer guide for more information.
MIT