-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started with example_service
This example service shows how to integrate the middleware in a new python project, with the middleware as a dependency. It does not implement any functionality outside of the example given in the middleware readme.
It assumes that poetry is already installed on the system.
As an alternative to following the steps described here, one can also choose to copy this project folder and use that as a starting point instead.
-
Create a new directory for the project and navigate to it.
-
Run
poetry initand fill in the details. Skip the prompt to set up dependencies interactively. -
In the generated
pyproject.tomlfile, add the following line to the[tool.poetry.dependencies]section (See also):
[tool.poetry.dependencies]
python = "^3.10"
middleware = { path = "/PATH/TO/MIDDLEWARE", develop = true }
-
Run
poetry shell,poetry installto create/activate a virtual environment and install packages. -
Copy the
example_service/main.pyfile into the project and run it to confirm it is working.
We have not yet found a way for poetry to be configured to authenticate when using python releases, so for now setting up a git dependency referencing the appropriate tag is the easiest way to make this work.
A git dependency is specified by replacing the middleware = line in the path dependencies
example with { git = ... }. For instance:
[tool.poetry.dependencies]
python = "^3.10"
middleware = { git = "https://github.com/Kurumiiw/Middleware.git", tag = "v0.1.0", subdirectory="middleware" }
A list of releases is provided here