Setting Up Your Project

First we need to prepare a Python project. We will use a Python virtual environment, and the project configuration file pyproject.toml.

Important

Ligare requires a minimum Python version of 3.10.

Create a project directory, create a new virtual environment, and activate the virtual environment.

user@: $ mkdir my-ligare-app && cd my-ligare-app
user@: my-ligare-app $ python -m venv .venv
user@: my-ligare-app $ . .venv/bin/activate

The following commands are executed with the virtual environment activated.

Now we can create a minimal pyproject.toml file that lets us create our application, and install Ligare.web.

First we need to ensure compatibility with Python 3.10.

user@: my-ligare-app $ cat > pyproject.toml << EOF
[project]
requires-python = ">= 3.10"

EOF

Next we set the name of our application.

user@: my-ligare-app $ echo 'name = "my-ligare-app"' >> pyproject.toml

Then we set an initial version.

user@: my-ligare-app $ echo 'version = "0.0.1"' >> pyproject.toml

Finally, we include Ligare.web as a dependency of our application.

user@: my-ligare-app $ cat >> pyproject.toml << EOF

dependencies = [
   "Ligare.web"
]
EOF

Once completed, our pyproject.toml should look like this.

[project]
requires-python = ">= 3.10"

name = "web-api"
version = "0.0.1"

dependencies = [
    "Ligare.web"
]

Now we can install everything necessary to create a Ligare application.

user@: my-ligare-app $ pip install -e .

We use -e here because this allows the application to run our changes to code without requiring that we reinstall the application every time we change something.