An open API service indexing awesome lists of open source software.

https://github.com/karlicoss/pymplate

My Python project template
https://github.com/karlicoss/pymplate

boilerplate ci github-actions mypy pylint template tox

Last synced: 9 months ago
JSON representation

My Python project template

Awesome Lists containing this project

README

          

My (somewhat opinionated) Python project template

- minimal configuration in [[file:setup.py]], only setting the required fields

No one cares about PyPi keywords, descriptions etc.

- there is also an example =pyproject.toml= configuration in [[file:misc/pyproject.toml]]

- uses =pytest= and =mypy= (+coverage) for checks
- uses =ruff= with some ignore directives to prevent it from being too annoying about the code style
- relies on [[file:tox.ini][tox]] for running tests and checks in isolation
- uses Github Actions for CI

- make sure you can run CI against pull requests from other people (=pull_request= trigger)
Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
- build matrix for multiple python versions
- trying to keep as little as possible in the CI configuration

Because [[https://beepb00p.xyz/configs-suck.html][fuck]] yaml configs and learning yet another templating syntax
- automatic PyPi deployments on new tags

* CI
- see [[file:.github/workflows/main.yml][the config]]
- running CI locally: use [[https://github.com/nektos/act][=act=]] (e.g. try with =act -l=)

* PyPi releases

#+begin_src python :results output drawer :exports results
import imp
m = imp.load_source('release', '.ci/release')
print(m.__doc__)
#+end_src

#+RESULTS:
:results:

Run [[file:scripts/release][scripts/release]] to deploy Python package onto [[https://pypi.org][PyPi]] and [[https://test.pypi.org][test PyPi]].

The script expects =TWINE_PASSWORD= environment variable to contain the [[https://pypi.org/help/#apitoken][PyPi token]] (not the password!).

The script can be run manually.
It's also running as =pypi= job in [[file:.github/workflows/main.yml][Github Actions config]]. Packages are deployed on:
- every master commit, onto test pypi
- every new tag, onto production pypi

You'll need to set =TWINE_PASSWORD= and =TWINE_PASSWORD_TEST= in [[https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets][secrets]]
for Github Actions deployment to work.

:end:

# TODO maybe generate github actions config and have a literal readme?