Working with dependencies in Python¶
pip¶
Creating requirements.txt¶
-
Install dependencies and save them to a lock file:
pipenv¶
Creating Pipfile.lock¶
-
Install pipenv:
-
Create
Pipfile.lock:
poetry¶
Creating poetry.lock¶
If poetry.lock does not already exist, Poetry will create it automatically when installing dependencies. If the file already exists, it will be updated. To do this, run the command:
```bash
poetry lock
```
This command will update the dependencies specified in pyproject.toml and create or update the poetry.lock file.
pipdeptree¶
Creating the pipdeptree.txt file¶
When a pipdeptree.txt file is detected, the agent will analyze its contents as the output of the pipdeptree utility in the standard dependency tree format.
To create the file, you can use the following commands:
To filter the output by specific packages:
uv¶
Creating uv.lock¶
If uv.lock does not already exist, uv will create it automatically when installing dependencies. If the file already exists, it will be updated. To do this, run the command:
```bash
uv lock
```
This command will update the dependencies specified in pyproject.toml and create or update the uv.lock file.
UV workspaces mechanism Support¶
The UV workspaces mechanism allows centralized management of multiple packages.
In pyproject.toml, the following entry can be specified in the workspaces section:
In this case, the Johnny agent will process the root pyproject.toml and all pyproject.toml files of all packages from the workspace as a single entity.