Skip to main content

Python Devops Template Tool

Command-line interface for setting up a Python project based on a dev-ops template.

Features

This command-line interface supports the creation and the management of a Python dev-ops template that provides:

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.

Optional template components:

These components have been developed in jkortner/ml-ops.

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

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 help in order to get an overview of the targets provided by Makefile. Note: Running make is only supported from project directory.
  • Run make install-dev in order to install the package (and all dependencies) in development mode.
  • Run make lint in order to run code analysis with pylint and bandit.
  • Run make test in order to run unit tests with pytest and coverage.
  • Run make dist in order to build a Python package (binary and source).
  • Make sure you have Docker installed and the Docker daemon is running. Allocate at least 4GB RAM in the Docker resource configuration.
  • Run docker-compose -p sonarqube -f sonarqube/docker-compose.yml up -d in order to start a SonarQube server. Configure your server through its web interface and obtain an authentication token. The SonarQube URL can be configured through the Makefile variable SONARURL. The authentication token can be stored in the local file .sonartoken.
  • Run make sonar in order to run sonar-scanner and report results to your SonarQube server.
  • Run make docker-build in order to analyze, test, package and deploy in a multi-stage Docker build. Analysis results and test results are shown after the build.

Advanced configurations can be made in the configuration sections of Makefile. See lrothack/dev-ops for more information.

Additional components

  • mongodb
  • mlflow

Additional components can be installed when creating a new project or with the manage command at a later time (replace <component> with a component from the list above, also see devopstemplate manage --help):

cd sampleproject
devopstemplate manage --add-<component>

Start the corresponding Docker containers with docker-compose:

docker-compose -p <component> -f <component>/docker-compose.yml up -d

Also check out the README file in the <component> directory and run the sample script.

Metadata

Release files for devopstemplate 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devopstemplate 0.9.0
File Size Uploaded Provenance Actions
devopstemplate-0.9.0.tar.gz 37.2 kB Without provenance Details for devopstemplate-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for devopstemplate 0.9.0
File Interpreter ABI Platform Actions
devopstemplate-0.9.0-py3-none-any.whl Python 3 none any Details for devopstemplate-0.9.0-py3-none-any.whl

Total release size: 81.3 kB

Release files / devopstemplate-0.9.0.tar.gz

Download URL devopstemplate-0.9.0.tar.gz
Size 37.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7a301e53a5c815094c80ed6f50da1fa729703912d2d12866f5c48b683313f98a
BLAKE2b-256 checksum
How to use checksums
931d6ef33e440e0bed13b99875ed883eef286ab83614ba05cff6a03a06a77c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / devopstemplate-0.9.0-py3-none-any.whl

Download URL devopstemplate-0.9.0-py3-none-any.whl
Size 44.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5573dfdb61bbabcb5140f76e2b99467530df21388b2f0c1507b8ca1d5da9eebd
BLAKE2b-256 checksum
How to use checksums
c558d2517d2a862c4b9a3d9836b04d3f8f91d9c4ccbb8f949eba5c02db9e57ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for devopstemplate 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page