A python project to play around with modern software development concepts in python
The python package is not currently hosted on PyPI. To install it, clone the repository into a local directory and run
pip install -e <local_repository_root_dir>
poetry, nox, and pre-commit are used for dependency management, test automation and code quality checks.
- Install pyenv to manage python versions according to documentation. (Not available on Windows, but there might be acceptable alternatives). E.g., with homebrew
Follow instructions given during/after install. See documentation for usage.
brew update brew install pyenv
- Install pipx (to install and run python applications in isolated environments):
pip install pipx
- Install poetry to manage project
pipx install poetry
- suggested poetry settings:
poetry config virtualenvs.in-project true
- On
poetry install
, create virtual environment in current directory (instead of poetry's cache directory)
- On
poetry env use <python-version>
- Tell poetry to use the desired python version, e.g.
3.11
. If required version in pyproject.toml is higher than currently used version, poetry will complain
- Tell poetry to use the desired python version, e.g.
- suggested poetry settings:
- Install nox to perform automated development tasks
pipx install nox
- Install pre-commit to perform automated checks before each commit
pipx install pre-commit
- Use poetry to install project in an isolated virtual env
From repository root
poetry install
nox is used for running a variety of development tasks (nox "sessions") through a
python script called noxfile.py
.
List available sessions using nox --list
. Run a session using nox -s <session_name>
.
Per default, nox installs any dependencies for the session into a fresh virtual environment. To save time, pass the
-r
flag to nox to reuse the last virtual env for that session.
Sessions:
- tests => run tests using pytest, report test coverage using coverage.py
- lint => code linting using ruff, reformatting using black, docstring checks with darglint
- type_checking => static type checking using mypy
- docs => build documentation from docstrings using sphinx
- safety => check dependencies for known vulnerabilities using safety
When enabled, pre-commit hooks are checks that run whenever trying to commit to the repository. The checks make sure certain standards and formats are upheld for the code. The checks that run are defined in the .pre-commit-config.yaml.
To enable pre-commit hooks, run (from the repository root):
pre-commit install
In many cases, if the check fails, the files will be automatically reformatted to conform to the check.
The checkers module contains a command line interface for playing the game of checkers. After installation with pip (or pipx),
the cli should be available und the command checkers
.
To run within the development environment: after poetry install
, use poetry run checkers
to see cli documentation and poetry run checkers <command>
to run
checkers commands.