Skip to content

Commit e69e16f

Browse files
chore(deps): update from template
1 parent 4e6c747 commit e69e16f

7 files changed

Lines changed: 394 additions & 274 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: v0.6.21
1+
_commit: v0.6.26
22
_src_path: gh:helmut-hoffer-von-ankershoffen/oe-python-template
33
author_email: helmuthva@gmail.com
44
author_github_username: helmut-hoffer-von-ankershoffen

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Checkout repository
6060
uses: actions/checkout@v4
6161

62-
# Add any setup steps before running the `github/codeql-action/init` action.
62+
# Add any setup steps before running the `github/codeql-action/init` action.
6363
# This includes steps like installing compilers or runtimes (`actions/setup-node`
6464
# or others). This is typically only required for manual builds.
6565
# - name: Setup runtime (example)

CODE_STYLE.md

Lines changed: 122 additions & 122 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ examples/ # Example code demonstrating use of the project
5555
Don't forget to configure your `.env` file with the required environment variables.
5656

5757
Notes:
58-
* .env.example is provided as a template.
59-
* .env is excluded from version control, so feel free to add secret values.
58+
1. .env.example is provided as a template.
59+
2. .env is excluded from version control, so feel free to add secret values.
6060

6161
### update dependencies and create virtual environment
6262

@@ -117,9 +117,8 @@ uv run nox -s act
117117
```
118118

119119
Notes:
120-
121-
- Workflow defined in `.github/workflows/*.yml`
122-
- test-and-report.yml calls all build steps defined in noxfile.py
120+
1. Workflow defined in `.github/workflows/*.yml`
121+
2. test-and-report.yml calls all build steps defined in noxfile.py
123122

124123
### Docker
125124

@@ -147,10 +146,10 @@ uv run nox -s update_from_template
147146

148147
## Pull Request Guidelines
149148

150-
- Before starting to write code read the [code style guide](CODE_STYLE.md) document for mandatory coding style
151-
guidelines.
152-
- **Pre-Commit Hooks:** We use pre-commit hooks to ensure code quality. Please install the pre-commit hooks by running `uv run pre-commit install`. This ensure all tests, linting etc. pass locally before you can commit.
153-
- **Squash Commits:** Before submitting a pull request, please squash your commits into a single commit.
154-
- **Branch Naming:** Use descriptive branch names like `feature/your-feature` or `fix/issue-number`.
155-
- **Testing:** Ensure new features have appropriate test coverage.
156-
- **Documentation:** Update documentation to reflect any changes or new features.
149+
1. Before starting to write code read the [code style guide](CODE_STYLE.md) document for mandatory coding style
150+
guidelines.
151+
2. **Pre-Commit Hooks:** We use pre-commit hooks to ensure code quality. Please install the pre-commit hooks by running `uv run pre-commit install`. This ensure all tests, linting etc. pass locally before you can commit.
152+
3. **Squash Commits:** Before submitting a pull request, please squash your commits into a single commit.
153+
4. **Branch Naming:** Use descriptive branch names like `feature/your-feature` or `fix/issue-number`.
154+
5. **Testing:** Ensure new features have appropriate test coverage.
155+
6. **Documentation:** Update documentation to reflect any changes or new features.

README.md

Lines changed: 119 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -43,48 +43,126 @@
4343
---
4444

4545

46-
Example project scaffolded and kept up to date with OE Python Template
47-
(oe-python-template).
46+
Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
47+
48+
This [Copier](https://copier.readthedocs.io/en/stable/) template enables you to quickly generate a Python package with fully functioning build and test automation.
49+
Projects generated from this template can be [easily updated](https://copier.readthedocs.io/en/stable/updating/) to benefit from improvements and new features of the template.
50+
51+
Features:
52+
1. Package management with [uv](https://github.com/astral-sh/uv)
53+
2. Code formatting with [Ruff](https://github.com/astral-sh/ruff)
54+
3. Linting with [Ruff](https://github.com/astral-sh/ruff)
55+
4. Static type checking with [mypy](https://mypy.readthedocs.io/en/stable/)
56+
5. Complete set of [pre-commit](https://pre-commit.com/) hooks including [detect-secrets](https://github.com/Yelp/detect-secrets) and [pygrep](https://github.com/pre-commit/pygrep-hooks)
57+
6. Unit and E2E testing with [pytest](https://docs.pytest.org/en/stable/) including parallel test execution
58+
7. Matrix testing in multiple environments with [nox](https://nox.thea.codes/en/stable/)
59+
8. Test coverage reported with [Codecov](https://codecov.io/) and published as release artifact
60+
9. CI/CD pipeline automated with [GitHub Actions](https://github.com/features/actions)
61+
10. CI/CD pipeline can be run locally with [act](https://github.com/nektos/act)
62+
11. Code quality and security checks with [SonarQube](https://www.sonarsource.com/products/sonarcloud) and [GitHub CodeQL](https://codeql.github.com/)
63+
12. Dependency monitoring with [pip-audit](https://pypi.org/project/pip-audit/), [Renovate](https://github.com/renovatebot/renovate), and [GitHub Dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide)
64+
13. Licenses of dependencies extracted with [pip-licenses](https://pypi.org/project/pip-licenses/) and published as release artifacts in CSV and JSON format for compliance checks
65+
14. Software Bill of Materials (SBOM) generated with [cyclonedx-python](https://github.com/CycloneDX/cyclonedx-python) and published as release artifact
66+
15. Version and release management with [bump-my-version](https://callowayproject.github.io/bump-my-version/)
67+
16. Changelog and release notes generated with [git-cliff](https://git-cliff.org/)
68+
17. Documentation generated with [Sphinx](https://www.sphinx-doc.org/en/master/) including reference documentation and PDF export
69+
18. Documentation published to [Read The Docs](https://readthedocs.org/)
70+
19. Interactive OpenAPI specification with [Swagger](https://swagger.io/)
71+
20. Python package published to [PyPI](https://pypi.org/)
72+
21. Docker images published to [Docker.io](https://hub.docker.com/) and [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) with [artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)
73+
22. One-click development environments with [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) and [GitHub Codespaces](https://github.com/features/codespaces)
74+
23. Settings for use with [VSCode](https://code.visualstudio.com/)
75+
24. Settings and custom instructions for use with [GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
76+
77+
The generated project includes code, documentation and configuration of a fully functioning demo-application and service, which can be used as a starting point for your own project.
78+
1. Service architecture suitable for use as shared library
79+
2. Validation with [pydantic](https://docs.pydantic.dev/)
80+
3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
81+
4. Versioned Web API with [FastAPI](https://fastapi.tiangolo.com/)
82+
5. [Interactive Jupyter notebook](https://jupyter.org/) and [reactive Marimo notebook](https://marimo.io/)
83+
6. Simple Web UI with [Streamlit](https://streamlit.io/)
84+
7. Configuration to run the CLI and API in a Docker container including setup for [Docker Compose](https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-docker-compose/)
85+
8. Documentation including badges, setup instructions, contribution guide and security policy
86+
87+
Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example) for what's generated out of the box.
88+
89+
## Generate a new project
90+
91+
This template is designed to be used with the [copier](https://copier.readthedocs.io/en/stable/) project generator. It allows you to create a new project based on this template and customize it according to your needs.
92+
To generate a new project, follow these steps:
93+
94+
**Step 1**: Install uv package manager and copier. Copy the following code into your terminal and execute it.
95+
```shell
96+
if [[ "$OSTYPE" == "darwin"* ]]; then # Install dependencies for macOS X
97+
if ! command -v brew &> /dev/null; then ## Install Homebrew if not present
98+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
99+
fi
100+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then # Install dependencies for Linux
101+
sudo apt-get update -y && sudo apt-get install curl -y # Install curl
102+
fi
103+
if ! command -v uvx &> /dev/null; then # Install uv package manager if not present
104+
curl -LsSf https://astral.sh/uv/install.sh | sh
105+
source $HOME/.local/bin/env
106+
fi
107+
uv tool install copier # Install copier as global tool
108+
```
109+
110+
**Step 2**: [Create an empty repository on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository), clone to your local machine, and change into it's directory.
111+
112+
**Step 3**: Generate the project. Copy
113+
```shell
114+
copier copy --trust gh:helmut-hoffer-von-ankershoffen/oe-python-template .
115+
```
116+
117+
**Step 4**: Perform initial commit and push. Copy the following code into your terminal and execute it.
118+
```shell
119+
git add .
120+
git commit -m "feat: Initial commit"
121+
git push
122+
```
123+
124+
Visit your GitHub repository and check the Actions tab. The CI workflow should already be running! The workflow will fail at the SonarQube step, as this external service is not yet configured for our new repository.
48125

49-
Use Cases:
126+
**Step 5**: Follow the [instructions](SERVICE_CONNECTIONS.md) to wire up
127+
external services such as CloudCov, SonarQube Cloud, Read The Docs, Docker.io, and Streamlit Community Cloud.
50128

51-
1. Dummy CLI application and service demonstrating example usage of the
52-
directory structure and build pipeline generated by oe-python-template
129+
**Step 6**: Release the first versions
130+
```shell
131+
./n bump
132+
```
133+
Notes:
134+
1. You can remove this section post having successfully generated your project.
135+
2. The following sections refer to the dummy application and service provided by this template.
136+
Use them as inspiration and adapt them to your own project.
53137

54138
## Overview
55139

56-
Adding OE Python Template Example to your project as a dependency is easy.
140+
Adding OE Python Template Example to your project as a dependency is easy. See below for usage examples.
57141

58142
```shell
59143
uv add oe-python-template-example # add dependency to your project
60144
```
61145

62-
If you don't have uv installed follow
63-
[these instructions](https://docs.astral.sh/uv/getting-started/installation/).
64-
If you still prefer pip over the modern and fast package manager
65-
[uv](https://github.com/astral-sh/uv), you can install the library like this:
146+
If you don't have uv installed follow [these instructions](https://docs.astral.sh/uv/getting-started/installation/). If you still prefer pip over the modern and fast package manager [uv](https://github.com/astral-sh/uv), you can install the library like this:
147+
66148

67149
```shell
68150
pip install oe-python-template-example # add dependency to your project
69151
```
70152

71-
Executing the command line interface (CLI) in an isolated Python environment is
72-
just as easy:
153+
Executing the command line interface (CLI) in an isolated Python environment is just as easy:
73154

74155
```shell
75-
uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
76-
uvx oe-python-template-example serve # serves webservice API
77-
uvx oe-python-template-example serve --port=4711 # serves webservice API on port 4711
156+
uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
157+
uvx oe-python-template-example serve # serves web API
158+
uvx oe-python-template-example serve --port=4711 # serves web API on port 4711
78159
```
79160

80161
Notes:
162+
1. The API is versioned, mounted at `/api/v1` resp. `/api/v2`
163+
2. While serving the web API go to [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world) to see the respons of the `hello-world` operation.
164+
3. Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
81165

82-
- The API is versioned, mounted at `/api/v1` resp. `/api/v2`
83-
- While serving the webservice API go to
84-
[http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world)
85-
to see the respons of the `hello-world` operation.
86-
- Interactive documentation is provided at
87-
[http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
88166

89167
The CLI provides extensive help:
90168

@@ -96,48 +174,31 @@ uvx oe-python-template-example openapi --help
96174
uvx oe-python-template-example serve --help
97175
```
98176

177+
99178
## Operational Excellence
100179

101-
This project is designed with operational excellence in mind, using modern
102-
Python tooling and practices. It includes:
103-
104-
- Various examples demonstrating usage:
105-
- [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
106-
- [Streamlit web application](https://oe-python-template-example.streamlit.app/)
107-
deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
108-
- [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb)
109-
and
110-
[Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py)
111-
notebook
112-
- [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html)
113-
on Read the Docs
114-
- [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example)
115-
including unit and E2E tests (reported on Codecov)
116-
- Matrix tested with
117-
[multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py)
118-
to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
119-
- Compliant with modern linting and formatting standards (powered by
120-
[Ruff](https://github.com/astral-sh/ruff))
121-
- Up-to-date dependencies (monitored by
122-
[Renovate](https://github.com/renovatebot/renovate) and
123-
[GitHub Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
124-
- [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example)
125-
in security, maintainability, and reliability with low technical debt and
126-
codesmell (verified by SonarQube)
127-
- Additional code security checks using
128-
[GitHub CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
129-
- [Security Policy](SECURITY.md)
130-
- [License](LICENSE) compliant with the Open Source Initiative (OSI)
131-
- 1-liner for installation and execution of command line interface (CLI) via
132-
[uv(x)](https://github.com/astral-sh/uv) or
133-
[Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
134-
- Setup for developing inside a
135-
[devcontainer](https://code.visualstudio.com/docs/devcontainers/containers)
136-
included (supports VSCode and GitHub Codespaces)
180+
This project is designed with operational excellence in mind, using modern Python tooling and practices. It includes:
181+
182+
1. Various examples demonstrating usage:
183+
a. [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
184+
b. [Streamlit web application](https://oe-python-template-example.streamlit.app/) deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
185+
c. [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb) and [Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py) notebook
186+
2. [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html) on Read the Docs
187+
3. [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example) including unit and E2E tests (reported on Codecov)
188+
4. Matrix tested with [multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py) to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
189+
5. Compliant with modern linting and formatting standards (powered by [Ruff](https://github.com/astral-sh/ruff))
190+
6. Up-to-date dependencies (monitored by [Renovate](https://github.com/renovatebot/renovate) and [Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
191+
7. [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example) in security, maintainability, and reliability with low technical debt and codesmell (verified by SonarQube)
192+
8. Additional code security checks using [CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
193+
9. [Security Policy](SECURITY.md)
194+
10. [License](LICENSE) compliant with the Open Source Initiative (OSI)
195+
11. 1-liner for installation and execution of command line interface (CLI) via [uv(x)](https://github.com/astral-sh/uv) or [Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
196+
12. Setup for developing inside a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) included (supports VSCode and GitHub Codespaces)
197+
137198

138199
## Usage Examples
139200

140-
The following examples run from source. Clone this repository first using
201+
The following examples run from source - clone this repository using
141202
`git clone git@github.com:helmut-hoffer-von-ankershoffen/oe-python-template-example.git`.
142203

143204
### Minimal Python Script:

0 commit comments

Comments
 (0)