Skip to content

Configuration Files

Once initialized, Poetry will create a configuration file called pyproject.toml. This file will contain important metadata about your proejct, such as its name, version, author, dependencies, entry points to scripts, and more.

Example pyproject.toml from CHIME SPS Controller
[tool.poetry]
name = "controller"
version = "0.1.3"
description = "CHIME SPS Controller"
authors = ["CHIME SPS <chime_spawg@physics.mcgill.>"]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
numpy = "^1.24.3"
spshuff = {git = "ssh://git@github.com/chime-sps/spshuff", rev = "apr_slow_pulsar"}
sps-common = {git = "ssh://git@github.com/chime-sps/sps-common"}

[tool.poetry.dev-dependencies]
commitizen = "^3.4.0"
mypy = "^1.4.0"
pre-commit = "^3.3.3"
pytest = "^7.3.2"

[tool.poetry.scripts]
rpc-client = "controller.rpc_client:main"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Looking at this example, we see that each Poetry dependency has a version associated with it.

Understanding Version Symbols

~{version_number} means “Approximately equivalent to version”. It will update you to all future "PATCH" versions (1.2.X), without incrementing the "MINOR" version (1.X.3). For example, ~1.2.3 will use releases with versions from 1.2.3 to <1.3.0.

^{version} means “Compatible with version”. It will update you to all future "MINOR/PATCH" versions (1.X.X), without incrementing the "MAJOR" version (X.2.3). For example, ^1.2.3 will use releases with versions from 1.2.3 to <2.0.0.

Once you have your pyproject.toml file, you can then install all the dependencies listed in them by using:

poetry install
Poetry will then install all the listed dependencies, and their dependencies (and so on), and attempt to manage any version conflicts using the versions you specified. If it cannot, it will provide you with a warning saying that no conflifct-free environment exists with all the dependencies installed.

The solution to this configurtion is what the generated poetry.lock file is. It contains detailed information of every single required package and their versions, that work with the whole project.

You can also install the whole package to your local computer and have it available globally, by using pip:

pip install .
or
pip install git+https://github.com/CHIMEFRB/guidelines.git
or
pip install git+ssh://git@github.com:CHIMEFRB/guidelines.git