Skip to content

Commit

Permalink
Merge branch 'main' into 1882-bug-a-field-referencing-record-in-strea…
Browse files Browse the repository at this point in the history
…ms-maps-gets-incorrectly-mapped-to-a-string-type-in-the-schema
  • Loading branch information
edgarrmondragon authored Aug 3, 2023
2 parents 94f6048 + 6ce7eab commit ea94070
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- id: check-readthedocs

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.280
rev: v0.0.282
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand All @@ -64,7 +64,7 @@ repos:
)$
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
rev: 0.23.3
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.269
rev: v0.0.282
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class {{ cookiecutter.source_name }}Stream({{ cookiecutter.stream_type }}Stream)
def get_url_params(
self,
context: dict | None, # noqa: ARG002
next_page_token: Any | None,
next_page_token: Any | None, # noqa: ANN401
) -> dict[str, Any]:
"""Return a dictionary of values to be used in URL parameterization.

Expand All @@ -181,7 +181,7 @@ class {{ cookiecutter.source_name }}Stream({{ cookiecutter.stream_type }}Stream)
def prepare_request_payload(
self,
context: dict | None, # noqa: ARG002
next_page_token: Any | None, # noqa: ARG002
next_page_token: Any | None, # noqa: ARG002, ANN401
) -> dict | None:
"""Prepare the data payload for the REST API request.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import typing as t
from pathlib import Path

from singer_sdk import typing as th # JSON Schema typing helpers
Expand Down Expand Up @@ -54,7 +55,7 @@ class UsersStream({{ cookiecutter.source_name }}Stream):
),
),
).to_dict()
primary_keys = ["id"]
primary_keys: t.ClassVar[list[str]] = ["id"]
replication_key = None
graphql_query = """
users {
Expand All @@ -81,7 +82,7 @@ class GroupsStream({{ cookiecutter.source_name }}Stream):
th.Property("id", th.StringType),
th.Property("modified", th.DateTimeType),
).to_dict()
primary_keys = ["id"]
primary_keys: t.ClassVar[list[str]] = ["id"]
replication_key = "modified"
graphql_query = """
groups {
Expand All @@ -104,7 +105,7 @@ class UsersStream({{ cookiecutter.source_name }}Stream):
{%- if cookiecutter.stream_type == "REST" %}
path = "/users"
{%- endif %}
primary_keys = ["id"]
primary_keys: t.ClassVar[list[str]] = ["id"]
replication_key = None
# Optionally, you may also use `schema_filepath` in place of `schema`:
# schema_filepath = SCHEMAS_DIR / "users.json" # noqa: ERA001
Expand Down Expand Up @@ -143,7 +144,7 @@ class GroupsStream({{ cookiecutter.source_name }}Stream):
{%- if cookiecutter.stream_type == "REST" %}
path = "/groups"
{%- endif %}
primary_keys = ["id"]
primary_keys: t.ClassVar[list[str]] = ["id"]
replication_key = "modified"
schema = th.PropertiesList(
th.Property("name", th.StringType),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
rev: 0.23.3
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.269
rev: v0.0.282
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
7 changes: 4 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import glob
import os
import shutil
import sys
Expand All @@ -23,9 +22,11 @@

RUFF_OVERRIDES = """\
extend = "./pyproject.toml"
extend-ignore = ["TD002", "TD003"]
extend-ignore = ["TD002", "TD003", "FIX002"]
"""

COOKIECUTTER_REPLAY_FILES = list(Path("./e2e-tests/cookiecutters").glob("*.json"))

package = "singer_sdk"
python_versions = ["3.11", "3.10", "3.9", "3.8", "3.7"]
main_python_version = "3.10"
Expand Down Expand Up @@ -185,7 +186,7 @@ def docs_serve(session: Session) -> None:
session.run("sphinx-autobuild", *args)


@nox.parametrize("replay_file_path", glob.glob("./e2e-tests/cookiecutters/*.json"))
@nox.parametrize("replay_file_path", COOKIECUTTER_REPLAY_FILES)
@session(python=main_python_version)
def test_cookiecutter(session: Session, replay_file_path) -> None:
"""Uses the tap template to build an empty cookiecutter.
Expand Down
48 changes: 24 additions & 24 deletions poetry.lock

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

4 changes: 3 additions & 1 deletion singer_sdk/testing/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ def target_input(self) -> t.IO[str]:
if self.input_io:
self._input = self.input_io
elif self.input_filepath:
self._input = Path(self.input_filepath).open(encoding="utf8")
self._input = Path(self.input_filepath).open( # noqa: SIM115
encoding="utf8",
)
return t.cast(t.IO[str], self._input)

@target_input.setter
Expand Down

0 comments on commit ea94070

Please sign in to comment.