An easy to use template of Python script, include basic CI/CD settings.
Development
Prerequisite
| Package Name | Version |
|---|---|
| Python | 3.10.8 |
| pipenv | 2022.9.24 |
Environment setup
- Install dependencies
Formatting
Code formatter
This template uses the following automatic format tool:
Linting
This template uses the following linting tool:
Analysis
This template uses the following security analysis tool:
Test
This template uses the following testing tool:
- pytest
- pytest-cov(pytest plugin: produces coverage report)
- hypothesis(property-based testing tool)
Deploy
Prerequisite
| Package Name | Version |
|---|---|
| Docker | 20.10.21 |
| docker-compose | v2.12.2 |
Build image
Run container
Github workflows
CI
Trigger on: push and pull-request
Jobs:
- Lint
- Run linting tools:
flake8,pylint,mypy
- Run linting tools:
- Analysis
- Run security analysis tools:
bandit,ochrona
- Run security analysis tools:
- tests
- Run
pytest - Upload testing coverage report to Codecov
- Run
Build
Trigger on: push and Bump version complete
Jobs:
- build-and-push-image
- Build a test image and check the container can start without errors
- Build and push image with
testtag - If branch
develop: build and push image withdevtag - If branch
main: build and push image withlatestand latest git tag
Bump and release version
Trigger on: push to main branch
Tools: python commitizen tool
Jobs:
- bump-version
- Create bump and changelog
- Release latest version