• Stars
    star
    931
  • Rank 49,068 (Top 1.0 %)
  • Language Makefile
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Blueprint/Boilerplate For Python Projects

Blueprint/Boilerplate For Python Projects

Build, Test and Lint Action Push Action Test Coverage Maintainability Quality Gate Status


If you find this useful, you can support me on Ko-Fi (Donations are always appreciated, but never required):

ko-fi

Blog Posts - More Information About This Repo

You can find more information about this project/repository and how to use it in following blog post:

Quick Start

To use this repository as starter for your project you can run configure_project.sh script, which sets up all variables and file names. This way you can avoid configuring and renaming things yourself:

./configure_project.sh MODULE="coolproject" REGISTRY="docker.pkg.github.com/martinheinz/repo-name"

Running

Using Python Interpreter

~ $ make run

Using Docker

Development image:

~ $ make build-dev
~ $ docker images --filter "label=name=blueprint"
REPOSITORY                                                             TAG                 IMAGE ID            CREATED             SIZE
docker.pkg.github.com/martinheinz/python-project-blueprint/blueprint   3492a40-dirty       acf8d09acce4        28 seconds ago      967MB
~ $ docker run acf8d09acce4
Hello World...

Production (Distroless) image:

~ $ make build-prod VERSION=0.0.5
~ $ docker images --filter "label=version=0.0.5"
REPOSITORY                                                             TAG                 IMAGE ID            CREATED             SIZE
docker.pkg.github.com/martinheinz/python-project-blueprint/blueprint   0.0.5               65e6690d9edd        5 seconds ago       86.1MB
~ $ docker run 65e6690d9edd
Hello World...

Testing

Test are ran every time you build dev or prod image. You can also run tests using:

~ $ make test

Pushing to GitHub Package Registry

~ $ docker login docker.pkg.github.com --username MartinHeinz
Password: ...
...
Login Succeeded
~ $ make push VERSION=0.0.5

Cleaning

Clean Pytest and coverage cache/files:

~ $ make clean

Clean Docker images:

~ $ make docker-clean

Kubernetes

Application can be easily deployed on k8s using KinD.

To create cluster and/or view status:

~ $ make cluster

To deploy application to local cluster:

~ $ make deploy-local

To get debugging information of running application:

~ $ make cluster-debug

To get remote shell into application pod:

~ $ make cluster-rsh

To apply/update Kubernetes manifest stored in k8s directory:

~ $ make manifest-update

Setting Up Sonar Cloud

  • Navigate to https://sonarcloud.io/projects
  • Click plus in top right corner -> analyze new project
  • Setup with other CI tool -> other -> Linux
  • Copy -Dsonar.projectKey= and -Dsonar.organization=
    • These 2 values go to sonar-project.properties file
  • Click pencil at bottom of sonar-scanner command
  • Generate token and save it
  • Go to repo -> Settings tab -> Secrets -> Add a new secret
    • name: SONAR_TOKEN
    • value: Previously copied token

Creating Secret Tokens

Token is needed for example for GitHub Package Registry. To create one:

  • Go to Settings tab
  • Click Secrets
  • Click Add a new secret
    • Name: name that will be accessible in GitHub Actions as secrets.NAME
    • Value: value

Resources

More Repositories

1

go-project-blueprint

Blueprint/Boilerplate For Golang Projects
Makefile
471
star
2

MartinHeinz

My GitHub Profile README. Don't just fork, star it, so others can find it too! πŸ‘€
379
star
3

physics-visual

Visualization/Simulation of 2D physics concepts
JavaScript
109
star
4

blog-backend

Personal Blog
Go
62
star
5

go-github-app

Template for building GitHub Apps in Go.
Go
59
star
6

ga-extractor

Tool for extracting Google Analytics data suitable for migrating to other platforms/databases
Python
45
star
7

tekton-kickstarter

Templates, scripts and samples for quickly building CI/CD with Tekton.
Makefile
43
star
8

cli-showcase-setup

Go
35
star
9

workflows

GitHub Actions-based reusable CI/CD workflows
32
star
10

charts

Collection of Charts and Data Visualizations
JavaScript
28
star
11

blog-frontend

Frontend for personal blog website.
Vue
24
star
12

IoT-Cloud

Privacy friendly framework for IoT Cloud
Python
22
star
13

game-server-operator

Kubernetes Operator for easy deployment of containerized game servers.
Go
18
star
14

kubeadm-vagrant-playground

Shell
13
star
15

openfaas-functions

Various functions for OpenFaaS
Go
11
star
16

openfaas-templates

Various Templates and Notes for OpenFaaS
Shell
10
star
17

remote-debug-python-kubernetes

Shell
8
star
18

dive-action

TypeScript
5
star
19

blog-deploy

Scripts and pipeline for deployment of blog frontend and backend
Shell
5
star
20

metrics-on-kind

Custom and external metrics setup on KinD cluster with Prometheus Operator and Prometheus Adapter
Shell
4
star
21

mastodon-local

Setup for local/playground instance for Mastodon
Dockerfile
3
star
22

github-actions

Testing Github Actions
Dockerfile
3
star
23

LifestyleTracker

Python
3
star
24

application-operator

Kubernetes Operator for deploying whole applications with single CRD.
Go
2
star
25

TicTacToe

Tic-Tac-Toe Java Kata
Java
2
star
26

pipeline-tester

Python
2
star
27

kuberhealthy-custom-checks

Go
2
star
28

openfaas-setup

1
star
29

training-and-food-tracker

Python
1
star
30

k8s-manifests

1
star
31

felsenstein-1981

Implementation of Felsenstein's tree-pruning algorithm
Python
1
star