Install the dependency manager (if not already done):
pip3 install poetry
Install all dependencies and pre-commit hooks:
poetry install
pre-commit install
and you should be ready to go!
❯ poetry run python src/main.py
Hi, You
You can either run:
❯ poetry run pytest
================================================ test session starts ================================================
platform darwin -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/joao.soares/joaogcs/python-project-template
collected 1 items
src/tests/test_main.py ....... [100%]
================================================ 1 passed in 0.02s =================================================
or test it against some violation files we have in place:
❯ poetry run tryceratops src/tests/samples/violations/call_too_many_try.py
[TC101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:15:4
[TC101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:27:4
[TC101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:32:4
Done processing! 🦖✨
Processed 1 files
Found 3 violations
You can try it with flake8 if preferred:
❯ poetry run flake8 --select TC src/tests/samples/violations/call_too_many_try.py
src/tests/samples/violations/call_too_many_try.py:15:5: TC101 Too many try blocks in your function
src/tests/samples/violations/call_too_many_try.py:27:5: TC101 Too many try blocks in your function
src/tests/samples/violations/call_too_many_try.py:32:5: TC101 Too many try blocks in your function
If you installed pre-commit
it should ensure you're not committing anything broken.
You can run ./bin/lint
to fix some issues for you.
We automate the versioning and release process! It's only possible if we are consistent with the commit pattern and follow the conventional commits standards.
Refer to Conventional Commits here and if you're curious to understand how the publishing works check here.