Skip to main content

A minimal, strictly structured Python project template.

Project description

Python Project Template

After creating a new git repository copy over:
* docs
* poetry_template
* tests
* pyproject.toml
* README.md

Go through the project and change the placeholder values. pyproject.toml contains the list of the most important values present throughout the project.

Finally, delete this note.
# Note: Install Python 3
# Update pip and install virtualenv (dependency encapsulator) and black (linter; IDE needs to be restarted)

# Note: install Poetry for Linux
$: curl -sSL https://install.python-poetry.org | python3 -

# Note: install Poetry for Windows
$: (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

$: curl -sSL https://install.python-poetry.org | python3 - --uninstall
# Note: `.toml` project name and package have to match (poetry-template; poetry_template)
$: poetry install  # install all dependencies

dist

$: pip install dist/poetry_template-0.1.4-py3-none.any.whl

$: poetry-template

docs

$: poetry shell
$: cd docs
# Note: review source/conf.py and source/index.rst
$: make html
# Note: see docs in docs/build/apidocs/index.html

poetry_template

$: poetry run poetry-template --help
$: poetry run python ./poetry_template/runner.py --help

$: poetry run python ./poetry_template/runner.py -x 2 -y -1 -tuple A B C -list D -list E -list F -move rock

tests

$: poetry run pytest --durations=0
$: poetry run pytest --cov=poetry_template --cov-report=html tests
# Note: see coverage report in htmlcov/index.html
# Note: exclude directories from coverage report through .coveragerc

poetry.lock

Dependencies, Python version and the virtual environment are managed by Poetry.

$: poetry search Package-Name
$: poetry add [-D] Package-Name[==Package-Version]

pyproject.toml

Define project entry point and metadata.

Linters

$: poetry run black .

MyPy

$: poetry run mypy ./poetry_template ./tests

cProfile

$: poetry run python ./poetry_template/profiler.py

Build and publish

$: poetry build

# Note: get the token from your PiPy account
$: poetry config pypi-token.pypi PyPI-Api-Access-Token
$: poetry publish --build
https://pypi.org/project/poetry-template/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry-template-0.1.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

poetry_template-0.1.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file poetry-template-0.1.4.tar.gz.

File metadata

  • Download URL: poetry-template-0.1.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.8 Windows/10

File hashes

Hashes for poetry-template-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a43d61bd13fe85a7d190b42852985a48eae94e5ffb7dfd54f241ba3526f9b23d
MD5 bb3be1de349301f471180020b48b0908
BLAKE2b-256 117e0ed69d34e1f8d84ae3ea948aa868d294f0d92ca928ad5e9d3dcda07f5a0d

See more details on using hashes here.

File details

Details for the file poetry_template-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_template-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 130a718efe8cc02d421086d4c18df45f241625ae4bb733f68aa378548f904a4a
MD5 1a1aa0cc894ebe3eed6c31f69d615177
BLAKE2b-256 5170c284e6ca95006eedd11bcf92638d716f2d3c8219c719ab114d296f681f53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page