2020-02-03 16:46:41 +00:00
|
|
|
# poetry
|
|
|
|
|
|
|
|
> Manage Python packages and dependencies.
|
2024-01-09 09:04:06 +00:00
|
|
|
> See also: `asdf`.
|
2022-10-17 16:44:48 +01:00
|
|
|
> More information: <https://python-poetry.org/docs/cli/>.
|
2020-02-03 16:46:41 +00:00
|
|
|
|
|
|
|
- Create a new Poetry project in the directory with a specific name:
|
|
|
|
|
|
|
|
`poetry new {{project_name}}`
|
|
|
|
|
2024-01-11 12:43:48 +00:00
|
|
|
- Install and add a dependency and its sub-dependencies to the `pyproject.toml` file in the current directory:
|
2020-02-03 16:46:41 +00:00
|
|
|
|
|
|
|
`poetry add {{dependency}}`
|
|
|
|
|
2024-01-11 12:43:48 +00:00
|
|
|
- Install the project dependencies using the `pyproject.toml` file in the current directory:
|
2021-11-30 14:12:11 +00:00
|
|
|
|
2024-01-11 12:43:48 +00:00
|
|
|
`poetry install`
|
2021-11-30 14:12:11 +00:00
|
|
|
|
2020-02-03 16:46:41 +00:00
|
|
|
- Interactively initialize the current directory as a new Poetry project:
|
|
|
|
|
|
|
|
`poetry init`
|
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Get the latest version of all dependencies and update `poetry.lock`:
|
2020-02-03 16:46:41 +00:00
|
|
|
|
|
|
|
`poetry update`
|
|
|
|
|
|
|
|
- Execute a command inside the project's virtual environment:
|
|
|
|
|
|
|
|
`poetry run {{command}}`
|
2022-10-17 16:44:48 +01:00
|
|
|
|
2024-02-27 14:34:55 +00:00
|
|
|
- Bump the version of the project in `pyproject.toml`:
|
2022-10-17 16:44:48 +01:00
|
|
|
|
2024-02-27 14:34:55 +00:00
|
|
|
`poetry version {{patch|minor|major|prepatch|preminor|premajor|prerelease}}`
|
|
|
|
|
|
|
|
- Spawn a shell within the project's virtual environment:
|
|
|
|
|
|
|
|
`poetry shell`
|