Skip to content

Commit

Permalink
chore: Update samples to use uv
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 31, 2025
1 parent 7bbd2d9 commit ceb2920
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 32 deletions.
6 changes: 3 additions & 3 deletions samples/aapl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ This tap sample helps in evaluating the performance of catalog parsing and strea
## Execution

```shell
poetry run python samples/aapl
uv run python samples/aapl
```

Or if you want to trace the execution

```shell
poetry run viztracer samples/aapl/__main__.py
poetry run vizviewer result.json
uv run viztracer samples/aapl/__main__.py
uv run vizviewer result.json
```
11 changes: 6 additions & 5 deletions samples/sample_tap_dummy_json/.github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
pip install poetry
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: ">=0.5.19"
- name: Install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
- name: Test with pytest
run: |
poetry run pytest
uv run -p ${{ matrix.python-version }} pytest
4 changes: 2 additions & 2 deletions samples/sample_tap_dummy_json/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Poetry
poetry.lock
# uv
uv.lock

# Secrets and internal config files
**/.secrets/*
Expand Down
7 changes: 3 additions & 4 deletions samples/sample_tap_dummy_json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ Follow these instructions to contribute to this project.
### Initialize your Development Environment

```bash
pipx install poetry
poetry install
uv sync
```

### Create and Run Tests
Expand All @@ -86,13 +85,13 @@ Create tests within the `tests` subfolder and
then run:

```bash
poetry run pytest
uv run pytest
```

You can also test the `tap-dummyjson` CLI interface directly using `poetry run`:

```bash
poetry run tap-dummyjson --help
uv run tap-dummyjson --help
```

### Testing with [Meltano](https://www.meltano.com)
Expand Down
42 changes: 24 additions & 18 deletions samples/sample_tap_dummy_json/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tool.poetry]
[project]
name = "tap-dummyjson"
version = "0.0.1"
description = "Singer tap for DummyJSON, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["Edgar Ramírez-Mondragón <[email protected]>"]
authors = [{ name = "Edgar Ramírez-Mondragón", email = "[email protected]" }]
keywords = [
"ELT",
"DummyJSON",
Expand All @@ -18,27 +18,33 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.9"
dependencies = [
"requests~=2.32.3",
"singer-sdk",
]
optional-dependencies.s3 = [
"fs-s3fs~=1.1.1",
]

[tool.poetry.dependencies]
python = ">=3.9"
requests = "~=2.32.3"
singer-sdk = {path = "../..", develop = true}

[tool.poetry.group.dev.dependencies]
pytest = ">=8"
singer-sdk = {path = "../..", develop = true, extras = ["testing"]}
[project.scripts]
# CLI declaration
tap-dummyjson = 'tap_dummyjson.tap:TapDummyJSON.cli'

[tool.poetry.extras]
s3 = ["fs-s3fs"]
[dependency-groups]
dev = [
"pytest>=8",
"singer-sdk[testing]",
]

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

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.uv.sources]
singer-sdk = { path = "../../", editable = true }

[tool.poetry.scripts]
# CLI declaration
tap-dummyjson = 'tap_dummyjson.tap:TapDummyJSON.cli'
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

0 comments on commit ceb2920

Please sign in to comment.