{"id":13499956,"url":"https://github.com/MartinHeinz/python-project-blueprint","last_synced_at":"2025-03-29T05:32:40.330Z","repository":{"id":38450212,"uuid":"230275309","full_name":"MartinHeinz/python-project-blueprint","owner":"MartinHeinz","description":"Blueprint/Boilerplate For Python Projects","archived":false,"fork":false,"pushed_at":"2023-05-01T21:23:23.000Z","size":42,"stargazers_count":957,"open_issues_count":10,"forks_count":231,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-10-31T18:38:32.553Z","etag":null,"topics":["blueprint","boilerplate","docker","kubernetes","python","template"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartinHeinz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-26T14:12:11.000Z","updated_at":"2024-09-24T23:43:38.000Z","dependencies_parsed_at":"2024-01-14T07:00:20.597Z","dependency_job_id":"4d113f39-722c-4488-b710-feb87cc10127","html_url":"https://github.com/MartinHeinz/python-project-blueprint","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinHeinz%2Fpython-project-blueprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinHeinz%2Fpython-project-blueprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinHeinz%2Fpython-project-blueprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinHeinz%2Fpython-project-blueprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartinHeinz","download_url":"https://codeload.github.com/MartinHeinz/python-project-blueprint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145012,"owners_count":20730494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blueprint","boilerplate","docker","kubernetes","python","template"],"created_at":"2024-07-31T22:00:48.434Z","updated_at":"2025-03-29T05:32:39.975Z","avatar_url":"https://github.com/MartinHeinz.png","language":"Makefile","readme":"# Blueprint/Boilerplate For Python Projects\n\n[![Build, Test and Lint Action](https://github.com/MartinHeinz/python-project-blueprint/workflows/Build,%20Test,%20Lint/badge.svg)](https://github.com/MartinHeinz/python-project-blueprint/workflows/Build,%20Test,%20Lint/badge.svg)\n[![Push Action](https://github.com/MartinHeinz/python-project-blueprint/workflows/Push/badge.svg)](https://github.com/https://github.com/MartinHeinz/python-project-blueprint/workflows/Push/badge.svg)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/05c44c881bc10a706cbc/test_coverage)](https://codeclimate.com/github/MartinHeinz/python-project-blueprint/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/05c44c881bc10a706cbc/maintainability)](https://codeclimate.com/github/MartinHeinz/python-project-blueprint/maintainability)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=MartinHeinz_python-project-blueprint\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=MartinHeinz_python-project-blueprint)\n\n-----\n\nIf you find this useful, you can support me on Ko-Fi (Donations are always appreciated, but never required):\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/K3K6F4XN6)\n\n## Blog Posts - More Information About This Repo\n\nYou can find more information about this project/repository and how to use it in following blog post:\n\n- [Ultimate Setup for Your Next Python Project](https://towardsdatascience.com/ultimate-setup-for-your-next-python-project-179bda8a7c2c)\n- [Automating Every Aspect of Your Python Project](https://towardsdatascience.com/automating-every-aspect-of-your-python-project-6517336af9da)\n- [Deploy Any Python Project to Kubernetes](https://towardsdatascience.com/deploy-any-python-project-to-kubernetes-2c6ad4d41f14)\n- [Implementing gRPC server using Python](https://towardsdatascience.com/implementing-grpc-server-using-python-9dc42e8daea0)\n\n## Quick Start\nTo 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:\n\n```shell\n./configure_project.sh MODULE=\"coolproject\" REGISTRY=\"docker.pkg.github.com/martinheinz/repo-name\"\n```\n\n## Running\n\n### Using Python Interpreter\n```shell\n~ $ make run\n```\n\n### Using Docker\n\nDevelopment image:\n```console\n~ $ make build-dev\n~ $ docker images --filter \"label=name=blueprint\"\nREPOSITORY                                                             TAG                 IMAGE ID            CREATED             SIZE\ndocker.pkg.github.com/martinheinz/python-project-blueprint/blueprint   3492a40-dirty       acf8d09acce4        28 seconds ago      967MB\n~ $ docker run acf8d09acce4\nHello World...\n```\n\nProduction (Distroless) image:\n```console\n~ $ make build-prod VERSION=0.0.5\n~ $ docker images --filter \"label=version=0.0.5\"\nREPOSITORY                                                             TAG                 IMAGE ID            CREATED             SIZE\ndocker.pkg.github.com/martinheinz/python-project-blueprint/blueprint   0.0.5               65e6690d9edd        5 seconds ago       86.1MB\n~ $ docker run 65e6690d9edd\nHello World...\n```\n\n## Testing\n\nTest are ran every time you build _dev_ or _prod_ image. You can also run tests using:\n\n```console\n~ $ make test\n```\n\n## Pushing to GitHub Package Registry\n\n```console\n~ $ docker login docker.pkg.github.com --username MartinHeinz\nPassword: ...\n...\nLogin Succeeded\n~ $ make push VERSION=0.0.5\n```\n\n## Cleaning\n\nClean _Pytest_ and coverage cache/files:\n\n```console\n~ $ make clean\n```\n\nClean _Docker_ images:\n\n```console\n~ $ make docker-clean\n```\n\n## Kubernetes\n\nApplication can be easily deployed on _k8s_ using _KinD_.\n\nTo create cluster and/or view status:\n\n```console\n~ $ make cluster\n```\n\nTo deploy application to local cluster:\n\n```console\n~ $ make deploy-local\n```\n\nTo get debugging information of running application:\n\n```console\n~ $ make cluster-debug\n```\n\nTo get remote shell into application pod:\n\n```console\n~ $ make cluster-rsh\n```\n\nTo apply/update _Kubernetes_ manifest stored in `k8s` directory:\n\n```console\n~ $ make manifest-update\n```\n\n## Setting Up Sonar Cloud\n- Navigate to \u003chttps://sonarcloud.io/projects\u003e\n- Click _plus_ in top right corner -\u003e analyze new project\n- Setup with _other CI tool_ -\u003e _other_ -\u003e _Linux_\n- Copy `-Dsonar.projectKey=` and `-Dsonar.organization=`\n    - These 2 values go to `sonar-project.properties` file\n- Click pencil at bottom of `sonar-scanner` command\n- Generate token and save it\n- Go to repo -\u003e _Settings_ tab -\u003e _Secrets_ -\u003e _Add a new secret_\n    - name: `SONAR_TOKEN`\n    - value: _Previously copied token_\n    \n## Creating Secret Tokens\nToken is needed for example for _GitHub Package Registry_. To create one:\n\n- Go to _Settings_ tab\n- Click _Secrets_\n- Click _Add a new secret_\n    - _Name_: _name that will be accessible in GitHub Actions as `secrets.NAME`_\n    - _Value_: _value_\n\n### Resources\n- \u003chttps://realpython.com/python-application-layouts/\u003e\n- \u003chttps://dev.to/codemouse92/dead-simple-python-project-structure-and-imports-38c6\u003e\n- \u003chttps://github.com/navdeep-G/samplemod/blob/master/setup.py\u003e\n- \u003chttps://github.com/GoogleContainerTools/distroless/blob/master/examples/python3/Dockerfile\u003e\n","funding_links":["https://ko-fi.com/K3K6F4XN6"],"categories":["Makefile","boilerplate"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMartinHeinz%2Fpython-project-blueprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMartinHeinz%2Fpython-project-blueprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMartinHeinz%2Fpython-project-blueprint/lists"}