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
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 <= version <= 3.12
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 simple_http_checker_pedrolima-1.3.1.tar.gz.
File metadata
- Download URL: simple_http_checker_pedrolima-1.3.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c68ee33b85320bf9aa64c58abc95c4cb585eb300c110578ca8d813f30f5a941
|
|
| MD5 |
57d1ff17ed1bd3bea95edcfb018fb76d
|
|
| BLAKE2b-256 |
718edb0b873ad3e5a1fb5ee3677563500534aaf9002610410d4f3f1fbc41141c
|
Provenance
The following attestation bundles were made for simple_http_checker_pedrolima-1.3.1.tar.gz:
Publisher:
publish.yaml on PedroBizachi/python-devops-cicd-project
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_http_checker_pedrolima-1.3.1.tar.gz -
Subject digest:
0c68ee33b85320bf9aa64c58abc95c4cb585eb300c110578ca8d813f30f5a941 - Sigstore transparency entry: 2344792547
- Sigstore integration time:
-
Permalink:
PedroBizachi/python-devops-cicd-project@512fc470fbe73256b28c2f6e1c955824448118ae -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/PedroBizachi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@512fc470fbe73256b28c2f6e1c955824448118ae -
Trigger Event:
release
-
Statement type:
File details
Details for the file simple_http_checker_pedrolima-1.3.1-py3-none-any.whl.
File metadata
- Download URL: simple_http_checker_pedrolima-1.3.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a51290ba2ade33c979ff4b4d20698a5bc0f1d425d789ee501cda1180f9e5849
|
|
| MD5 |
fa5cd7128424998e458ba803c311092d
|
|
| BLAKE2b-256 |
111e5670b1eb9deb1387e417db3881f215c29f9332cce6187564b19dc36ca023
|
Provenance
The following attestation bundles were made for simple_http_checker_pedrolima-1.3.1-py3-none-any.whl:
Publisher:
publish.yaml on PedroBizachi/python-devops-cicd-project
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_http_checker_pedrolima-1.3.1-py3-none-any.whl -
Subject digest:
2a51290ba2ade33c979ff4b4d20698a5bc0f1d425d789ee501cda1180f9e5849 - Sigstore transparency entry: 2344792636
- Sigstore integration time:
-
Permalink:
PedroBizachi/python-devops-cicd-project@512fc470fbe73256b28c2f6e1c955824448118ae -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/PedroBizachi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@512fc470fbe73256b28c2f6e1c955824448118ae -
Trigger Event:
release
-
Statement type: