Project Maintenance with Poetry - openeduhub/oeh-search-etl GitHub Wiki
Project Maintenance with Poetry
One of the main features of poetry is that it makes dependency-management really convenient.
Poetry works on the basis of the pyproject.toml file of this project, resolves the listed dependencies and creates a poetry.lock file (to guarantee that all people working on the project use the same dependency versions).
Bookmarks
- Poetry (Official Website)
- Poetry Documentation
- Poetry Installation
- Basic Usage
- Managing Dependencies (and dependency groups)
- (CLI) Commands
- Poetry Blog: Announcements of new releases
- Poetry Documentation
Optional, but recommended:
- pipx: install and run Python applications in isolated environments
- pyenv: simple Python version management
- (use this tool to switch between different Python versions without accidentally overwriting your system's global python version)
Recommended Installation Settings
Please make sure that you followed the Poetry Installation Guide first and that your Poetry is up to date.
Typing poetry --version into your console / terminal should produce a similar output:
$ poetry --version
Poetry (version 1.8.3)
If you are using pyCharm and want to have an easier experience while handling virtual environments (.venv/),
you might want to set up poetry to create virtualenvs within the project's root directory.
(oeh-search-etl is set up to .gitignore any .venv directories.)
Cheat Sheet: Frequently Used poetry Commands
After making sure that you have installed Poetry, you can use the following commands within your terminal to save some time in the future:
poetry check: checks if thepyproject.toml-structure is still validpoetry install:- reads the
pyproject.toml-file - installs dependencies
- and updates the
poetry.lock-file
- reads the
poetry show --tree: displays the dependencies in a tree-viewpoetry show --outdated: shows outdated dependencies- you can adjust the
pyproject.tomlfile manually to version-pin specific dependencies - or use the
poetry addcommand with a version constraint,- e.g.
poetry add playwright==1.46.0version-pins theplaywright-package to v1.46.0
- e.g.
- now update the dependencies according to your
pyproject.tomlspecifications:- to update all dependencies, use
poetry update - or update individual packages only by using
poetry update <package_name> - (reminder:
poetry updaterespects the version constraints of yourpyproject.tomland will not update a version-pinned package above your defined version constraints!)- If you want to update a package to a higher version than specified in your
pyproject.tomlfile, use the above-mentionedpoetry addcommand!
- If you want to update a package to a higher version than specified in your
- to update all dependencies, use
- you can adjust the
- optional: save the
requirements_dependencies_tree.txt-file for an (easier) visual overviewpoetry show --tree > requirements_dependencies_tree.txt