Skip to content

Commit 9ec93f1

Browse files
refactor: Dropped support for Python 3.8 (#335)
1 parent 930a431 commit 9ec93f1

14 files changed

+393
-318
lines changed

.github/workflows/test_tap.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
- "3.11"
4040
- "3.10"
4141
- "3.9"
42-
- "3.8"
4342
# run the matrix jobs one after the other so they can benefit from caching
4443
max-parallel: 1
4544

.sonarcloud.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sonar.python.version=3.7, 3.8, 3.9, 3.10
1+
sonar.python.version=3.9, 3.10, 3.11, 3.12, 3.13
22
sonar.cpd.exclusions=**/*

poetry.lock

Lines changed: 124 additions & 152 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ classifiers = [
1111
"Intended Audience :: Developers",
1212
"License :: OSI Approved :: Apache Software License",
1313
"Operating System :: OS Independent",
14-
"Programming Language :: Python :: 3.8",
1514
"Programming Language :: Python :: 3.9",
1615
"Programming Language :: Python :: 3.10",
1716
"Programming Language :: Python :: 3.11",
@@ -28,7 +27,7 @@ classifiers = [
2827
beautifulsoup4 = "~=4.12.0"
2928
nested-lookup = "~=0.2.25"
3029
PyJWT = "2.9.0"
31-
python = ">=3.8"
30+
python = ">=3.9"
3231
python-dateutil = "~=2.9"
3332
requests = "~=2.32.3"
3433
# For local SDK dev:
@@ -62,17 +61,21 @@ markers = [
6261
]
6362

6463
[tool.ruff]
65-
target-version = "py38"
64+
target-version = "py39"
6665

6766
[tool.ruff.lint]
6867
ignore = []
6968
select = [
70-
"F", # Pyflakes
71-
"E", # pycodestyle (errors)
72-
"W", # pycodestyle (warnings)
73-
"I", # isort
74-
"UP", # pyupgrade
75-
"FA", # flake8-future-annotations
76-
"SIM", # flake8-simplify
77-
"RUF", # Ruff-specific rules
69+
"F", # Pyflakes
70+
"E", # pycodestyle (errors)
71+
"W", # pycodestyle (warnings)
72+
"I", # isort
73+
"UP", # pyupgrade
74+
"DTZ", # flake8-datetimez
75+
"FA", # flake8-future-annotations
76+
"SIM", # flake8-simplify
77+
"TC", # flake8-type-checking
78+
"PERF", # Perflint
79+
"FURB", # refurb
80+
"RUF", # Ruff-specific rules
7881
]

tap_github/authenticator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from datetime import datetime, timedelta, timezone
99
from os import environ
1010
from random import choice, shuffle
11-
from typing import Any
11+
from typing import TYPE_CHECKING, Any
1212

1313
import jwt
1414
import requests
1515
from singer_sdk.authenticators import APIAuthenticatorBase
16-
from singer_sdk.streams import RESTStream
16+
17+
if TYPE_CHECKING:
18+
from singer_sdk.streams import RESTStream
1719

1820

1921
class TokenManager:
@@ -307,7 +309,7 @@ def prepare_tokens(self) -> list[TokenManager]:
307309
)
308310
if app_token_manager.is_valid_token():
309311
app_token_managers.append(app_token_manager)
310-
except ValueError as e:
312+
except ValueError as e: # noqa: PERF203
311313
self.logger.warning(
312314
f"An error was thrown while preparing an app token: {e}"
313315
)

tap_github/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
import random
88
import time
99
from types import FrameType
10-
from typing import Any, ClassVar, Iterable, cast
10+
from typing import TYPE_CHECKING, Any, ClassVar, cast
1111
from urllib.parse import parse_qs, urlparse
1212

13-
import requests
14-
from backoff.types import Details
1513
from dateutil.parser import parse
1614
from nested_lookup import nested_lookup
1715
from singer_sdk.exceptions import FatalAPIError, RetriableAPIError
@@ -20,6 +18,12 @@
2018

2119
from tap_github.authenticator import GitHubTokenAuthenticator
2220

21+
if TYPE_CHECKING:
22+
from collections.abc import Iterable
23+
24+
import requests
25+
from backoff.types import Details
26+
2327
EMPTY_REPO_ERROR_STATUS = 409
2428

2529

tap_github/organization_streams.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, ClassVar, Iterable
5+
from typing import TYPE_CHECKING, Any, ClassVar
66

77
from singer_sdk import typing as th # JSON Schema typing helpers
88

99
from tap_github.client import GitHubRestStream
1010

11+
if TYPE_CHECKING:
12+
from collections.abc import Iterable
13+
1114

1215
class OrganizationStream(GitHubRestStream):
1316
"""Defines a GitHub Organization Stream.

tap_github/repository_streams.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, ClassVar, Iterable
5+
from typing import TYPE_CHECKING, Any, ClassVar
66
from urllib.parse import parse_qs, urlparse
77

8-
import requests
98
from dateutil.parser import parse
109
from singer_sdk import typing as th # JSON Schema typing helpers
1110
from singer_sdk.exceptions import FatalAPIError
@@ -21,6 +20,11 @@
2120
)
2221
from tap_github.scraping import scrape_dependents, scrape_metrics
2322

23+
if TYPE_CHECKING:
24+
from collections.abc import Iterable
25+
26+
import requests
27+
2428

2529
class RepositoryStream(GitHubRestStream):
2630
"""Defines 'Repository' stream."""

tap_github/scraping.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
import re
1010
import time
1111
from datetime import datetime, timezone
12-
from typing import Any, Iterable, cast
12+
from typing import TYPE_CHECKING, Any, cast
1313
from urllib.parse import urlparse
1414

1515
import requests
16-
from bs4 import NavigableString, Tag
16+
17+
if TYPE_CHECKING:
18+
from collections.abc import Iterable
19+
20+
from bs4 import NavigableString, Tag
1721

1822
used_by_regex = re.compile(" {3}Used by ")
1923
contributors_regex = re.compile(" {3}Contributors ")
@@ -30,12 +34,7 @@ def scrape_dependents(
3034
# Navigate through Package toggle if present
3135
base_url = urlparse(response.url).hostname or "github.com"
3236
options = soup.find_all("a", class_="select-menu-item")
33-
links = []
34-
if len(options) > 0:
35-
for link in options:
36-
links.append(link["href"])
37-
else:
38-
links.append(response.url)
37+
links = [link["href"] for link in options] if len(options) > 0 else [response.url]
3938

4039
logger.debug(links)
4140

tap_github/streams.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from __future__ import annotations
22

33
from enum import Enum
4-
5-
from singer_sdk.streams.core import Stream
4+
from typing import TYPE_CHECKING
65

76
from tap_github.organization_streams import (
87
OrganizationStream,
@@ -52,6 +51,9 @@
5251
)
5352
from tap_github.user_streams import StarredStream, UserContributedToStream, UserStream
5453

54+
if TYPE_CHECKING:
55+
from singer_sdk.streams.core import Stream
56+
5557

5658
class Streams(Enum):
5759
"""

0 commit comments

Comments
 (0)