Skip to content
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
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- uv.lock
- .github/workflows/test.yml
pull_request:
types: [opened, synchronize, reopened]
paths:
- tap_socketdev/**
- tests/**
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,41 @@ 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`

### Builtin Settings

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

Expand Down
10 changes: 10 additions & 0 deletions noxfile.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env -S uv run --script

# /// script
# dependencies = ["nox"]
# ///

"""Nox configuration."""

from __future__ import annotations
Expand Down Expand Up @@ -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()
51 changes: 33 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand All @@ -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
28 changes: 16 additions & 12 deletions tap_socketdev/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 BasePageNumberPaginator
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

Expand Down Expand Up @@ -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"],
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -225,12 +229,12 @@ 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,
}

@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)
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.