Coder Social home page Coder Social logo

python-template's Introduction

Python Project Template

This is a quickstart project template for Python that already comes attached with the following features:

  • Packaging and metadata support
  • Formatting and linting via pre-commit, black, usort, and flake8
  • Testing via pytest
  • CI via github-actions

Configuration

To tailor this template to your needs, the following steps must be taken:

  1. Rename the myproject package folder to your project name
  2. Change metadata and project name in setup.cfg.
  3. Do not forget to change the version attribute to point to your new package name as well.
  4. Add dependencies to requirements.txt
  5. Adjust the LICENSE file to your liking.
  6. Adjust this README.md file to your liking.

Formatting and linting

Install pre-commit and pytest via

pip install -r ci_requirements.txt

To format and lint the entire codebase run:

pre-commit run --all-files

To perform this step automatically during each commit (and fail on errors) run:

pre-commit install

Testing

To run the tests execute:

pytest

in the top-level directory. Tests can also be executed individually by running them as regular python script. This requires you to add a small main function to them, c.f. test/test_myproject.py.

Github Actions

This project defines the following workflows:

  1. run_linting.yml will run pre-commit run --all-files on every push to develop and pull request
  2. run_tests.yml will run pytest on Windows, Ubuntu, and MacOS on every push to develop and pull_request
  3. release_public.yml and release_test.yml can be triggered manually to build a wheel distribution and publish it to PyPI or TestPyPI respectively

For the publising to work, you need to add the PyPI API token as Github secrets:

  • PYPI_TOKEN for the official PyPI index
  • TEST_PYPI_TOKEN for the TestPyPI index

python-template's People

Contributors

sehoffmann avatar

Watchers

 avatar

Forkers

hypnootika

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.