Skip to content

Commit 628d8fc

Browse files
committed
Merge branch 'main' into main-github
2 parents 6e4b9a7 + 4a22b72 commit 628d8fc

34 files changed

+386
-132
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[bumpversion]
2-
current_version = 0.0.0
2+
current_version = 0.0.2
33
message = bump v{current_version} -> v{new_version}
4-
commit = True
5-
tag = True
6-
7-
[bumpversion:file:pyproject.toml]
84

95
[bumpversion:file:.bumpversion.cfg]
6+
7+
[bumpversion:file:src/init_python_project/cli.py]

.github/workflows/docs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
- uses: actions/configure-pages@v3
2525
- run: sudo apt-get update && sudo apt-get install tree
2626
- run: | # replace symlinks with actual files
27-
rm -r src/init_python_project/template src/init_python_project/copier.yaml
2827
cp -r template src/init_python_project/.
2928
cp copier.yaml src/init_python_project/.
3029
- run: | # creating example projects using copier requires a git identity

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ __pycache__
1010
build
1111
.obsidian
1212
docs/examples
13+
src/init_python_project/template
14+
src/init_python_project/copier.yaml

.pre-commit-config.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ repos:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-added-large-files
10+
- repo: https://github.com/pre-commit/mirrors-prettier
11+
rev: v3.0.3
12+
hooks:
13+
- id: prettier
14+
types_or: [json, yaml, css, javascript]
15+
# black should have the final say on python formatting, so it comes last
16+
- repo: https://github.com/psf/black
17+
rev: 23.9.1
18+
hooks:
19+
- id: black
20+
name: format code (black)
1021
- repo: local
1122
hooks:
1223
- id: pytest
@@ -17,7 +28,7 @@ repos:
1728
files: "^template/"
1829
stages: [push]
1930
- repo: https://github.com/streetsidesoftware/cspell-cli
20-
rev: v7.0.0
31+
rev: v7.3.0
2132
hooks:
2233
- id: cspell
2334
name: check spelling (cspell)

.prettierrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [unreleased]
9+
10+
## [0.0.2]
11+
12+
### Added
13+
14+
- `init-python-project --version` outputs template version
15+
816
## [0.0.1]
917

1018
Started this template by forking [pypa/sampleproject] and converting it to a copier template.
@@ -45,9 +53,8 @@ An example project (comparable to [pypa/sampleproject]) can be found at [jannism
4553

4654
- trove classifiers (only relevant when publishing to PyPI)
4755

48-
<!-- [unreleased]: https://github.com/jannismain/python-project-template/compare/v0.0.2...HEAD -->
49-
<!-- [0.0.2]: https://github.com/jannismain/python-project-template/compare/v0.0.1...v0.0.2 -->
50-
[0.0.1]: https://github.com/jannismain/python-project-template/releases/tag/v0.0.1
51-
56+
[unreleased]: https://github.com/jannismain/python-project-template/compare/v0.0.2...HEAD
57+
[0.0.2]: https://github.com/jannismain/python-project-template/compare/0.0.1...0.0.2
58+
[0.0.1]: https://github.com/jannismain/python-project-template/releases/tag/0.0.1
5259
[pypa/sampleproject]: https://github.com/pypa/sampleproject
5360
[jannismain/python-project-template-example]: https://github.com/jannismain/python-project-template-example

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
prune template
2+
prune */__pycache__
3+
exclude copier.yaml

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,19 @@ PKGNAME=init_python_project
111111
PKGDIR=src/${PKGNAME}
112112
BUILDDIR?=build/dist
113113
PYTHON?=python
114-
build: ## build package
114+
TEMPLATE_SRC?=./template
115+
TEMPLATE_DEST?=${PKGDIR}/template
116+
build: build-clean copy-template ## build package
115117
@${PYTHON} -m pip install --upgrade build
116118
@${PYTHON} -m build --outdir ${BUILDDIR} .
117119
install-build: build
118120
@pip uninstall -y ${PKGNAME}
119121
pip install --force-reinstall ${BUILDDIR}/*.whl
122+
copy-template:
123+
@cp -r ${TEMPLATE_SRC} ${TEMPLATE_DEST}
124+
@cp copier.yaml ${PKGDIR}/.
125+
build-clean: ## remove build artifacts
126+
rm -rf ${BUILDDIR} ${PKGDIR}/template ${PKGDIR}/copier.yaml
120127

121128

122129
.PHONY: help

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,68 @@
1-
# Python Project Template
1+
<div align=center>
2+
<h1>Python Project Template</h1>
3+
4+
[![](https://img.shields.io/badge/python-3.11-blue)][sample project]
5+
[![](https://img.shields.io/badge/Example-Sample_Project-blue)][sample project]
6+
[![PyPI - Version](https://img.shields.io/pypi/v/init-python-project)][pypi]
7+
8+
</div>
9+
10+
[pypi]: https://pypi.org/project/init-python-project/
11+
12+
<!-- start -->
213

314
A customizable template for new Python projects to get you up and running with current best practices faster.
415

516
## Features
617

7-
- Each project has a [README][] and [CHANGELOG][] file and includes further documentation based on [Material for MkDocs][] or [Sphinx][].
8-
- [Testing][kb_testing] and [continuous integration][ci] tooling are included from the very beginning
18+
- Each project has a *README* and *CHANGELOG* file and includes further documentation based on [Material for MkDocs][] or [Sphinx][].
19+
- *Testing* and *continuous integration* tooling are included from the very beginning
920
- Test coverage is collected and displayed as a badge
1021
- Coverage report is integrated with [Gitlab's coverage report artifact][gitlab coverage report]
1122
- Projects use [pre-commit][] for sanity checks on each commit or push
1223
- Projects use bumpversion to increase their version according to [semantic versioning guidelines][semver]
1324
- Python projects are installable by default and provide a simple command-line interface
1425

15-
[readme]: https://intern.iis.fhg.de/x/I5DPFQ
16-
[changelog]: https://intern.iis.fhg.de/display/DOCS/Changelog
1726
[material for mkdocs]: https://squidfunk.github.io/mkdocs-material
1827
[sphinx]: https://www.sphinx-doc.org
19-
[ci]: https://intern.iis.fhg.de/x/DK6qG
20-
[kb_testing]: https://intern.iis.fhg.de/x/DS9SFw
2128
[gitlab coverage report]: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report
2229
[pre-commit]: https://pre-commit.com/
2330
[semver]: https://semver.org/
2431

2532
Everything comes pre-configured with sensible defaults so you can focus on your implementation and let the template handle the rest.
2633

27-
See this [sample project][] to see how projects generated from this template using default values look like.
34+
See the [sample project][] to see how projects generated from this template using default values look like.
2835

2936
[sample project]: https://github.com/jannismain/python-project-template-example
3037

3138
## Getting Started
3239

3340
### Prerequisites
3441

35-
* [copier][]
42+
* Python3.11 or newer
3643

37-
*Note: If you have [pipx][] installed (you should, it is good), you can simply use `pipx run copier` out of the box.*
44+
### Installation
45+
46+
```sh
47+
pip install init-python-project
48+
```
49+
50+
*Note: If you have [pipx][] installed (you should, it is good), you can skip this step and instead run it directly using `pipx run init-python-project`*
3851

39-
[copier]: https://github.com/copier-org/copier
4052
[pipx]: https://pypa.github.io/pipx/
4153

4254
### Usage
4355

4456
```console
45-
copier copy --trust gh:jannismain/python-project-template my_new_project
57+
init-python-project <name of project>
4658
```
4759

48-
*Note: `--trust` is required because the template uses [tasks][] to setup your git repository for you.*
49-
50-
[tasks]: https://github.com/jannismain/python-project-template/blob/main/copier.yaml
51-
5260
<!-- usage-end -->
5361

5462
## User Guide
5563

56-
The first part of the [user guide][] consists of tutorials on how to answer the template questions for [Your First Project][], what [Next Steps][] there are after your project is created and why the [Project Structure][] looks like it does.
64+
The first part of the user guide consists of tutorials on how to answer the template questions for [Your First Project][], what [Next Steps][] there are after your project is created and why the [Project Structure][] looks like it does.
5765

58-
[user guide]: https://jannismain.github.io/python-project-template/user-guide/getting-started/
5966
[your first project]: https://jannismain.github.io/python-project-template/user-guide/first-project
6067
[next steps]: https://jannismain.github.io/python-project-template/user-guide/first-project
6168
[project structure]: https://jannismain.github.io/python-project-template/user-guide/project-structure

docs/assets/custom.css

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/* center mermaid graphs */
22
.mermaid {
3-
text-align: center;
3+
text-align: center;
44
}
55

66
/* convert emphasized text under images to caption */
7-
img+em {
8-
display: block;
7+
img + em {
8+
display: block;
99
}
1010

1111
.md-typeset .caption,
1212
.md-typeset figcaption {
13-
/* same as material's figcaption */
14-
font-style: italic;
15-
max-width: 24rem;
16-
margin: 1em auto 1.5em;
17-
text-align: center;
18-
display: block;
19-
font-size: 0.8rem;
20-
/* custom */
21-
line-height: 1.2;
13+
/* same as material's figcaption */
14+
font-style: italic;
15+
max-width: 24rem;
16+
margin: 1em auto 1.5em;
17+
text-align: center;
18+
display: block;
19+
font-size: 0.8rem;
20+
/* custom */
21+
line-height: 1.2;
2222
}

0 commit comments

Comments
 (0)