This package provides a command-line interface for setting up a Python project based on a DevOps template
Project description
Python Devops Template Tool
Command-line interface for setting up a Python project based on a dev-ops template.
- Sample project for this template (including detailed documentation).
- Cookiecutter for this template.
- Also check out audreyr/cookiecutter-pypackage for additional Python package templates.
Features
This command-line interface supports the creation and the management of a Python dev-ops template that provides:
- testing and deployment in a multi-stage Docker environment,
- packaging with setuptools,
- code analysis with pylint, bandit, pytest and coverage,
- code quality monitoring with SonarQube.
The dev-ops pipeline is mostly implemented in a Makefile and a Dockerfile which are
independent of your Python code. A SonarQube server is started with docker-compose.
Creation and management of the template:
- create a new instance of the template (very similar to Cookiecutter),
- manage an existing instance/project by adding template components as the project evolves,
- generate a Cookiecutter template (see lrothack/cookiecutter-pydevops),
- packages the template code in a Python distributions, e.g., binary wheel package,
- configure the template with boolean command-line flags or in interactive mode,
- resolves author information automatically with
git config.
Installation
Install the latest version from pypi.org:
pip install -U devopstemplate
From source:
# Obtain sources
git clone --recurse-submodules https://github.com/lrothack/dev-ops-admin.git
# Install and activate virtual environment
cd dev-ops-admin
python3 -m venv venv
source venv/bin/activate
# Build package
make dist
The binary wheel package is located in the dist directory and can be installed with pip.
Create and manage projects
After installation, the executable devopstemplate is available. It provides the sub-commands:
- create
- manage
- cookiecutter
An overview of the functionalities is shown on the help screens:
devopstemplate --help
devopstemplate <sub-command> --help
The working directory is always the root directory of your project, for example:
mkdir sampleproject
cd sampleproject
devopstemplate create sampleproject
Using the dev-ops template
After creating a new project or after switching to the project directory:
- Set up a virtual environment for your project and activate it (requires Python >= 3.6).
- Run
make helpin order to get an overview of the targets provided byMakefile. - Run
make install-devin order to install the package (and all dependencies) in development mode. - Run
make lintin order to run code analysis with pylint and bandit. - Run
make testin order to run unit tests with pytest and coverage. - Run
make distin order to build a Python package (binary and source). - Run
docker-compose -p sonarqube -f sonarqube/docker-compose.yml up -din order to start a SonarQube server. - Run
make sonarin order to locally runsonar-scannerand report results to your local SonarQube server. Requires a local installation of sonar-scanner. - Run
make docker-buildin order to analyze, test, package, report to SonarQube and deploy in a multi-stage Docker build. Test your docker image withdocker run. Make sure you have Docker installed and the Docker daemon is running.
Advanced configurations can be made in the configuration sections of Makefile. See lrothack/dev-ops for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devopstemplate-0.6.0.tar.gz.
File metadata
- Download URL: devopstemplate-0.6.0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd1b1d9e26893a3d0b00db45fa367aa10e4035fc5b449e565237dd007eb45ea5
|
|
| MD5 |
e84ea2d9f849db7839b7ad3c8b2a0bf9
|
|
| BLAKE2b-256 |
8785db5c41227ceb05cece5f2d75e8023dc8b23f5466c665e5316473abe72894
|
File details
Details for the file devopstemplate-0.6.0-py3-none-any.whl.
File metadata
- Download URL: devopstemplate-0.6.0-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54312de04d9be16ae2eb2c099fba4ccc9bc48d970ca70b96e8201d015506e4d4
|
|
| MD5 |
4350261bc22d8ce8e4fed298954564df
|
|
| BLAKE2b-256 |
98b779a1e224dc50fc3209dae67619d423ab1e1c0552e916d9e646aa2fa94c21
|