Skip to content

Commit b7615f4

Browse files
committed
chore: upgrade Python version requirements to 3.9 and update related configurations
1 parent 20b02ae commit b7615f4

File tree

7 files changed

+22
-27
lines changed

7 files changed

+22
-27
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
16+
python-version: ['3.9', '3.10', '3.11', '3.12']
1717

1818
steps:
1919
- name: Checkout code

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
3.8
1+
3.9
22

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# authkit-token
22

3-
[![pypi version](https://img.shields.io/pypi/v/authkit-token)](https://pypi.org/project/authkit-token)
3+
[![pypi version](https://img.shields.io/pypi/v/authkit-token)](https://pypi.org/project/authkit-token) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
44

55
Secure token generation for [Pica AuthKit](https://docs.picaos.com/docs/authkit) using Python.
66

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "authkit-token"
77
version = "1.0.0"
88
description = "Secure token generation for Pica AuthKit"
99
readme = "README.md"
10-
requires-python = ">=3.8"
10+
requires-python = ">=3.9"
1111
license = { text = "GPL-3.0" }
1212
authors = [{ name = "@picahq" }]
1313
keywords = ["pica", "integrations", "authkit"]
@@ -16,7 +16,6 @@ classifiers = [
1616
"Intended Audience :: Developers",
1717
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
1818
"Programming Language :: Python :: 3",
19-
"Programming Language :: Python :: 3.8",
2019
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
@@ -55,14 +54,14 @@ addopts = "--cov=authkit_token --cov-report=term-missing"
5554

5655
[tool.black]
5756
line-length = 100
58-
target-version = ["py38"]
57+
target-version = ["py39"]
5958

6059
[tool.ruff]
6160
line-length = 100
62-
target-version = "py38"
61+
target-version = "py39"
6362

6463
[tool.mypy]
65-
python_version = "3.8"
64+
python_version = "3.9"
6665
warn_return_any = true
6766
warn_unused_configs = true
6867
disallow_untyped_defs = true

src/authkit_token/api.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""API functions for interacting with Pica AuthKit."""
22

33
import asyncio
4-
from typing import Dict, List, Optional
4+
from typing import Optional, cast
55

66
import httpx
77

@@ -10,7 +10,7 @@
1010

1111
async def _paginate_authkit_connections_async(
1212
url: str,
13-
headers: Dict[str, str],
13+
headers: dict[str, str],
1414
payload: Optional[CreateEventLinkPayload] = None,
1515
options: Optional[ConnectorPaginationOptions] = None,
1616
) -> AuthkitResponse:
@@ -44,7 +44,7 @@ async def fetch_authkit_page(
4444
headers=headers,
4545
)
4646
response.raise_for_status()
47-
return response.json()
47+
return cast(AuthkitResponse, response.json())
4848

4949
async def fetch_page_with_retry(client: httpx.AsyncClient, page: int) -> AuthkitResponse:
5050
"""Fetch a page with retry logic."""
@@ -77,7 +77,7 @@ async def fetch_page_with_retry(client: httpx.AsyncClient, page: int) -> Authkit
7777
remaining_pages = list(range(2, pages + 1))
7878

7979
# Execute requests in batches to avoid overwhelming the API
80-
responses: List[AuthkitResponse] = [first_response]
80+
responses: list[AuthkitResponse] = [first_response]
8181

8282
for i in range(0, len(remaining_pages), max_concurrent_requests):
8383
batch = remaining_pages[i : i + max_concurrent_requests]
@@ -109,7 +109,7 @@ async def fetch_page_with_retry(client: httpx.AsyncClient, page: int) -> Authkit
109109

110110
def _paginate_authkit_connections_sync(
111111
url: str,
112-
headers: Dict[str, str],
112+
headers: dict[str, str],
113113
payload: Optional[CreateEventLinkPayload] = None,
114114
options: Optional[ConnectorPaginationOptions] = None,
115115
) -> AuthkitResponse:
@@ -140,7 +140,7 @@ def fetch_authkit_page(client: httpx.Client, page: int, page_limit: int) -> Auth
140140
headers=headers,
141141
)
142142
response.raise_for_status()
143-
return response.json()
143+
return cast(AuthkitResponse, response.json())
144144

145145
def fetch_page_with_retry(client: httpx.Client, page: int) -> AuthkitResponse:
146146
"""Fetch a page with retry logic."""
@@ -175,7 +175,7 @@ def fetch_page_with_retry(client: httpx.Client, page: int) -> AuthkitResponse:
175175
remaining_pages = list(range(2, pages + 1))
176176

177177
# Fetch remaining pages sequentially (no concurrent requests in sync mode)
178-
responses: List[AuthkitResponse] = [first_response]
178+
responses: list[AuthkitResponse] = [first_response]
179179

180180
for page in remaining_pages:
181181
try:
@@ -203,7 +203,7 @@ def fetch_page_with_retry(client: httpx.Client, page: int) -> AuthkitResponse:
203203

204204

205205
async def create_event_link_token_async(
206-
headers: Dict[str, str],
206+
headers: dict[str, str],
207207
url: str,
208208
payload: Optional[CreateEventLinkPayload] = None,
209209
) -> Optional[AuthkitResponse]:
@@ -226,13 +226,13 @@ async def create_event_link_token_async(
226226
return authkit_response
227227
except httpx.HTTPStatusError as error:
228228
# Return error response data if available
229-
return error.response.json() if error.response else None
229+
return cast(AuthkitResponse, error.response.json()) if error.response else None
230230
except Exception:
231231
return None
232232

233233

234234
def create_event_link_token_sync(
235-
headers: Dict[str, str],
235+
headers: dict[str, str],
236236
url: str,
237237
payload: Optional[CreateEventLinkPayload] = None,
238238
) -> Optional[AuthkitResponse]:
@@ -255,7 +255,7 @@ def create_event_link_token_sync(
255255
return authkit_response
256256
except httpx.HTTPStatusError as error:
257257
# Return error response data if available
258-
return error.response.json() if error.response else None
258+
return cast(AuthkitResponse, error.response.json()) if error.response else None
259259
except Exception:
260260
return None
261261

src/authkit_token/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"""Utility functions for authkit-token package."""
22

3-
from typing import Dict
43

5-
6-
def get_headers(secret: str) -> Dict[str, str]:
4+
def get_headers(secret: str) -> dict[str, str]:
75
"""
86
Generate request headers with the API secret.
97

tests/test_client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Tests for the AuthKitToken client."""
22

3-
from typing import Dict, List
4-
53
import pytest
64
from pytest_httpx import HTTPXMock
75

@@ -39,7 +37,7 @@ def mock_authkit_response() -> dict:
3937

4038

4139
@pytest.fixture
42-
def mock_authkit_paginated_response() -> List[Dict]:
40+
def mock_authkit_paginated_response() -> list[dict]:
4341
"""Mock paginated response from authkit API."""
4442
return [
4543
{
@@ -159,7 +157,7 @@ def test_create_sync_with_identity(
159157
assert request.headers["Content-Type"] == "application/json"
160158

161159
def test_create_sync_pagination(
162-
self, httpx_mock: HTTPXMock, mock_authkit_paginated_response: List[Dict]
160+
self, httpx_mock: HTTPXMock, mock_authkit_paginated_response: list[dict]
163161
) -> None:
164162
"""Test synchronous token creation with pagination."""
165163
# Mock all three pages
@@ -219,7 +217,7 @@ async def test_create_async_with_identity(
219217

220218
@pytest.mark.asyncio
221219
async def test_create_async_pagination(
222-
self, httpx_mock: HTTPXMock, mock_authkit_paginated_response: List[Dict]
220+
self, httpx_mock: HTTPXMock, mock_authkit_paginated_response: list[dict]
223221
) -> None:
224222
"""Test asynchronous token creation with pagination."""
225223
# Mock all three pages

0 commit comments

Comments
 (0)