This repo uses poetry for Python environment isolation and package management.
Before poetry can be installed, Python must be installed. The minimum version to be installed can be found in the pyproject.toml
file.
For this workshop Python 3.10 or 3.11 is required.
The appropriate download for your OS can be found here.
After installing Python, poetry can be installed. For OSX/ Linux / bashonwindows the command is:
curl -sSL https://install.python-poetry.org | python3 -
For Windows the PowerShell command is:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
To ensure the install succeeded, you can open a new shell and run
poetry --version
Windows users: if this does not work, see https://python-poetry.org/docs/#installing-with-the-official-installer point 3
Next poetry can be configured to create virtual environments for repos within the repo (this makes it easy to locate the .venv for a given repo if you want to clean / delete it):
poetry config virtualenvs.in-project true
For this workshop, we'll be using Visual Studio Code as our IDE. The appropriate download for your OS can be found here. If you have not yet cloned this repo, you can do so from within VS Code as detailed e.g. here.
After opening the cloned repo in VS Code, a popup should appear in the lower-right corner informing you that this repo has recommended extension that can be installed. Please do so.
Example launch and setting files are also included in the .vscode
folder.
You can simply copy them and strip the .example
part of the same to take them into use.
Now that the IDE and poetry are set up, the project's Python dependencies can be installed. With the repo opened in VS Code, open a terminal and execute:
poetry install
This should install all project dependencies. VS Code may inform you that a new virtual environment is detected and ask if you want to use it (yes).
In addition to poetry, the invoke package is used to
create tasks that can be ran on all platforms in the same manner. These tasks are defined in
the tasks.py
file in the root of the repo. To see which tasks are available, run
poetry run inv --list
If the
.venv
is activated in the current shell, this can be shortened toinv --list
Further information / documentation of the tasks (if available) can be shown using
poetry run inv --help <task_name>
To start the API server used for the workshop, simply run
poetry run inv start-api
Once the API server has started, you can connect to the Swagger UI at http://127.0.0.1:8000/docs#/