Setup
It follows an issue raised on the Github of the project.
It recommends the use of a hybrid development environment, as most of the time only the web-app needs to be changed:
- Pycharm or any Python IDE for the web-app
- Docker for db, nginx, celery and worker. The three later are even optional if you don't develop modules.
Web-app
For the webapp configuration, a specific .ini
need to be created.
- Create
config.priv.ini
in source/app by copying theconfig.docker.ini
present in the same directory. - Change
PG_SERVER = db
toPG_SERVER = 127.0.0.1
or whatever IP is the Postgresql/docker running with
That's the only configuration change needed for the app to run outside docker. The docker.priv.ini
is already excluded in gitignore.
Then Pycharm need to be setup with a dedicated environment, by adding a new configuration:
- Script path :
source/run.py
- Python interpreter 3.9
- Working directory:
source
To have pylint, right click on source
in the directory tree and mark directory as
> sources root
.
The requirements then need to be installed. Pycharm should detect the requirements.txt and propose to install the dependencies.
Otherwise they can be installed with the following command (issued in the virtual environment) :
pip3 install -r source\requirements.txt
Run
- Spin up the docker db
docker-compose up db
- Run the Pycharm configuration you created
- The interface should be accessible on http://127.0.0.1:8000 (and https://127.0.0.1:4433 if you started the nginx docker)
IRIS can now be developed and debugged on the fly.
Tests in docker
Once the code is working by running on Pycharm, we highly recommend testing it on Docker. To do so, the app docker need to be erased and rebuilt.
docker-compose rm app
docker-compose build app
docker-compose up db app
Development considerations
If the development results in DB modification, please use Alembic and add a migration script so users don't loose their data when they upgrade.