From 1d42712ea23d43859d438cf4f6a303c23e6cba6b Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Wed, 26 Aug 2026 17:16:02 +0530 Subject: [PATCH 01/12] Add Python lint workflow --- .github/workflows/lint.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..c034887 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint Python Code + +on: + pull_request: + branches: + - master + + push: + branches: + - master + + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ruff + + - name: Run Ruff + run: ruff check --output-format=github From b244f8f625dfd89a2d532520f5873efd391bb03c Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Wed, 26 Aug 2026 17:21:44 +0530 Subject: [PATCH 02/12] Add working branch for linting --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c034887..61b0057 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - github-actions-tutorial push: branches: From 2cbbf91b5230077300b1359d4d871c32d58e934c Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Wed, 26 Aug 2026 18:30:51 +0530 Subject: [PATCH 03/12] Change workflow to my name --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 61b0057..750873a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Lint Python Code +name: Sanjay Lint Python Code on: pull_request: From a9ab135f3031884f3c5dbc4b84096f907666ef68 Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Wed, 26 Aug 2026 18:40:24 +0530 Subject: [PATCH 04/12] Change to simple Workflow --- .github/workflows/lint.yml | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 750873a..f8d0bd5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,33 +1,16 @@ -name: Sanjay Lint Python Code +name: Sanjay - GitHub Actions Learning on: - pull_request: - branches: - - master - - github-actions-tutorial - push: branches: - - master + - github-actions-tutorial workflow_dispatch: jobs: - lint: + hello: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "3.13" - cache: "pip" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install ruff - - - name: Run Ruff - run: ruff check --output-format=github + - name: Say Hello + run: echo "Hello Sanjay! My first GitHub Action is running." From 30d48b338e2e87040d7b90354d4a4e7813d15874 Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 09:50:26 +0530 Subject: [PATCH 05/12] Fix linting issues --- src/reader/feed.py | 11 +++++++---- src/reader/viewer.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/reader/feed.py b/src/reader/feed.py index 16ad7be..3a573e8 100644 --- a/src/reader/feed.py +++ b/src/reader/feed.py @@ -1,6 +1,6 @@ """Interact with the Real Python feed.""" # Standard library imports -from typing import Dict, List +from __future__ import annotations # Third party imports import feedparser @@ -9,7 +9,7 @@ # Reader imports from reader import URL -_CACHED_FEEDS: Dict[str, feedparser.FeedParserDict] = {} +_CACHED_FEEDS: dict[str, feedparser.FeedParserDict] = {} def _feed(url: str = URL) -> feedparser.FeedParserDict: @@ -21,8 +21,11 @@ def _feed(url: str = URL) -> feedparser.FeedParserDict: def get_site(url: str = URL) -> str: """Get name and link to website of the feed.""" + # info = _feed(url) + # if exception := info.get("bozo_exception"): info = _feed(url) - if exception := info.get("bozo_exception"): + exception = info.get("bozo_exception") + if exception: message = f"Could not read feed at {url}" if "CERTIFICATE_VERIFY_FAILED" in str(exception): message += ( @@ -58,7 +61,7 @@ def get_article(article_id: str, links: bool = False, url: str = URL) -> str: return f"# {article.title}\n\n{text}" -def get_titles(url: str = URL) -> List[str]: +def get_titles(url: str = URL) -> list[str]: """List titles in feed.""" articles = _feed(url).entries return [a.title for a in articles] diff --git a/src/reader/viewer.py b/src/reader/viewer.py index e2852df..5f55a43 100644 --- a/src/reader/viewer.py +++ b/src/reader/viewer.py @@ -1,7 +1,7 @@ """Functions for displaying the Real Python feed.""" # Standard library imports -from typing import List +from __future__ import annotations def show(article: str) -> None: @@ -9,7 +9,7 @@ def show(article: str) -> None: print(article) -def show_list(site: str, titles: List[str]) -> None: +def show_list(site: str, titles: list[str]) -> None: """Show list of articles.""" print(f"The latest tutorials from {site}") for article_id, title in enumerate(titles): From 186c21e52fdd8079d01ceb8a93bb28d4fa47c2ff Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 09:55:58 +0530 Subject: [PATCH 06/12] Update lint workflow --- .github/workflows/lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f8d0bd5..45d53f3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,3 +14,17 @@ jobs: steps: - name: Say Hello run: echo "Hello Sanjay! My first GitHub Action is running." + + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-verson: "3.13" + + - name: Install Ruff + run: python -m pip install Ruff + + - name: Run Ruff + run: ruff check . From 7ade3bca7188e0f389d14a2dff3815eb68d3a39b Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 09:59:30 +0530 Subject: [PATCH 07/12] Update job name --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 45d53f3..5fb61fb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - hello: + Linting check: runs-on: ubuntu-latest steps: From f88a8e53b3c0e745985aa0e95cb94e88ffded1bd Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 10:01:20 +0530 Subject: [PATCH 08/12] Fix name error in workflow --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fb61fb..7eaf454 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - Linting check: + Linting-check: runs-on: ubuntu-latest steps: From 6f46de5b89979d2db0c3541271d3a692b11b302e Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 10:08:52 +0530 Subject: [PATCH 09/12] Add ruff_issue file --- src/reader/ruff_issue.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/reader/ruff_issue.py diff --git a/src/reader/ruff_issue.py b/src/reader/ruff_issue.py new file mode 100644 index 0000000..1e71f7e --- /dev/null +++ b/src/reader/ruff_issue.py @@ -0,0 +1,4 @@ +import os + +def calculate(x, y): + return x + y \ No newline at end of file From 0bea83dc873eb76dc362471e690f2175e382a84f Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 10:10:40 +0530 Subject: [PATCH 10/12] Add run on pull-requests --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7eaf454..d156e7c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,7 @@ name: Sanjay - GitHub Actions Learning on: - push: + pull-request: branches: - github-actions-tutorial From a5b9e3213f4858756e62e61d107d87abd7694e27 Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 10:13:02 +0530 Subject: [PATCH 11/12] Fix pull-request typo --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d156e7c..decad72 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,7 @@ name: Sanjay - GitHub Actions Learning on: - pull-request: + pull_request: branches: - github-actions-tutorial From 8768c0de9abc2859872c63f05e19e746137a7080 Mon Sep 17 00:00:00 2001 From: Sanjay-python27 Date: Fri, 28 Aug 2026 10:16:16 +0530 Subject: [PATCH 12/12] Add pull_request branch to main --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index decad72..4ce0ec7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - github-actions-tutorial + - main workflow_dispatch: