Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support Python 3.13 #180

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ jobs:
fail-fast: false
matrix:
script: ["test:integration"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
include:
- { script: "test:dependencies", python-version: "3.12" }
- { script: "typing:check", python-version: "3.12" }
Expand All @@ -44,6 +50,7 @@ jobs:
id: setup-python
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip

- name: Upgrade pip
Expand All @@ -53,11 +60,12 @@ jobs:

- name: Install Hatch
run: |
pipx install --python '${{ steps.setup-python.outputs.python-path }}' hatch
pipx install hatch
hatch --version

- name: Run
env:
HATCH_PYTHON: ${{ matrix.python-version }}
TAP_NEON_API_KEY: ${{ secrets.TAP_NEON_API_KEY }}
run: |
hatch run ${{ matrix.script }}
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = [
"version",
]
dependencies = [
"requests>=2.26",
"singer-sdk~=0.38.0",
"singer-sdk~=0.39.0a1",
]
optional-dependencies.dev = [
"tap-neon[testing,typing]",
]
optional-dependencies.testing = [
"deptry>=0.12",
Expand All @@ -54,6 +58,17 @@ scripts."tap-neon" = "tap_neon.tap:TapNeon.cli"
[tool.hatch.version]
source = "vcs"

[tool.hatch.envs.default]
installer = "uv"

[tool.hatch.envs.default.env-vars]
UV_PRERELEASE = "allow"

[tool.hatch.envs.default.overrides]
env.GITHUB_ACTIONS.dev-mode = { value = false, if = [
"true",
] }

[tool.hatch.envs.sync.scripts]
console = "tap-neon {args}"
jsonl = "tap-neon {args} > tap-neon.jsonl"
Expand All @@ -75,6 +90,7 @@ python = [
"3.10",
"3.11",
"3.12",
"3.13",
]

[tool.hatch.envs.typing]
Expand Down Expand Up @@ -125,6 +141,9 @@ DEP002 = [
"pytest",
]

[tool.pyproject-fmt]
max_supported_python = "3.13"

[tool.pytest.ini_options]
addopts = "-vvv"

Expand Down
7 changes: 5 additions & 2 deletions tap_neon/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

from __future__ import annotations

from typing import Any
from typing import TYPE_CHECKING, Any

from singer_sdk import RESTStream
from singer_sdk.authenticators import BearerTokenAuthenticator

if TYPE_CHECKING:
from singer_sdk.helpers.types import Context


class NeonStream(RESTStream[str]):
"""Neon Serverless Postgres stream class."""
Expand Down Expand Up @@ -43,7 +46,7 @@ def http_headers(self) -> dict[str, str]:

def get_url_params(
self,
context: dict[str, Any] | None, # noqa: ARG002
context: Context[str, Any] | None, # noqa: ARG002
next_page_token: str | None,
) -> dict[str, Any]:
"""Get URL query parameters.
Expand Down
8 changes: 6 additions & 2 deletions tap_neon/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

from tap_neon.client import NeonStream

if t.TYPE_CHECKING:
from singer_sdk.helpers.types import Context


__all__ = [
"Projects",
"Operations",
Expand All @@ -29,7 +33,7 @@ class Projects(NeonStream):
def get_child_context(
self,
record: dict[str, t.Any],
context: dict[str, t.Any] | None, # noqa: ARG002
context: Context[str, t.Any] | None, # noqa: ARG002
) -> dict[str, t.Any]:
"""Return the child context for this record.

Expand Down Expand Up @@ -80,7 +84,7 @@ class Branches(NeonStream):
def get_child_context(
self,
record: dict[str, t.Any],
context: dict[str, t.Any] | None, # noqa: ARG002
context: Context[str, t.Any] | None, # noqa: ARG002
) -> dict[str, t.Any]:
"""Add branch_id to context.

Expand Down