Skip to content

Commit

Permalink
Add back sync tests, update pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceCondor committed Jul 30, 2024
1 parent e8ed648 commit 469ee9f
Show file tree
Hide file tree
Showing 11 changed files with 2,550 additions and 404 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Ignore meltano internal cache and sqlite systemdb

.meltano/
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins:
config:
airbyte_spec:
image: "airbyte/source-pokeapi"
tag: "0.1.5"
tag: "0.2.10"
airbyte_config:
pokemon_name: smeargle
loaders:
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.9
python_version = 3.10
warn_unused_configs = True

[mypy-backoff.*]
Expand Down
396 changes: 40 additions & 356 deletions poetry.lock

Large diffs are not rendered by default.

78 changes: 51 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,68 @@
[tool.poetry]
name = "tap-airbyte"
version = "0.6.0"
description = "`tap-airbyte` is a Singer tap for Airbyte, built with the Meltano Singer SDK."
version = "0.6.1"
description = "Singer tap for Airbyte, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["Alex Butler"]
keywords = ["ELT", "Airbyte"]
license = "Apache 2.0"
keywords = [
"ELT",
"Airbyte",
]
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
license = "Apache-2.0"

[tool.poetry.dependencies]
python = "<3.12,>=3.8" # airbyte cdk is broken on 3.11 due to mutable defaults in dataclasses, go figure
requests = "^2.25.1"
singer-sdk = { version = "^0.38.0" }
fs-s3fs = { version = "^1.1.1", optional = true }
orjson = "^3.8.3"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"
tox = "^3.24.4"
flake8 = "^3.9.2"
black = ">=21"
pydocstyle = "^6.1.1"
mypy = "^0.910"
types-requests = "^2.26.1"
isort = "^5.10.1"
python = ">=3.8,<3.11"
importlib-resources = { version = "==6.4.*", python = "<3.9" }
singer-sdk = { version="~=0.38.0", extras = [] }
fs-s3fs = { version = "~=1.1.1", optional = true }
orjson = "^3.10.6"

[tool.poetry.group.dev.dependencies]
pytest = ">=8"
singer-sdk = { version="~=0.38.0", extras = ["testing"] }

[tool.poetry.extras]
s3 = ["fs-s3fs"]

[tool.mypy]
python_version = "3.10"
warn_unused_configs = true

[tool.ruff]
src = ["tap_airbyte"]
target-version = "py38"

[tool.ruff.lint]
ignore = [
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"COM812", # missing-trailing-comma
"ISC001", # single-line-implicit-string-concatenation
]
select = ["ALL"]

[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true

[tool.ruff.lint.isort]
known-first-party = ["tap_airbyte"]

[tool.black] # https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
line-length = 100
target-version = ["py39"]
target-version = ["py310"]
preview = true

[tool.isort] # https://pycqa.github.io/isort/docs/configuration/options.html
color_output = true
line_length = 100
profile = "black"
src_paths = "tap_airbyte"

[build-system]
requires = ["poetry-core>=1.0.8"]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
Expand Down
21 changes: 2 additions & 19 deletions tap_airbyte/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,6 @@ def to_command(
self, *airbyte_cmd: str, docker_args: t.Optional[t.List[str]] = None
) -> t.List[t.Union[str, Path]]:
"""Construct the command to run the Airbyte connector."""
test = (
[self.venv / ("Scripts" if sys.platform == "win32" else "bin") / self.source_name, *airbyte_cmd]
if self.is_native()
else [
"docker",
"run",
*(docker_args or []),
f"{self.image}:{self.tag}",
*airbyte_cmd,
]
)



return (
[self.venv / ("Scripts" if sys.platform == "win32" else "bin") / self.source_name, *airbyte_cmd]
if self.is_native()
Expand Down Expand Up @@ -529,10 +515,7 @@ def run_connection_test(self) -> bool:
def run_read(self) -> t.Iterator[subprocess.Popen]:
"""Run the read command for the Airbyte connector."""
with TemporaryDirectory() as host_tmpdir:
with (
open(f"{host_tmpdir}/config.json", "wb") as config,
open(f"{host_tmpdir}/catalog.json", "wb") as catalog,
):
with open(f"{host_tmpdir}/config.json", "wb") as config, open(f"{host_tmpdir}/catalog.json", "wb") as catalog:
config.write(orjson.dumps(self.config.get("airbyte_config", {})))
catalog.write(orjson.dumps(self.configured_airbyte_catalog))
if self.airbyte_state:
Expand Down Expand Up @@ -569,7 +552,7 @@ def run_read(self) -> t.Iterator[subprocess.Popen]:
self.logger.debug("Waiting for Airbyte process to terminate.")
returncode = proc.wait()
if not self.eof_received and TapAirbyte.pipe_status is not PIPE_CLOSED:
# If EOF was not received, the process was killed and we should raise an exception
# If EOF was not received, the process was killed, and we should raise an exception
type_, value, _ = sys.exc_info()
err = type_.__name__ if type_ else "UnknownError"
raise AirbyteException(f"Airbyte process terminated early:\n{err}: {value}")
Expand Down
Loading

0 comments on commit 469ee9f

Please sign in to comment.