Python Package Template#
A template repository for creating Python packages.
Features#
Common repository files:
.gitignore
with common files to be excluded by git for Python.pre-commit-config.yaml
with automated pre-commit validation for PythonLICENSE
outlining usage rightsMakefile
standardising commandsCODE_OF_CONDUCT.md
outlining community practiceOWNERS.md
outlining owners and rolesREADME.md
overview documentation
Tool configuration:
editorconfig - universal editor configuration
ruff - linting
perflint - linting performance anti-patterns
mypy - type checking
bandit - vulnerability detection
black - code style formatting
blacken-docs - code style formatting in docs
pyupgrade - latest syntax upgrades
radon - code quality
removestar - automated removal of wildcard imports (*)
pytest - testing
coverage - test coverage
sphinx - documentation
GitHub Pages - documentation deployment and hosting
build - packaging
twine - deployment
Examples:
Repository tree structure
Python module
Unit tests
Installation#
pysamplelib
is available via Test PyPI (via Platform Wheels):
pip install --index-url https://test.pypi.org/simple/ pysamplelib
Examples#
Running fizzbuzz against a number:
import pysamplelib
print(pysamplelib.fizzbuzz(5))
Running fizzbuzz against a number range:
import pysamplelib
for number in range(1, 101):
print(pysamplelib.fizzbuzz(number))
Running fizzbuzz against a number, using a custom keyword mapping:
import pysamplelib
CUSTOM_KEYWORD_MAPPING = {
7: "Riff",
9: "Blip",
}
print(pysamplelib.fizzbuzz(7, CUSTOM_KEYWORD_MAPPING))
License#
pysamplelib
is licensed under the MIT License