Skip to main content

Python for DevOps: CI/CD for Python Projects

This repo contains the code for the CI/CD section of my Python for DevOps course.

It packages a small command-line tool, check-urls, that checks one or more URLs and prints their HTTP status.

Workflow

workflow-overview

What we will implement in this repository

  • Implement the project (code files)
  • Add a simple GHA workflow and make sure it runs until completion
  • Add linting (ruff) and format checks (black)
  • Add typing (mypy) and security checks (bandit)
  • Add test automation
  • Build our Python project
  • Publish the project to both TestPyPI and PyPI when a new release is published

Installation

Install the package from PyPI:

pip install simple-http-checker-PedroLima

Install from TestPyPI:

pip install --index-url https://test.pypi.org/simple/ simple-http-checker-PedroLima

For local development, clone the repository and install it in editable mode:

git clone <repo-url>
cd python-devops-cicd-project
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Usage

Check a single URL:

check-urls https://httpbin.org/status/200

Check multiple URLs:

check-urls https://httpbin.org/status/200 https://httpbin.org/status/404 https://httpbin.org/status/500

Set a custom timeout in seconds:

check-urls https://httpbin.org/delay/2 --timeout 5

Enable verbose logging:

check-urls https://httpbin.org/status/200 --verbose

Example output:

--- Results ---
https://httpbin.org/status/200             -> 200 OK
https://httpbin.org/status/404             -> 404 NOT FOUND
https://httpbin.org/status/500             -> 500 INTERNAL SERVER ERROR

Development

Install development dependencies:

pip install -e ".[dev]"

Run linting, formatting, typing, security checks, and tests:

ruff check .
black --check .
mypy src/
bandit -c pyproject.toml -r .
pytest

Package Info

  • Package name: simple-http-checker-PedroLima
  • CLI command: check-urls
  • Python version: >=3.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_http_checker_pedrolima-1.1.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file simple_http_checker_pedrolima-1.1.3.tar.gz.

File metadata

File hashes

Hashes for simple_http_checker_pedrolima-1.1.3.tar.gz
Algorithm Hash digest
SHA256 3dab03d23ee319c8c302e7f5c4e971ed5e80ba2d72ab7589608d8590cdd6e26c
MD5 2ef955f3c8be5890be39bb6e2e477dfa
BLAKE2b-256 622b2db7dcc2b811d3ec3c10fabc720997ccc478ce56c94bbe3d8b7e5cb248bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_http_checker_pedrolima-1.1.3.tar.gz:

Publisher: publish.yaml on PedroBizachi/python-devops-cicd-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_http_checker_pedrolima-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_http_checker_pedrolima-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 09354806db640d104ebfc2d098eb246e1239154875d09662d49afbe3951c7f46
MD5 c1d1c5de62c50ef9360e667a596210c9
BLAKE2b-256 1694ec78cceea26fbce7aa85ca589836cd1210933522060ff9a03f69411d238b

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_http_checker_pedrolima-1.1.3-py3-none-any.whl:

Publisher: publish.yaml on PedroBizachi/python-devops-cicd-project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page