2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00
2025-10-11 17:03:02 +02:00

ESTA Python Template

This is a template for Python-based projects. It allows to generate an exemplary setup and project structure including neat stuff like pre-commit-hooks, automated testing, type checking, CI/CD using Tekton, etc. The generated code is intended to be tailored to project needs.

Usage

Creating new projects

The expected way to use this template is to install the necessary prerequisites using Automated WSL and Docker Setup. You can then just run the following in WSL to generate a new ESTA Python project:

copier copy ssh://git@codessh.sbb.ch:7999/kd_esta_blueprints/esta-python-template.git my_project

This will create a new directory called my_project and generate a new project inside it.

If you already have an empty directory - for example from a new git repository - you can cange into that directory and run:

copier copy ssh://git@codessh.sbb.ch:7999/kd_esta_blueprints/esta-python-template.git .

Updating existing projects

In order to receive updates provided by this template, you can run the following command in your project directory:

copier update --skip-answered

Install Python

If not already installed, install Python. The recommended way is to use pyenv, which allows multiple parallel Python installations which can be automatically selected per project you're working on.

# Install Python if necessary
pyenv install 3.12
pyenv shell 3.12

Note

: If you start from scratch with Python development you might find Automated WSL and Docker Setup useful.

Install Copier

If not already installed get Copier.

The easiest way is to install it in an existing WSL installation is using pipx:

pipx install copier

Order a Bitbucket Repository

Order a Bitbucket repository from the CLEW Portal https://self.sbb-cloud.net/tools/bitbucket/repository and clone it.

(Optional) Order a Docker Repository

If you want to package your code in a Docker container order a "Docker" repository on Artifactory from the CLEW Portal: https://self.sbb-cloud.net/tools/artifactory.

(Optional) Order a PyPI Repository

If you want to share your code as Python library order a "Python" repository on Artifactory from the CLEW Portal: https://self.sbb-cloud.net/tools/artifactory.

(Optional) Order a Helm Repository

If you want to deploy your code using Helm, order a "Helm" repository on Artifactory from the CLEW Portal: https://self.sbb-cloud.net/tools/artifactory.

Note: When rendering the template, use the "local" Helm repository, e.g. "my-project.helm.local"!

Render Template

Now you can go to the freshly cloned repository and render the template by running Copier. You will be prompted to provide the required information. Once you rendered the template, follow the setup instructions in the rendered template.

copier copy ssh://git@codessh.sbb.ch:7999/kd_esta_blueprints/esta-python-template.git .

Developer's Guide

Setup

# Create venv and install all dependencies
make

# Cleanup venv
make clean

# Render template into current HEAD of esta-python
# Helpful when you want to see the diff to esta-python.
make render-in-esta-python

# Cleanup
make remove-rendered-template
Description
Template for ESTA Python projects. Can be used to generate a new ESTA Python project.
Readme 91 KiB
Languages
Python 62.4%
Jinja 34.4%
Makefile 3.2%