Skip to content

Commit

Permalink
fix: Ensure transitive dependencies are not used
Browse files Browse the repository at this point in the history
edgarrmondragon committed Nov 29, 2023
1 parent 6d7da68 commit 9484ed9
Showing 6 changed files with 132 additions and 68 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/test-tap.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,19 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
include:
- python-version: "3.7"
toxenv: py37
- python-version: "3.8"
toxenv: py38
- python-version: "3.9"
toxenv: py39
- python-version: "3.10"
toxenv: py310
- python-version: "3.11"
toxenv: py311
- python-version: "3.11"
toxenv: deps

steps:
- name: Checkout code
@@ -30,15 +42,10 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Poetry
- name: Install Tox
run: |
pipx install poetry
poetry --version
- name: Install dependencies
run: |
poetry install
pipx install tox
- name: Test tap
run: |
poetry run pytest
tox -e ${{ matrix.toxenv }}
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -35,11 +35,7 @@ repos:
rev: v0.1.6
hooks:
- id: ruff

- repo: https://github.com/psf/black
rev: "23.11.0"
hooks:
- id: black
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
108 changes: 74 additions & 34 deletions poetry.lock

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

31 changes: 19 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -18,47 +18,54 @@ keywords = ["singer.io", "elt", "dbt", "singer-sdk"]

[tool.poetry.dependencies]
python = ">=3.7.1,<4"
pendulum = "~=2.1.2"
pyyaml = "~=6.0"
requests = "~=2.31.0"
singer-sdk = "~=0.33.0"

[tool.poetry.group.dev.dependencies]
deptry = { version = ">=0.8.0", python = ">=3.8" }
faker = ">=17.6"
pytest = "~=7.4"
responses = "~=0.23.1"

[tool.poetry.scripts]
tap-dbt = 'tap_dbt.tap:cli'

[tool.black]
[tool.ruff]
line-length = 88
src = ["tap_dbt", "tests"]
target-version = "py37"

[tool.ruff]
[tool.ruff.lint]
ignore = [
"ANN101", # missing-type-self
"FIX002", # line-contains-todo
"COM812", # missing-trailing-comma
"ISC001", # single-line-implicit-string-concatenation
]
line-length = 88
select = ["ALL"]
src = ["tap_dbt", "tests"]
target-version = "py37"
unfixable = [
"ERA001", # commented-out-code
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["tap_dbt"]
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["ANN201", "S101"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
src_paths = "tap_dbt"
[tool.deptry]
known_first_party = ["tap_dbt"]

[tool.deptry.package_module_name_map]
faker = "faker"
pytest = "pytest"
responses = "responses"

[tool.poetry-dynamic-versioning]
enable = true
12 changes: 4 additions & 8 deletions tap_dbt/streams.py
Original file line number Diff line number Diff line change
@@ -135,13 +135,9 @@ def get_records(self, context: dict | None) -> t.Iterable[dict[str, t.Any]]:
continue

if (
starting_replication_key_value is None
or record[self.replication_key] is None
): # FULL_TABLE
yield transformed_record

# When the first value lower than the bookmark is found, stop
else:
starting_replication_key_value is not None
and record[self.replication_key] is not None
):
record_last_received_datetime: pendulum.DateTime = cast(
pendulum.DateTime,
pendulum.parse(record[self.replication_key]),
@@ -155,7 +151,7 @@ def get_records(self, context: dict | None) -> t.Iterable[dict[str, t.Any]]:
)
break

yield transformed_record
yield transformed_record


class AccountsStream(DBTStream):
18 changes: 18 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tox]
requires =
tox>=4
env_list = py{37,38,39,310,311}, deps

[testenv]
deps =
faker
pytest
responses
commands =
pytest {posargs:tests}

[testenv:deps]
deps =
deptry
commands =
deptry {posargs:tap_dbt}

0 comments on commit 9484ed9

Please sign in to comment.