Skip to content

Commit

Permalink
Merge branch 'main' into edgarrmondragon/feat/signals
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored Aug 26, 2024
2 parents b795525 + 3de2b98 commit ce5a41e
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
griffe==1.1.0
griffe==1.2.0
pip==24.2
poetry==1.8.3
poetry-plugin-export==1.8.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.29.1
rev: 0.29.2
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.2
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 @@ -3,7 +3,26 @@

name: Test {{cookiecutter.mapper_id}}

on: [push]
on:
push:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
pull_request:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
workflow_dispatch:

jobs:
pytest:
Expand All @@ -13,7 +32,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python {{ '${{ matrix.python-version }}' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@

name: Test {{cookiecutter.tap_id}}

on: [push]
on:
push:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
pull_request:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
workflow_dispatch:

jobs:
pytest:
Expand All @@ -13,7 +32,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python {{ '${{ matrix.python-version }}' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@

name: Test {{cookiecutter.target_id}}

on: [push]
on:
push:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
pull_request:
branches: [main]
paths:
- .github/workflows/test.yml
- {{ cookiecutter.library_name }}/**
- tests/**
- poetry.lock
- pyproject.toml
- tox.ini
workflow_dispatch:

jobs:
pytest:
Expand All @@ -13,7 +32,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python {{ '${{ matrix.python-version }}' }}
Expand Down
76 changes: 40 additions & 36 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pyarrow = { version = ">=13", optional = true }
pytest = {version=">=7.2.1", optional = true}

# installed as optional 'faker' extra
faker = {version = ">=22.5,<27.0", optional = true}
faker = {version = ">=22.5,<29.0", optional = true}

# Crypto extras
cryptography = { version = ">=3.4.6", optional = true }
Expand Down
20 changes: 11 additions & 9 deletions singer_sdk/sinks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def _after_process_record(self, context: dict) -> None:

# SDK developer overrides:

def preprocess_record(self, record: dict, context: dict) -> dict: # noqa: ARG002, PLR6301
def preprocess_record(self, record: dict, context: dict) -> dict: # noqa: PLR6301, ARG002
"""Process incoming record and return a modified result.
Args:
Expand Down Expand Up @@ -743,12 +743,15 @@ def process_batch_files(
tail,
mode="rb",
) as file:
context_file = (
gzip_open(file) if encoding.compression == "gzip" else file
)
context = {
"records": [deserialize_json(line) for line in context_file] # type: ignore[attr-defined]
}
if encoding.compression == "gzip":
with gzip_open(file) as context_file:
context = {
"records": [
deserialize_json(line) for line in context_file
]
}
else:
context = {"records": [deserialize_json(line) for line in file]}
self.process_batch(context)
elif (
importlib.util.find_spec("pyarrow")
Expand All @@ -760,8 +763,7 @@ def process_batch_files(
tail,
mode="rb",
) as file:
context_file = file
table = pq.read_table(context_file)
table = pq.read_table(file)
context = {"records": table.to_pylist()}
self.process_batch(context)
else:
Expand Down

0 comments on commit ce5a41e

Please sign in to comment.