[](https://github.com/quaredevil/git-python-template/actions/workflows/ci-develop.yml)
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et eros imperdiet, ullamcorper sapien id, convallis diam. Aliquam pellentesque sem a sem lacinia, eu aliquam ex dignissim. Quisque id justo eu eros dictum tristique at vitae elit. Curabitur quis leo neque. In auctor, urna viverra posuere iaculis, metus nunc aliquet erat, eu dictum neque ligula sed sapien. Vivamus ac bibendum magna. Learn more. |
Start the installation of Python with the command:
sudo apt update sudo apt install software-properties-common sudo apt install python3.8
Allow the process to complete and verify the Python version was installed sucessfully:
python --version
Get/install Poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Then we need to enter the project directory and execute some commands:
poetry shell
Install dependences:
poetry install -E doc -vvv
If there is a problem installing the dependencies:
poetry cache clear . --all rm poetry.lock poetry install
| Name | Default Value | Description |
|---|---|---|
| GRPC_VERBOSITY | debug | Show information over transactions |
pytest is a unit testing platform and the package of choice when it comes to the majority of the Python ecosystem.
While tests are great, it’s just as important to measure your testing as it is to write them. The best way to do that is to use the Python coverage package.
To make sure that coverage is set up correctly see an example setup.cfg file.
pytest
tox is a powerful Python testing automation package. It automates the setup and execution of the testing steps above. You can use it to test across multiple Python versions.
Note that running pytest, as done above, only runs on the version of python that the virtualenv used (a proxy for testing your code across all versions). In order to debug issues in other python versions, you would use tox.
tox
flake8 is a fantastic package and tool that will make sure that your code is in tip-top shape.
Lastly, flake8 can be configured via setup.cfg (they are adding pyproject.toml support).
flake8
black is a fantastic package and tool that will make sure that your code is in tip-top shape.
You can configure some of the project settings in the pyproject.toml.
black --check app
isort helps make sure that your imports are in the correct order as per the PEP8 guidelines and automatically sorts them to match that style if they aren’t.
In order to automatically recognize external packages, another tool called seed-isort-config jumps in to automatically seed the configuration step in the pyproject.toml file.
isort --recursive --check-only app
pre-commit As the name implies, pre-commit is a Python package that allows you to create a .pre-commit-config.yaml file that maintains a list of tools to run before each commit.
pre-commit install pre-commit run --all-files
pre-commit run --all-files # pyupgrade................................................................Passed # trim trailing whitespace.................................................Passed # fix end of files.........................................................Passed # check for merge conflicts................................................Passed # check for case conflicts.................................................Passed # check json...............................................................Passed # check toml...............................................................Passed # check yaml...............................................................Passed # pretty format json.......................................................Passed # check python ast.........................................................Passed # debug statements (python)................................................Passed # check docstring is first.................................................Passed # detect private key.......................................................Passed # check for added large files..............................................Passed # check builtin type constructor use.......................................Passed # check vcs permalinks.....................................................Passed # seed isort known_third_party.............................................Passed # isort....................................................................Passed # black....................................................................Passed # flake8...................................................................Passed
towncrier lets you add those changes incrementally as you merge in pull requests. Come release time, this tool compiles and deletes newsfragments as the package likes to call them into a single changelog.
The tool is configured with all of these settings in the pyproject.toml.
poetry run towncrier --draft poetry run towncrier
sphinx is the leading python documentation tool. It is a tool that, when mastered, can make some stunning documentation. Yet, it isn’t super difficult to get up and running. It uses ReStructured (rst) files to construct beautiful documentation websites.
cd doc make html open _build/html/index.html # Opens in browsers
Gitflow is a legacy Git workflow that was originally a disruptive and novel strategy for managing Git branches.
Files related to structure is in the / (root) directory.
Default parts are:
/ ("root")
├── .github - github (e.g. ci, images) stuff.
├── .k8s - kubernetes (e.g. manifest) stuff.
├── app - application stuff.
├── doc - documentation related stuff.
├── newsfragments - changelogs related stuff.
├── .gitignore - parameters/directories to be ignored by git sync.
├── .dockerignore - parameters/directories to be ignored by dockerbuild.
├── .pre-commit-config.yaml - parameters to check after commit.
├── .pre-commit-hooks.yaml - parameters to check after pre-commit.
├── Dockerfile - converting application to container.
├── LICENSE - use license file.
├── Makefile - create shortcuts for commands.
├── pyproject.toml - project configuration file.
├── README.md - development and design information.
├── readthedocs.yml - docs configuration file.
└── setup.cfg - setup configuration file.
Files related to application is in the app directory.
Application parts are:
app ├── grcp - gRPC-generated related stuff. ├── interceptors - gRPC-interceptors related stuff. ├── core - application configuration, startup events, logging, helpers, resources for all. ├── .devops - devops related stuff.
│ ├── .environments - environments stuff. │ │ └── .env - template for use in environment variables
├── .tls - digital certificate stuff. │ └── README.md - guide for generating the digital certificate. ├── models - pydantic models for this application (domains). ├── services - logic that is not just crud related. ├── tests - tests stuff. ├── server.py - web framework application creation and configuration. └── README.md - development and design information.
- poetry for environments isolated
- flake8 for source code checking
- black
- pre-commit
- sphinx for documentation
- readthedocs
- sphinx_rtd_theme
Please report any bugs or requests that you have using the GitHub issue tracker!




