From d14141cd28117d7e5481ec3ba83c0508601d806b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Mon, 9 Mar 2026 22:10:47 -0600 Subject: [PATCH 1/2] refactor: `BasePageNumberPaginator` -> `PageNumberPaginator` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edgar Ramírez Mondragón --- tap_socketdev/streams.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tap_socketdev/streams.py b/tap_socketdev/streams.py index 49ffd70..a2cce86 100644 --- a/tap_socketdev/streams.py +++ b/tap_socketdev/streams.py @@ -6,7 +6,7 @@ from typing import override from singer_sdk import typing as th -from singer_sdk.pagination import BasePageNumberPaginator +from singer_sdk.pagination import PageNumberPaginator from tap_socketdev.client import SocketDevStream @@ -232,5 +232,5 @@ def get_url_params( } @override - def get_new_paginator(self) -> BasePageNumberPaginator | None: - return BasePageNumberPaginator(start_value=1) + def get_new_paginator(self) -> PageNumberPaginator | None: + return PageNumberPaginator(start_value=1) From c22d1bdf2f748aadb0d96b3727c7be813d81e8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Mon, 9 Mar 2026 22:21:35 -0600 Subject: [PATCH 2/2] refactor: Modernize further MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edgar Ramírez Mondragón --- .github/workflows/test.yml | 1 - .pre-commit-config.yaml | 5 ++++ README.md | 46 +++++++++++++++++----------------- noxfile.py | 10 ++++++++ pyproject.toml | 51 ++++++++++++++++++++++++-------------- tap_socketdev/streams.py | 22 +++++++++------- uv.lock | 8 +++--- 7 files changed, 88 insertions(+), 55 deletions(-) mode change 100644 => 100755 noxfile.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7294948..b6e36f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,6 @@ on: - uv.lock - .github/workflows/test.yml pull_request: - types: [opened, synchronize, reopened] paths: - tap_socketdev/** - tests/** diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c135fc..0dd3021 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,3 +49,8 @@ repos: hooks: - id: uv-lock - id: uv-sync + + - repo: https://github.com/hukkin/mdformat + rev: 1.0.0 + hooks: + - id: mdformat diff --git a/README.md b/README.md index 09414ff..0a924f2 100644 --- a/README.md +++ b/README.md @@ -28,18 +28,18 @@ Built with the [Meltano Tap SDK](https://sdk.meltano.com) for Singer Taps. ## Capabilities -* `catalog` -* `state` -* `discover` -* `about` -* `stream-maps` +- `catalog` +- `state` +- `discover` +- `about` +- `stream-maps` ## Settings -| Setting | Required | Default | Description | +| Setting | Required | Default | Description | | :--------- | :------- | :------ | :--------------------------------- | -| api_key | True | None | API Key for Socket | -| start_date | False | None | Earliest datetime to get data from | +| api_key | True | None | API Key for Socket | +| start_date | False | None | Earliest datetime to get data from | A full list of supported settings and capabilities is available by running: `tap-socketdev --about` @@ -47,22 +47,22 @@ A full list of supported settings and capabilities is available by running: `tap The following settings are available to all taps. -| Setting | Required | Default | Description | +| Setting | Required | Default | Description | | :-------------------------------- | :------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). | -| stream_map_config | False | None | User-defined config values to be used within map expressions. | -| faker_config | False | None | Config for the [`Faker`](https://faker.readthedocs.io/en/master/) instance variable `fake` used within map expressions. Only applicable if the plugin specifies `faker` as an additional dependency (through the `singer-sdk` `faker` extra or directly). | -| faker_config.seed | False | None | Value to seed the Faker generator for deterministic output: https://faker.readthedocs.io/en/master/#seeding-the-generator | -| faker_config.locale | False | None | One or more LCID locale strings to produce localized output for: https://faker.readthedocs.io/en/master/#localization | -| flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. | -| flattening_max_depth | False | None | The max depth to flatten schemas. | -| batch_config | False | None | Configuration for BATCH message capabilities. | -| batch_config.encoding | False | None | Specifies the format and compression of the batch files. | -| batch_config.encoding.format | False | None | Format to use for batch files. | -| batch_config.encoding.compression | False | None | Compression format to use for batch files. | -| batch_config.storage | False | None | Defines the storage layer to use when writing batch files | -| batch_config.storage.root | False | None | Root path to use when writing batch files. | -| batch_config.storage.prefix | False | None | Prefix to use when writing batch files. | +| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). | +| stream_map_config | False | None | User-defined config values to be used within map expressions. | +| faker_config | False | None | Config for the [`Faker`](https://faker.readthedocs.io/en/master/) instance variable `fake` used within map expressions. Only applicable if the plugin specifies `faker` as an additional dependency (through the `singer-sdk` `faker` extra or directly). | +| faker_config.seed | False | None | Value to seed the Faker generator for deterministic output: https://faker.readthedocs.io/en/master/#seeding-the-generator | +| faker_config.locale | False | None | One or more LCID locale strings to produce localized output for: https://faker.readthedocs.io/en/master/#localization | +| flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. | +| flattening_max_depth | False | None | The max depth to flatten schemas. | +| batch_config | False | None | Configuration for BATCH message capabilities. | +| batch_config.encoding | False | None | Specifies the format and compression of the batch files. | +| batch_config.encoding.format | False | None | Format to use for batch files. | +| batch_config.encoding.compression | False | None | Compression format to use for batch files. | +| batch_config.storage | False | None | Defines the storage layer to use when writing batch files | +| batch_config.storage.root | False | None | Root path to use when writing batch files. | +| batch_config.storage.prefix | False | None | Prefix to use when writing batch files. | ### Source Authentication and Authorization diff --git a/noxfile.py b/noxfile.py old mode 100644 new mode 100755 index 412c0c6..b20d64c --- a/noxfile.py +++ b/noxfile.py @@ -1,3 +1,9 @@ +#!/usr/bin/env -S uv run --script + +# /// script +# dependencies = ["nox"] +# /// + """Nox configuration.""" from __future__ import annotations @@ -72,3 +78,7 @@ def ty(session: nox.Session) -> None: ) args = session.posargs or ("tap_socketdev", "tests") session.run("ty", "check", *args) + + +if __name__ == "__main__": + nox.main() diff --git a/pyproject.toml b/pyproject.toml index 661f76a..ed07569 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ keywords = [ "Socket", ] license = "Apache-2.0" -authors = [ { name = "Edgar Ramírez-Mondragón", email = "edgarrm358@gmail.com" } ] requires-python = ">=3.12" classifiers = [ "License :: OSI Approved :: Apache Software License", @@ -29,10 +28,15 @@ dependencies = [ "requests~=2.32.0", "singer-sdk~=0.54.0a4", ] -urls.Documentation = "https://github.com/reservoir-data/tap-socketdev#readme" -urls.Homepage = "https://github.com/reservoir-data/tap-socketdev" -urls.Repository = "https://github.com/reservoir-data/tap-socketdev" -scripts.tap-socketdev = "tap_socketdev.tap:TapSocketDev.cli" +[[project.authors]] +name = "Edgar Ramírez-Mondragón" +email = "edgarrm358@gmail.com" +[project.scripts] +tap-socketdev = "tap_socketdev.tap:TapSocketDev.cli" +[project.urls] +Documentation = "https://github.com/reservoir-data/tap-socketdev#readme" +Homepage = "https://github.com/reservoir-data/tap-socketdev" +Repository = "https://github.com/reservoir-data/tap-socketdev" [dependency-groups] dev = [ @@ -47,50 +51,61 @@ testing = [ "singer-sdk[testing]", ] typing = [ - "mypy>=1.8", - "ty>=0.0.1a18", + "mypy>=1.9", + "ty>=0.0.21", "types-requests~=2.32.0", ] [tool.hatch] -version.source = "vcs" +[tool.hatch.version] +source = "vcs" [tool.ruff] line-length = 88 -lint.select = [ +[tool.ruff.lint] +select = [ "ALL", ] -lint.ignore = [ +ignore = [ "COM812", # missing-trailing-comma "DJ", # flake8-django "FIX002", # line-contains-todo "ISC001", # single-line-implicit-string-concatenation ] -lint.per-file-ignores."noxfile.py" = [ +per-file-ignores."noxfile.py" = [ "ANN", ] -lint.per-file-ignores."tests/*" = [ +per-file-ignores."tests/*" = [ "ANN201", # missing-return-type-public-function "INP001", # implicit-namespace-package "S101", # assert "SLF001", # private-member-access ] -lint.unfixable = [ +unfixable = [ "ERA001", # commented-out-code ] -lint.flake8-annotations.allow-star-arg-any = true -lint.isort.required-imports = [ +flake8-annotations.allow-star-arg-any = true +isort.required-imports = [ "from __future__ import annotations", ] -lint.pydocstyle.convention = "google" +pydocstyle.convention = "google" [tool.pyproject-fmt] -max_supported_python = "3.14" +table_format = "long" [tool.pytest] -ini_options.addopts = "-vvv" +addopts = [ "-vvv", "-ra", "--strict-config", "--strict-markers" ] +filterwarnings = [ "error" ] +log_level = "INFO" +minversion = "9" +strict = true +testpaths = [ "tests" ] +xfail_strict = true [tool.mypy] +enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ] +strict = true warn_redundant_casts = true +warn_unreachable = true warn_unused_configs = true warn_unused_ignores = true diff --git a/tap_socketdev/streams.py b/tap_socketdev/streams.py index a2cce86..af72c75 100644 --- a/tap_socketdev/streams.py +++ b/tap_socketdev/streams.py @@ -2,15 +2,16 @@ from __future__ import annotations -import typing as t -from typing import override +from typing import TYPE_CHECKING, Any, override from singer_sdk import typing as th from singer_sdk.pagination import PageNumberPaginator from tap_socketdev.client import SocketDevStream -if t.TYPE_CHECKING: +if TYPE_CHECKING: + from collections.abc import Generator, Iterable + from requests import Response from singer_sdk.helpers.types import Context @@ -70,15 +71,18 @@ class Organizations(SocketDevStream): ).to_dict() @override - def parse_response(self, response: Response) -> t.Generator[dict, None, None]: + def parse_response( + self, + response: Response, + ) -> Generator[dict[str, Any], None, None]: yield from response.json()["organizations"].values() @override def generate_child_contexts( self, - record: dict[str, t.Any], + record: dict[str, Any], context: Context | None, - ) -> t.Iterable[Context | None]: + ) -> Iterable[Context | None]: yield { "org_slug": record["slug"], } @@ -165,7 +169,7 @@ def get_url_params( self, context: Context | None, next_page_token: int | None, - ) -> dict[str, t.Any] | str: + ) -> dict[str, Any] | str: return { "page": next_page_token, "per_page": 100, @@ -198,7 +202,7 @@ class RepoLabels(SocketDevStream): ), th.Property( "repository_ids", - th.ArrayType(th.StringType), # ty: ignore[invalid-argument-type] + th.ArrayType(th.StringType), description="The IDs of repositories this label is associated with", ), th.Property( @@ -225,7 +229,7 @@ def get_url_params( self, context: Context | None, next_page_token: int | None, - ) -> dict[str, t.Any] | str: + ) -> dict[str, Any] | str: return { "page": next_page_token, "per_page": 100, diff --git a/uv.lock b/uv.lock index 5de03f2..0124f13 100644 --- a/uv.lock +++ b/uv.lock @@ -729,10 +729,10 @@ requires-dist = [ [package.metadata.requires-dev] ci = [{ name = "pytest-github-actions-annotate-failures", specifier = ">=0.3" }] dev = [ - { name = "mypy", specifier = ">=1.8" }, + { name = "mypy", specifier = ">=1.9" }, { name = "pytest", specifier = "~=9.0" }, { name = "singer-sdk", extras = ["testing"] }, - { name = "ty", specifier = ">=0.0.1a18" }, + { name = "ty", specifier = ">=0.0.21" }, { name = "types-requests", specifier = "~=2.32.0" }, ] testing = [ @@ -740,8 +740,8 @@ testing = [ { name = "singer-sdk", extras = ["testing"] }, ] typing = [ - { name = "mypy", specifier = ">=1.8" }, - { name = "ty", specifier = ">=0.0.1a18" }, + { name = "mypy", specifier = ">=1.9" }, + { name = "ty", specifier = ">=0.0.21" }, { name = "types-requests", specifier = "~=2.32.0" }, ]