Skip to content

Commit

Permalink
Merge branch 'main' into 1046-feat-faster-json-dumps-with-msgspec
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 12, 2024
2 parents 2fb541c + 544e275 commit 1c7de71
Show file tree
Hide file tree
Showing 39 changed files with 419 additions and 295 deletions.
16 changes: 14 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: daily
interval: weekly
time: "12:00"
reviewers: [meltano/engineering]
labels: [deps]
groups:
development-dependencies:
dependency-type: development
runtime-dependencies:
dependency-type: production
update-types:
- "minor"
- "patch"
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: weekly
time: "12:00"
reviewers: [meltano/engineering]
labels: [deps]
groups:
ci:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip==24.1
pip==24.1.2
poetry==1.8.3
poetry-plugin-export==1.8.0
poetry-dynamic-versioning==1.4.0
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ repos:
)$
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.5
rev: 0.29.0
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
rev: v0.5.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
interval: weekly
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
groups:
development-dependencies:
dependency-type: development
runtime-dependencies:
dependency-type: production
update-types:
- "patch"
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: weekly
commit-message:
prefix: "ci: "
groups:
ci:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
interval: weekly
commit-message:
prefix: "ci: "
groups:
actions:
patterns:
- "*"
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
- name: Publish
## TODO: create a trusted publisher on PyPI
## https://docs.pypi.org/trusted-publishers/
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ repos:
- id: trailing-whitespace

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
interval: weekly
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
groups:
development-dependencies:
dependency-type: development
runtime-dependencies:
dependency-type: production
update-types:
- "patch"
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: weekly
commit-message:
prefix: "ci: "
groups:
ci:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
interval: weekly
commit-message:
prefix: "ci: "
groups:
actions:
patterns:
- "*"
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
- name: Publish
## TODO: create a trusted publisher on PyPI
## https://docs.pypi.org/trusted-publishers/
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ repos:
- id: trailing-whitespace

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Iterable
from typing import TYPE_CHECKING, Iterable

import requests # noqa: TCH002
from singer_sdk.streams import {{ cookiecutter.stream_type }}Stream
Expand All @@ -12,6 +12,9 @@
from {{ cookiecutter.library_name }}.auth import {{ cookiecutter.source_name }}Authenticator
{%- endif %}

if TYPE_CHECKING:
from singer_sdk.helpers.types import Context


class {{ cookiecutter.source_name }}Stream({{ cookiecutter.stream_type }}Stream):
"""{{ cookiecutter.source_name }} stream class."""
Expand Down Expand Up @@ -67,7 +70,7 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]:
def post_process(
self,
row: dict,
context: dict | None = None, # noqa: ARG002
context: Context | None = None, # noqa: ARG002
) -> dict | None:
"""As needed, append or transform raw data to match expected structure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

from __future__ import annotations

from typing import Iterable
from typing import TYPE_CHECKING, Iterable

from singer_sdk.streams import Stream

if TYPE_CHECKING:
from singer_sdk.helpers.types import Context


class {{ cookiecutter.source_name }}Stream(Stream):
"""Stream class for {{ cookiecutter.source_name }} streams."""

def get_records(
self,
context: dict | None, # noqa: ARG002
context: Context | None, # noqa: ARG002
) -> Iterable[dict]:
"""Return a generator of record-type dictionary objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{%- if cookiecutter.auth_method in ("OAuth2", "JWT") %}
from functools import cached_property
{%- endif %}
from typing import Any, Callable, Iterable
from typing import TYPE_CHECKING, Any, Callable, Iterable

import requests
{% if cookiecutter.auth_method == "API Key" -%}
Expand Down Expand Up @@ -46,6 +46,10 @@
else:
import importlib_resources

if TYPE_CHECKING:
from singer_sdk.helpers.types import Context


_Auth = Callable[[requests.PreparedRequest], requests.PreparedRequest]

# TODO: Delete this is if not using json files for schema definition
Expand All @@ -55,17 +59,18 @@
class {{ cookiecutter.source_name }}Stream({{ cookiecutter.stream_type }}Stream):
"""{{ cookiecutter.source_name }} stream class."""

# Update this value if necessary or override `parse_response`.
records_jsonpath = "$[*]"

# Update this value if necessary or override `get_new_paginator`.
next_page_token_jsonpath = "$.next_page" # noqa: S105

@property
def url_base(self) -> str:
"""Return the API URL root, configurable via tap settings."""
# TODO: hardcode a value here, or retrieve it from self.config
return "https://api.mysample.com"

records_jsonpath = "$[*]" # Or override `parse_response`.

# Set this value or override `get_new_paginator`.
next_page_token_jsonpath = "$.next_page" # noqa: S105

{%- if cookiecutter.auth_method in ("OAuth2", "JWT") %}

@cached_property
Expand Down Expand Up @@ -156,7 +161,7 @@ def get_new_paginator(self) -> BaseAPIPaginator:

def get_url_params(
self,
context: dict | None, # noqa: ARG002
context: Context | None, # noqa: ARG002
next_page_token: Any | None, # noqa: ANN401
) -> dict[str, Any]:
"""Return a dictionary of values to be used in URL parameterization.
Expand All @@ -178,7 +183,7 @@ def get_url_params(

def prepare_request_payload(
self,
context: dict | None, # noqa: ARG002
context: Context | None, # noqa: ARG002
next_page_token: Any | None, # noqa: ARG002, ANN401
) -> dict | None:
"""Prepare the data payload for the REST API request.
Expand Down Expand Up @@ -210,7 +215,7 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]:
def post_process(
self,
row: dict,
context: dict | None = None, # noqa: ARG002
context: Context | None = None, # noqa: ARG002
) -> dict | None:
"""As needed, append or transform raw data to match expected structure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
interval: weekly
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
groups:
development-dependencies:
dependency-type: development
runtime-dependencies:
dependency-type: production
update-types:
- "patch"
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
interval: weekly
commit-message:
prefix: "ci: "
groups:
ci:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
interval: weekly
commit-message:
prefix: "ci: "
groups:
actions:
patterns:
- "*"
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
- name: Publish
## TODO: create a trusted publisher on PyPI
## https://docs.pypi.org/trusted-publishers/
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ repos:
- id: trailing-whitespace

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import annotations

import sys
from datetime import datetime
from pathlib import Path

sys.path.insert(0, str(Path("..").resolve()))
Expand All @@ -23,7 +24,7 @@
# -- Project information -----------------------------------------------------

project = "Meltano Singer SDK"
copyright = "2021, Meltano Core Team and Contributors" # noqa: A001
copyright = f"{datetime.now().year}, Arch Data, Inc and Contributors" # noqa: A001, DTZ005
author = "Meltano Core Team and Contributors"

# The full version, including alpha/beta/rc tags
Expand Down
Loading

0 comments on commit 1c7de71

Please sign in to comment.