Skip to content

Install with Poetry

If you prefer to manage the project with Poetry instead of installing the package directly with pip, follow the steps below. This uses a pyproject.toml file that declares haskoning-retaining-wall as a dependency and points Poetry at the Azure Artifacts feed for you.

Prefer installing directly with pip instead? See Install with pip.

Prerequisites

  • Python 3.12+
  • Access to the Azure DevOps package feed
  • A Personal Access Token (PAT) with the Packaging: Read scope
  • A virtual environment created and activated

1. Install Poetry

With the virtual environment activated, install Poetry into it:

bash
pip install poetry

Installing Poetry inside the project's virtual environment (rather than globally) keeps it isolated to this project, but a global Poetry installation works too — just make sure your project's virtual environment is still activated when you run poetry install later.

2. Create a Personal Access Token (PAT)

Poetry needs a PAT to authenticate against the Azure Artifacts feed:

  1. In Azure DevOps, go to User Settings → Personal Access Tokens.
  2. Create a new token with the Packaging: Read scope.
  3. Copy the token value — you won't be able to view it again after leaving the page.

3. Configure Poetry with your PAT

Register the token with Poetry for the haskoning-py source (this matches the source name declared in pyproject.toml):

bash
poetry config http-basic.haskoning-py azure "<YOUR-PAT>"

Replace <YOUR-PAT> with the token you copied in step 3. This stores the credential in Poetry's local configuration so you don't need to re-enter it for future installs on the same machine.

4. Get the project file

Download the pyproject.toml template below and save it into the folder where you have your terminal open (the same folder as your activated .venv):

Download pyproject.toml

This file declares haskoning-retaining-wall as a dependency and configures the haskoning-py Azure Artifacts feed as its source:

toml
[project]
name = "retaining-wall"
version = "0.1.0"
description = ""
authors = []
requires-python = ">=3.12,<4"
dependencies = [
    "haskoning-retaining-wall (>=0.4.0,<0.9.0)"
]

[tool.poetry]
package-mode = false

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

[[tool.poetry.source]]
name = "haskoning-py"
url = "https://pkgs.dev.azure.com/corporateroot/_packaging/haskoning-py/pypi/simple/"
priority = "supplemental"

[tool.poetry.dependencies]
haskoning-retaining-wall = {source = "haskoning-py"}

5. Install the project dependencies

From the same folder, run:

bash
poetry install

Poetry reads pyproject.toml, resolves haskoning-retaining-wall against the haskoning-py feed (using the PAT you configured in step 3), and installs it — along with its dependencies — into your active virtual environment.

6. Verify the package was installed

Confirm that haskoning-retaining-wall is present in the environment Poetry created:

bash
poetry run pip show haskoning-retaining-wall

This should print the package's metadata (name, version, location, …). If instead you see a Package(s) not found error, the install did not complete successfully — check the output of poetry install for errors (see Notes below) and re-run it.

Alternatively, you can list all packages Poetry installed into the environment:

bash
poetry show

haskoning-retaining-wall should appear in the list.

Notes

  • If poetry install fails with an authentication error, double-check the PAT has the Packaging: Read scope and hasn't expired, and re-run the poetry config http-basic.haskoning-py azure "<YOUR-PAT>" command with a fresh token.
  • The source name in the PAT configuration command (http-basic.haskoning-py) must match the name under [[tool.poetry.source]] in pyproject.toml exactly.
  • package-mode = false means this pyproject.toml is set up purely to install and run the package, not to build/publish a package of your own.