# VIPSCore-Python Python implementation of VIPSCore, to enable models written in Python. ## Notes to self Consider using the advice listed here: https://github.com/zhanymkanov/fastapi-best-practices ## Installation Clone Gitlab repo ```sh $ git clone git@gitlab.nibio.no:VIPS/VIPSCore-Python.git $ cd VIPSCore-Python ``` Create and activate virtual environment ```sh $ python3 -m venv venv $ . venv/bin/activate ``` Upgrade pip in virtual environment ```sh (venv)$ python3 -m pip install --upgrade pip -> Successfully installed pip-22.3.1 ``` Install dependencies from requirements.txt ```sh (venv)$ pip install -r requirements.txt ``` ### Update dependencies This was done at start of project, and must be repeated after all dependency changes: TODO: Decide on whether to use pip freeze or manage requirements.txt manually. Ref e.g. [this blogpost](https://medium.com/@tomagee/pip-freeze-requirements-txt-considered-harmful-f0bce66cf895) ```sh (venv)$ pip install "fastapi[all]" (and others) (venv)$ pip freeze > requirements.txt ``` NB! `fastapi[all]` includes a lot of things, in order to get started quickly. Should consider importing only the relevant packages later on. ### Start and stop virtual environment ```sh $ . venv/bin/activate (venv)$ deactivate ``` ### Install VIPS models The VIPS models available will vary between deployments of VIPSCore-Python. They are installed using pip, and specified in `models.txt` - which can be considered a deployment specific addendum to `requirements.txt`. Copy `models_example.txt` to `models.txt` to get started. ```sh pip install -r models.txt ``` ## Development ### Run application locally ```sh (venv)$ uvicorn src.main:app --reload ```