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.
- 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
Install the package from PyPI:
pip install simple-http-checker-PedroLimaInstall from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ simple-http-checker-PedroLimaFor 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]"Check a single URL:
check-urls https://httpbin.org/status/200Check multiple URLs:
check-urls https://httpbin.org/status/200 https://httpbin.org/status/404 https://httpbin.org/status/500Set a custom timeout in seconds:
check-urls https://httpbin.org/delay/2 --timeout 5Enable verbose logging:
check-urls https://httpbin.org/status/200 --verboseExample 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
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 name:
simple-http-checker-PedroLima - CLI command:
check-urls - Python version:
3.9 <= version <= 3.12
