Skip to content

A blueprint for python projects using best practices

sichgeis/blueprint-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Sample Project

This is a blueprint for a basic python project using the Pipenv development workflow tool. It is intended for projects and apps that you (or your company) run directly. Pipenvs deterministic locking system in the form of pipfile.lock helps with this [1] .

Project dependencies

With the Pipenv installation the following development dependencies are defined:

  • pytest: The defacto standard for testing in Python
  • pytest-cov: Additional test coverage reports
  • mypy: Optional static type checker for Python
  • flake8: Tool for style guide enforcement
  • pep8-naming: Checks code against PEP 8 naming conventions
  • flake8-import-order: Check import order style
  • flake8-quotes: Check quotes -- this project uses "
  • black: Code formatter

The runtime dependencies are:

  • exitstatus: Provides expressive, portable definitions for the standard POSIX exit codes

Usage

Checkout the repository. To install the development dependencies, run:

pipenv install --dev

To install the dependencies for running the sample program, run:

pipenv install

To run the unit tests of the project with coverage report, run:

pipenv run test

To run the black code formatter, run:

pipenv run black

To check the PEP8 style guidelines, run:

pipenv run flake8

To check the optional static types with mypy run:

pipenv run mypy

Credits

The sample code for the factorial implementation is attributed to johnthagen.

Footnotes

[1]If you want to provide you code to others to install it, then you should define dependencies as ranges of compatible versions, instead of locked versions. Currently the tools for distribution like Setuptools, Flit or Poetry do not integrate well with Pipenv.

About

A blueprint for python projects using best practices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages