From 8fbb3804b13b2c8fb59a9280af4267c96ca60628 Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 15:15:41 -0300 Subject: [PATCH 1/6] feat(docs): Added necessary info for "pip show" --- pyproject.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 0a47c32..472867f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,21 @@ description = "A simple CLI tool to check the status of URLs." readme = "README.md" requires-python = ">=3.9" dependencies = ["click>=8.0,<9.0", "requests>=2.28,<3.0"] +authors = [{ name = "Pedro Lima" }, { email = "bizak.dev@outlook.com" }] +license = { text = "MIT" } +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: Portuguese (Brazilian)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Libraries :: Python Modules", +] +homepage = "https://github.com/PedroBizachi/python-devops-cicd-project" [project.optional-dependencies] # Run `pip install .[dev]` to install newer dev dependencies From a740dde20e43c9cd8db88b380321c875ab2b618a Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 15:17:27 -0300 Subject: [PATCH 2/6] feat(ci): CI for commits in "dev" branch --- .github/workflows/python-ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-ci.yaml b/.github/workflows/python-ci.yaml index fef05fb..347c506 100644 --- a/.github/workflows/python-ci.yaml +++ b/.github/workflows/python-ci.yaml @@ -2,7 +2,9 @@ name: CI/CD for simple-http-checker on: push: - branches: ['main'] + branches: ['main', 'dev'] + pull_request: + branches: ['main', 'dev'] workflow_dispatch: jobs: @@ -56,6 +58,7 @@ jobs: run: | pytest release: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest needs: - tests @@ -83,4 +86,3 @@ jobs: run: | semantic-release version semantic-release publish - From c5068b31b5828e2d237016322325175d8df478d1 Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 15:27:53 -0300 Subject: [PATCH 3/6] fix(docs): Correct structure of pyproject.toml --- pyproject.toml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 472867f..9135544 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +# Writing Guide +# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ + [build-system] requires = ["setuptools>=77.0"] build-backend = "setuptools.build_meta" @@ -23,7 +26,13 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries :: Python Modules", ] -homepage = "https://github.com/PedroBizachi/python-devops-cicd-project" + +[project.urls] +Homepage = "https://github.com/PedroBizachi/python-devops-cicd-project" +Documentation = "https://github.com/lm-academy/python-devops-cicd-project/blob/main/README.md" +Repository = "https://github.com/PedroBizachi/python-devops-cicd-project" +Issues = "https://github.com/PedroBizachi/python-devops-cicd-project/issues" +Changelog = "https://github.com/PedroBizachi/python-devops-cicd-project/blob/main/CHANGELOG.md" [project.optional-dependencies] # Run `pip install .[dev]` to install newer dev dependencies From e3e6c410d9cf747d302f7f7f02d258cb7ef22522 Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 15:31:33 -0300 Subject: [PATCH 4/6] perf(logging): Improved logging messages --- src/simple_http_checker/checker.py | 9 +++++---- src/simple_http_checker/cli.py | 4 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/simple_http_checker/checker.py b/src/simple_http_checker/checker.py index e8e515f..f8a256b 100644 --- a/src/simple_http_checker/checker.py +++ b/src/simple_http_checker/checker.py @@ -10,20 +10,21 @@ def check_urls(urls: Collection[str], timeout: int = 5) -> dict[str, str]: """Checks a list of urls and returns their status. Args: - urls (list[str]): A list of URLs to check. + urls (Collection[str]): A collection of URLs to check. timeout (int, optional): The timeout in seconds for each URL check. Defaults to 5. Returns: dict[str, str]: A dictionary mapping URLs to their status. """ + url_count = len(urls) + url_context = "URL" if url_count == 1 else "URLs" logger.info( - f"Starting check for {len(urls)} URLs with a timeout of {timeout} seconds." + f"Starting check for {url_count} {url_context} with a timeout of {timeout} seconds." ) results: dict[str, str] = {} for url in urls: - status = "UNKNOWN" try: logger.debug(f"Checking URL: {url}") response = requests.get(url, timeout=timeout) @@ -39,7 +40,7 @@ def check_urls(urls: Collection[str], timeout: int = 5) -> dict[str, str]: logger.warning(f"Connection error for URL: {url}") except requests.exceptions.RequestException as e: status = f"REQUEST_ERROR: {type(e).__name__}" - logger.exception( + logger.error( f"An unexpected error occurred for {url}:", ) diff --git a/src/simple_http_checker/cli.py b/src/simple_http_checker/cli.py index fc80785..25ac28d 100644 --- a/src/simple_http_checker/cli.py +++ b/src/simple_http_checker/cli.py @@ -32,13 +32,11 @@ def main(urls: Collection[str], timeout: int, verbose: bool): click.echo("Usage: check-urls ...") return - logger.info(f"Starting check for {len(urls)} URLs...") - results = check_urls(urls, timeout) click.echo("\n --- Results ---") for url, status in results.items(): - if "OK" in status: + if status.endswith("OK"): fg_color = "green" else: fg_color = "red" From d6d0a33464075deacb27a5258d2df97efab90d74 Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 16:35:52 -0300 Subject: [PATCH 5/6] docs(media): Moved media from src/ to public/ --- {src => public}/media/workflow-overview.excalidraw | 0 {src => public}/media/workflow-overview.png | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename {src => public}/media/workflow-overview.excalidraw (100%) rename {src => public}/media/workflow-overview.png (100%) diff --git a/src/media/workflow-overview.excalidraw b/public/media/workflow-overview.excalidraw similarity index 100% rename from src/media/workflow-overview.excalidraw rename to public/media/workflow-overview.excalidraw diff --git a/src/media/workflow-overview.png b/public/media/workflow-overview.png similarity index 100% rename from src/media/workflow-overview.png rename to public/media/workflow-overview.png From 1817b36cb92d175a5638ac8a379a77ab5d7ba721 Mon Sep 17 00:00:00 2001 From: Pedro Bizachi Date: Mon, 3 Aug 2026 16:37:11 -0300 Subject: [PATCH 6/6] feat(logging): Enhanced coloring of loglevel output --- src/simple_http_checker/cli.py | 35 ++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/simple_http_checker/cli.py b/src/simple_http_checker/cli.py index 25ac28d..c82fe3b 100644 --- a/src/simple_http_checker/cli.py +++ b/src/simple_http_checker/cli.py @@ -1,16 +1,43 @@ import logging from collections.abc import Collection +from typing import ClassVar import click from simple_http_checker.checker import check_urls -logging.basicConfig( - level=logging.INFO, - format="[%(asctime)s] %(levelname)s: %(message)s", - datefmt="%Y-%m-%d %H:%M:%S", + +class ColoredLevelFormatter(logging.Formatter): + LEVEL_COLORS: ClassVar[dict[int, str]] = { + logging.DEBUG: "cyan", + logging.INFO: "green", + logging.WARNING: "yellow", + logging.ERROR: "red", + logging.CRITICAL: "magenta", + } + + def format(self, record: logging.LogRecord) -> str: + original_levelname = record.levelname + color = self.LEVEL_COLORS.get(record.levelno) + if color: + record.levelname = click.style(record.levelname, fg=color) + + try: + return super().format(record) + finally: + record.levelname = original_levelname + + +handler = logging.StreamHandler() +handler.setFormatter( + ColoredLevelFormatter( + fmt="[%(asctime)s] %(levelname)s: %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) ) +logging.basicConfig(level=logging.INFO, handlers=[handler]) + logger = logging.getLogger(__name__)