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
* setup.cfg

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://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

# Note: install Poetry for Windows
$: (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
# Note: do NOT update Poetry, it will break itself

$: python get-poetry.py --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.3-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 python ./poetry_template/runner.py

tests

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

poetry.lock

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

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

pyproject.toml

Define project entry point and metadata.

setup.cfg

Configure Python libraries.

Linters

$: poetry run black .

cProfile

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

Build and publish

$: poetry build

$: poetry config pypi-token.pypi PyPI-Api-Access-Token  # get the token from PiPy

$: 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.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

poetry_template-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for poetry-template-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f77987805a23ae27ae40c657a00ab7bd58926af0702732e5e9331817536530e2
MD5 afa734d7518014f64d61c7eca2042e00
BLAKE2b-256 093195309dc6dd67e92cb4c41df0853296cce2679fac9d4fd4e8412b0abe70f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for poetry_template-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bdd1b682276e191e66aa5825977da239d874269e1a899b0c6c4ab6739bdffb45
MD5 5017ca167eba073e3ecea1ec449e0385
BLAKE2b-256 1dbf0be6d1d675892222debf34a83682a8156c11602d5b471f6e44ae4d652962

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