Skip to content

AntaresSimulatorTeam/AntaREST

Folders and files

NameName
Last commit message
Last commit date
Jan 23, 2025
Dec 11, 2024
Jan 29, 2025
Jul 13, 2021
Jan 21, 2025
Jul 30, 2024
Feb 25, 2022
Jan 16, 2025
Jan 16, 2025
Jan 17, 2025
Jan 29, 2025
Jan 29, 2025
Jan 12, 2022
Mar 26, 2024
Aug 29, 2024
Sep 2, 2024
Oct 11, 2024
Oct 11, 2024
Jun 17, 2024
Oct 29, 2024
Jul 4, 2023
Oct 22, 2024
Sep 1, 2023
Jan 28, 2025
Jun 21, 2022
Jul 23, 2024
Nov 28, 2024
Jan 3, 2025
Oct 29, 2024
Oct 22, 2024
Oct 29, 2024
Jan 2, 2024
Sep 12, 2024
Apr 12, 2022
Nov 12, 2024
Dec 17, 2024

Repository files navigation

Antares Web

CI Coverage Licence

Screenshot

Documentation

The full project documentation can be found in the readthedocs website.

Build the API

First clone the projet:

git clone https://github.com/AntaresSimulatorTeam/AntaREST.git
cd AntaREST

Install back-end dependencies

python -m pip install --upgrade pip
pip install -r requirements.txt  # use requirements-dev.txt if building a single binary with pyinstaller 

Install the front-end dependencies:

cd webapp
npm install
cd ..

Then build the front-end application:

  • for use with pyinstaller:
NODE_OPTIONS="--max-old-space-size=8192" ./scripts/build-front.sh
  • for other uses (docker deployement, ...):
cd webapp
npm run build
cd ..

Using pyinstaller

Linux system:

git log -1 HEAD --format=%H > ./resources/commit_id
pyinstaller AntaresWebLinux.spec

Windows system:

git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller AntaresWebWin.spec

You can test the build is ok using:

dist/AntaresWeb/AntaresWebServer -v       # Linux based system
dist\AntaresWeb\AntaresWebServer.exe -v   # Windows system

Using docker

To build the docker image, use the following command:

docker build --tag antarest .

Run the API

Using binary built with pyinstaller

dist/AntaresWeb/AntaresWebServer -c </path/to/config.yaml>  # Linux based system
dist\AntaresWeb\AntaresWebServer.exe -c </path/to/config.yaml>    # Windows system

Using docker image

You may run the back-end with default configuration using the following command:

docker run \
  -p 80:5000 \
  -e GUNICORN_WORKERS=1 \
  antarest

However, for a complete deployment including the front-end application, and the use of an external database and an external REDIS instance, please refer to the deployement instructions on readthedocs website

Using python directly

Using uvicorn

pip install -e .

python ./antarest/main.py -c resources/application.yaml

Using gunicorn wsgi server with uvicorn workers

pip install -e .

export ANTAREST_CONF=resources/application.yaml
export GUNICORN_WORKERS=4
gunicorn --config conf/gunicorn.py --worker-class=uvicorn.workers.UvicornWorker antarest.wsgi:app

Examples

Once you started the server, you have access to the API. The address (the port mostly) depends of the way you started the server. If you start the server

To test the server, you can list the available studies in your workspace using:

curl http://localhost:8080/v1/studies

Or data of a specific study using:

curl http://localhost:8080/v1/studies/{study_uuid}

The current API handle hundreds of html end point (get and post) to manipulate your studies. The best way to discover the API is using it's swagger documentation (see below).

Swagger

The ANTARES API doc is available within the application (open your browser to http://localhost:8080) You can also fetch the raw open api spec :

curl http://localhost:8080/openapi.json > swagger.json