1- Python Project Template
2- =======================
1+ Simple Python Project
2+ =====================
3+
4+ Python project using simple setuptools project config; note package
5+ data, scripts, entry points, etc, **all still work ** using pyproject.toml
6+ per `setuptools documentation `_.
7+
8+ |ci | |wheels | |bandit | |release |
9+
10+ |pre | |cov | |pylint |
11+
12+ |tag | |license | |reuse | |python |
13+
14+ To use this template, replace the example project name with your own:
15+
16+ * change the project name at the top of ``pyproject.toml ``
17+ * change the package directory name under the ``src `` folder
18+ * change the github URL paths in ``pyproject.toml ``
19+ * change the project name in ``docs/source/conf.py ``
20+
21+
22+ .. _setuptools documentation : https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
23+
24+ Github workflows and setuptools_scm
25+ -----------------------------------
26+
27+ This project uses setuptools_scm _ for dynamic versioning, therefor some
28+ of the (github) workflows will look for a git tag to set the version in
29+ CI. If there are no tags, this will result in some failed workflow runs.
30+ There are several options to make them succeed:
31+
32+ * create a base tag, eg ``git tag -a 0.0.0 ``
33+ * set SETUPTOOLS_SCM_PRETEND_VERSION to the above value in the workflow env
34+ * disable failing workflows in the Github Actions tab
35+ * delete any workflows you don't need
36+
37+
38+ Github workflows and repo settings
39+ ----------------------------------
40+
41+ Some of the automation workflows may also fail without some non-default
42+ repository settings; the following changes are required to allow these
43+ workflows to run.
44+
45+ Go to the repository Settings tab and scroll to the bottom of the General
46+ settings and enable these checkboxes under Pull Requests:
47+
48+ * Always suggest updating pull request branches (optional)
49+ * Allow auto-merge (required)
50+ * Automatically delete head branches (optional)
51+
52+ Next, in the left-hand menu under the Settings tab, click Actions, then General,
53+ then scroll to Workflow permissions:
54+
55+ * make sure *Read repository contents and packages permissions * is selected
56+ * enable the *Allow GitHub Actions to create and approve pull requests * checkbox,
57+ then click Save
58+
59+ In addition, the provided dependabot config expects some issue labels, so open the
60+ project URL below (using your new project name) and add the following new labels:
361
62+ **https://github.com/<your_name>/<project_name>/issues/labels **
63+
64+ * actions
65+ * dependencies
66+ * packaging
67+
68+
69+ Github best practices
70+ ---------------------
71+
72+ Finally, best practices for public repositories includes following extra
73+ features:
74+
75+ * under Advanced Security enable Code Scanning, Dependabot, Private
76+ Vulnerability Reporting, and (default) Codeql config
77+ * under Rules => Rulesets add some branch protection rules with required
78+ status checks
479
580
681Make a ``badges `` branch
@@ -16,7 +91,6 @@ checkout, run the following commands::
1691 $ git checkout main
1792
1893
19-
2094Dev tools
2195=========
2296
@@ -142,3 +216,53 @@ specifications.
142216.. _sbom4python : https://github.com/anthonyharrison/sbom4python
143217.. _gitchangelog : https://github.com/sarnold/gitchangelog
144218.. _pre-commit : http://pre-commit.com/
219+ .. _setuptools_scm : https://setuptools-scm.readthedocs.io/en/stable/
220+
221+
222+ .. |ci | image :: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/ci.yml/badge.svg
223+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/ci.yml
224+ :alt: CI Status
225+
226+ .. |wheels | image :: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/wheels.yml/badge.svg
227+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/wheels.yml
228+ :alt: Wheel Status
229+
230+ .. |badge | image :: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/pylint.yml/badge.svg
231+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/pylint.yml
232+ :alt: Pylint Status
233+
234+ .. |release | image :: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/release.yml/badge.svg
235+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/release.yml
236+ :alt: Release Status
237+
238+ .. |bandit | image :: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/bandit.yml/badge.svg
239+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/bandit.yml
240+ :alt: Security check - Bandit
241+
242+ .. |cov | image :: https://raw.githubusercontent.com/sarnold/doorstop-to-mermaid/badges/main/test-coverage.svg
243+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/coverage.yml
244+ :alt: Test coverage
245+
246+ .. |pylint | image :: https://raw.githubusercontent.com/sarnold/doorstop-to-mermaid/badges/main/pylint-score.svg
247+ :target: https://github.com/sarnold/doorstop-to-mermaid/actions/workflows/pylint.yml
248+ :alt: Pylint Score
249+
250+ .. |license | image :: https://img.shields.io/badge/license-MIT-blue
251+ :target: https://github.com/sarnold/doorstop-to-mermaid/blob/main/LICENSE
252+ :alt: License
253+
254+ .. |tag | image :: https://img.shields.io/github/v/tag/sarnold/doorstop-to-mermaid?color=green&include_prereleases&label=latest%20release
255+ :target: https://github.com/sarnold/doorstop-to-mermaid/releases
256+ :alt: GitHub tag
257+
258+ .. |python | image :: https://img.shields.io/badge/python-3.9+-blue.svg
259+ :target: https://www.python.org/downloads/
260+ :alt: Python
261+
262+ .. |reuse | image :: https://api.reuse.software/badge/git.fsfe.org/reuse/api
263+ :target: https://api.reuse.software/info/git.fsfe.org/reuse/api
264+ :alt: REUSE status
265+
266+ .. |pre | image :: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
267+ :target: https://github.com/pre-commit/pre-commit
268+ :alt: pre-commit
0 commit comments