Skip to content

Commit

Permalink
refactor(templates): Use tox without installing Poetry explicitly in …
Browse files Browse the repository at this point in the history
…workflows (#2696)

* refactor(templates): Use tox without installing Poetry explicitly in workflows

* Fix YAML template
  • Loading branch information
edgarrmondragon authored Oct 2, 2024
1 parent 1442536 commit eb48cf6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
- run: pipx install tox
- name: Run Tox
run: |
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
poetry run pytest
tox -e $(echo py{{ '${{ matrix.python-version }}' }} | tr -d .)
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
- run: pipx install tox
- name: Run Tox
run: |
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
poetry run pytest
tox -e $(echo py{{ '${{ matrix.python-version }}' }} | tr -d .)
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
- run: pipx install tox
- name: Run Tox
run: |
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
poetry run pytest
tox -e $(echo py{{ '${{ matrix.python-version }}' }} | tr -d .)
5 changes: 5 additions & 0 deletions samples/sample_tap_csv/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Stream class for CSV files."""

from __future__ import annotations

import csv
Expand All @@ -18,9 +20,11 @@ class CSVStream(FileStream):

@property
def primary_keys(self) -> t.Sequence[str]:
"""Return the primary key fields for records in this stream."""
return (SDC_META_FILEPATH, SDC_META_LINE_NUMBER)

def get_schema(self, path: str) -> dict[str, t.Any]:
"""Return a schema for the given file."""
with self.filesystem.open(path, mode="r") as file:
reader = csv.DictReader(
file,
Expand All @@ -38,6 +42,7 @@ def get_schema(self, path: str) -> dict[str, t.Any]:
return schema

def read_file(self, path: str) -> t.Iterable[Record]:
"""Read the given file and emit records."""
with self.filesystem.open(path, mode="r") as file:
reader = csv.DictReader(
file,
Expand Down

0 comments on commit eb48cf6

Please sign in to comment.