From ceb2920d172efaddf5ca09b72a55a67f579f4608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Fri, 31 Jan 2025 10:24:30 -0600 Subject: [PATCH] chore: Update samples to use uv --- samples/aapl/README.md | 6 +-- .../.github/workflows/test.yml | 11 ++--- samples/sample_tap_dummy_json/.gitignore | 4 +- samples/sample_tap_dummy_json/README.md | 7 ++-- samples/sample_tap_dummy_json/pyproject.toml | 42 +++++++++++-------- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/samples/aapl/README.md b/samples/aapl/README.md index 943a31449..31394fa0b 100644 --- a/samples/aapl/README.md +++ b/samples/aapl/README.md @@ -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 ``` diff --git a/samples/sample_tap_dummy_json/.github/workflows/test.yml b/samples/sample_tap_dummy_json/.github/workflows/test.yml index 6e3d559c0..cdb9d1246 100644 --- a/samples/sample_tap_dummy_json/.github/workflows/test.yml +++ b/samples/sample_tap_dummy_json/.github/workflows/test.yml @@ -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 diff --git a/samples/sample_tap_dummy_json/.gitignore b/samples/sample_tap_dummy_json/.gitignore index 9fd224433..7fcac1ce6 100644 --- a/samples/sample_tap_dummy_json/.gitignore +++ b/samples/sample_tap_dummy_json/.gitignore @@ -1,5 +1,5 @@ -# Poetry -poetry.lock +# uv +uv.lock # Secrets and internal config files **/.secrets/* diff --git a/samples/sample_tap_dummy_json/README.md b/samples/sample_tap_dummy_json/README.md index 2cbea6852..b4c4bd318 100644 --- a/samples/sample_tap_dummy_json/README.md +++ b/samples/sample_tap_dummy_json/README.md @@ -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 @@ -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) diff --git a/samples/sample_tap_dummy_json/pyproject.toml b/samples/sample_tap_dummy_json/pyproject.toml index 4542c6448..2bcbc3f01 100644 --- a/samples/sample_tap_dummy_json/pyproject.toml +++ b/samples/sample_tap_dummy_json/pyproject.toml @@ -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 "] +authors = [{ name = "Edgar Ramírez-Mondragón", email = "edgar@arch.dev" }] keywords = [ "ELT", "DummyJSON", @@ -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"