Skip to content

Create, build and publish PyPi compatible Python 3 packages with ease.

Notifications You must be signed in to change notification settings

vikpe/python-package-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Package Starter

test codecov Code style: black

Features

  • Multi python version support (pyenv, tox)
  • Single config using the new standardized pyproject.toml (PEP518)
  • Simple build/publish/dependency management using poetry
  • Continous integration (GitHub Actions)
  • Code coverage reporting (Codecov)
  • Code formatting (black)

Prerequisites

Installation

  1. Install pyenv and pyenv-virtualenv.
  2. Install the Python versions you want to support using pyenv.
pyenv install 3.6.9
pyenv install 3.8.0
  1. Clone repo: git clone git@github.com:vikpe/python-package-starter.git [PACKAGE_NAME]
  2. cd [PACKAGE NAME]
  3. Create a virtual env: pyenv virtualenv 3.8.0 foo38
  4. Activate virtual env: pyenv activate foo38
  5. Install poetry: pip install poetry
  6. Install dependencies: poetry install
  7. Edit pyproject.toml, update project name, description and author and any other settings you like.

Usage

Command Description
poetry add [package] Add package to dependencies.
poetry add -D [package] Add package to dev dependencies.
poetry run pytest Run tests in local Python version.
poetry run ptw tests foo --clear Watch for file changes and run tests in local Python version.
poetry run tox Run tests in all Python versions defined in tox.ini.
poetry run black . Run black code formatter.
poetry build Build sdist and wheel to /dist.
poetry publish Publish package to PyPi.

Continous integration

GitHub Actions

Tests are run whenever there is a commit, see .github/workflows/test.yml for details.

Code coverage

Enable code coverage reporting to Codecov by creating a secret with name CODECOV_TOKEN in your repository settings (Settings -> Secrets -> New sectret) and value set to the token created by Codecov.

About

Create, build and publish PyPi compatible Python 3 packages with ease.

Topics

Resources

Stars

Watchers

Forks

Languages