Poetry quick intro
Installation: Poetry Documentation
I’ve installed via pipx. If you don’t have pipx, there is also a link on how to install it on the page I provided earlier. Please don’t install pipx via apt, it’s outdated. Installation via pip works as a charm.
Create
poetryvenv and install the project:
poetry shell
poetry install
To open the app use:
markupit
And to run tests:
pytest
To format/check code with
ruffrun the following command:
ruff check
ruff format
More ruff commands here: Ruff Documentation
If you want to add a new dependency, you can run the following command:
poetry add <package_name>
Keep in mind that some packages might be installed as dev dependencies, so you might want to add --group dev flag ( --group test for test dependencies).
There are pre-commit hooks. They check for code formatting and linting. If you want to run them manually, you can run the following command:
pre-commit run --all-files
Also, if you want these hooks to run automatically before commit, you can install them with the following command:
pre-commit install
Note: installing this hook will not let you commit if there are any issues with formatting or linting that can’t be fixed automatically. Therefore, installing it is highly recommended.
Testing:
Run the following command if you want to test code with your active Python version:
poetry run pytest
Using tox you can test code with multiple Python versions:
poetry run tox
Currently supported versions: 3.10, 3.11, 3.12. Note: you will need to have these Python versions installed on your system.
After tox testing, you can also view code coverage by tests.
That’s it for now! ᕦ(ò_óˇ)ᕤ