A python poetry project demo for calculating PI.
-
Git
-
Docker
-
Python >= 3.11 (prefer using asdf or pyenv to system python)
-
Poetry (prefer asdf-poetry plugin or installing with pipx)
> curl -sSL https://install.python-poetry.org | python3 -
-
poetry-bumpversion plugin
> poetry self add poetry-bumpversion
> git clone [email protected]:eriksf/calculate-pi.git
> cd calculate-pi
> poetry install
> calculate-pi --help
Usage: calculate-pi [OPTIONS] NUMBER
Calculate pi using a Monte Carlo estimation.
NUMBER is the number of random points.
Options:
--version Show the version and exit.
--log-level [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL]
Set the log level [default: 20]
--log-file PATH Set the log file
--help Show this message and exit.
To update the version, use the poetry version <major|minor|patch>
command (aided by the poetry-bumpversion plugin):
> poetry version patch
Bumping version from 0.3.0 to 0.3.1
poetry_bumpversion: processed file calculate_pi/version.py
This will update the version in both the pyproject.toml
and the calculate_pi/version.py
files. If you want to test the version bump before updating files, you can use the --dry-run
option:
> poetry version patch --dry-run
Bumping version from 0.3.0 to 0.3.1
poetry_bumpversion: processed file calculate_pi/version.py
After updating the version and committing the changes back to the repo, you should tag
the repo to match this version:
> git tag -a 0.3.1 -m "Version 0.3.1"
> git push origin 0.3.1