Skip to content

Commit

Permalink
fix: Use uv in tap, target and mapper templates
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 31, 2025
1 parent 6dc84d6 commit f04ab25
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 92 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ jobs:

- uses: astral-sh/setup-uv@v5
with:
version: ">=0.4.30"

- name: Install Poetry
env:
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
uv tool install poetry
poetry --version
version: ">=0.5.19"

- uses: actions/setup-python@v5
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,35 @@ classifiers = [
license = "Apache-2.0"
license-files = [ "LICENSE" ]
requires-python = ">=3.9"
dynamic = ["dependencies"]
dependencies = [
{%- if cookiecutter.faker_extra %}
"singer-sdk[faker]~=0.44.1",
{%- else %}
"singer-sdk~=0.44.1",
{%- endif %}
]

[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
[project.optional-dependencies]
s3 = [
"fs-s3fs~=1.1.1",
]
{%- endif %}

[tool.poetry.dependencies]
singer-sdk = { version="~=0.44.1"{{ ', extras = ["faker"]' if cookiecutter.faker_extra }} }
fs-s3fs = { version = "~=1.1.1", optional = true }
[project.scripts]
# CLI declaration
{{cookiecutter.mapper_id}} = '{{cookiecutter.library_name}}.mapper:{{cookiecutter.name}}Mapper.cli'

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

[tool.poetry.extras]
s3 = ["fs-s3fs"]
{%- if cookiecutter.variant != "None (Skip)" %}
[tool.hatch.build.targets.wheel]
packages = [
"{{cookiecutter.library_name}}",
]
{%- endif %}

[tool.pytest.ini_options]
addopts = [
Expand All @@ -55,9 +65,6 @@ addopts = [
python_version = "3.12"
warn_unused_configs = true

[tool.ruff]
target-version = "py39"

[tool.ruff.lint]
ignore = [
"COM812", # missing-trailing-comma
Expand All @@ -71,9 +78,7 @@ allow-star-arg-any = true
convention = "google"

[build-system]
requires = ["poetry-core>=2,<3"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
# CLI declaration
{{cookiecutter.mapper_id}} = '{{cookiecutter.library_name}}.mapper:{{cookiecutter.name}}Mapper.cli'
requires = [
"hatchling>=1,<2",
]
build-backend = "hatchling.build"
71 changes: 38 additions & 33 deletions cookiecutter/tap-template/{{cookiecutter.tap_id}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{%- set extras = [] -%}
{%- if cookiecutter.faker_extra -%}{%- set extras = extras + ["faker"] -%}{%- endif -%}
{%- if cookiecutter.auth_method == "JWT" -%}{%- set extras = extras + ["jwt"] -%}{%- endif -%}

[project]
{%- if cookiecutter.variant != "None (Skip)" %}
name = "{{cookiecutter.variant}}-{{cookiecutter.tap_id}}"
Expand Down Expand Up @@ -25,38 +29,41 @@ classifiers = [
license = "Apache-2.0"
license-files = [ "LICENSE" ]
requires-python = ">=3.9"
dynamic = ["dependencies"]
dependencies = [
{%- if extras %}
"singer-sdk[{{ extras|join(',') }}]~=0.44.1",
{%- else %}
"singer-sdk~=0.44.1",
{%- endif %}
{%- if cookiecutter.stream_type in ["REST", "GraphQL"] %}
"requests~=2.32.3",
{%- endif %}
{%- if cookiecutter.stream_type == "SQL" %}
"sqlalchemy~=2.0.36",
{%- endif %}
]

[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
[project.optional-dependencies]
s3 = [
"fs-s3fs~=1.1.1",
]
{%- endif %}

[tool.poetry.dependencies]
singer-sdk = { version="~=0.44.1", extras = [
{%- if cookiecutter.auth_method == "JWT" -%}"jwt", {% endif -%}
{%- if cookiecutter.faker_extra -%}"faker",{%- endif -%}
] }
fs-s3fs = { version = "~=1.1.1", optional = true }
{%- if cookiecutter.stream_type in ["REST", "GraphQL"] %}
requests = "~=2.32.3"
{%- endif %}
{%- if cookiecutter.stream_type == "SQL" %}
sqlalchemy = "~=2.0.36"
{%- endif %}
[project.scripts]
# CLI declaration
{{cookiecutter.tap_id}} = '{{cookiecutter.library_name}}.tap:Tap{{cookiecutter.source_name}}.cli'

[tool.poetry.group.dev.dependencies]
pytest = ">=8"
{%- if cookiecutter.auth_method == "JWT" %}
singer-sdk = { version="~=0.44.1", extras = ["jwt", "testing"] }
{%- else %}
singer-sdk = { version="~=0.44.1", extras = ["testing"] }
{%- endif %}
[dependency-groups]
dev = [
"pytest>=8",
"singer-sdk[testing]~=0.44.1",
]

[tool.poetry.extras]
s3 = ["fs-s3fs"]
{%- if cookiecutter.variant != "None (Skip)" %}
[tool.hatch.build.targets.wheel]
packages = [
"{{cookiecutter.library_name}}",
]
{%- endif %}

[tool.pytest.ini_options]
addopts = [
Expand Down Expand Up @@ -88,9 +95,7 @@ allow-star-arg-any = true
convention = "google"

[build-system]
requires = ["poetry-core>=2,<3"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
# CLI declaration
{{cookiecutter.tap_id}} = '{{cookiecutter.library_name}}.tap:Tap{{cookiecutter.source_name}}.cli'
requires = [
"hatchling>=1,<2",
]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,43 @@ classifiers = [
license = "Apache-2.0"
license-files = [ "LICENSE" ]
requires-python = ">=3.9"
dynamic = ["dependencies"]
dependencies = [
{%- if cookiecutter.faker_extra %}
"singer-sdk[faker]~=0.44.1",
{%- else %}
"singer-sdk~=0.44.1",
{%- endif %}
{%- if cookiecutter.serialization_method != "SQL" %}
"requests~=2.32.3",
{%- endif %}
]

[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
[project.optional-dependencies]
s3 = [
"fs-s3fs~=1.1.1",
]
{%- endif %}

[tool.poetry.dependencies]
singer-sdk = { version="~=0.44.1"{{ ', extras = ["faker"]' if cookiecutter.faker_extra }} }
fs-s3fs = { version = "~=1.1.1", optional = true }
{%- if cookiecutter.serialization_method != "SQL" %}
requests = "~=2.32.3"
{%- endif %}
[project.scripts]
# CLI declaration
{{cookiecutter.target_id}} = '{{cookiecutter.library_name}}.target:Target{{ cookiecutter.destination_name }}.cli'

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

[tool.poetry.extras]
s3 = ["fs-s3fs"]
{%- if cookiecutter.variant != "None (Skip)" %}
[tool.hatch.build.targets.wheel]
packages = [
"{{cookiecutter.library_name}}",
]
{%- endif %}

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

[tool.ruff]
target-version = "py39"

[tool.ruff.lint]
ignore = [
"COM812", # missing-trailing-comma
Expand All @@ -68,9 +75,7 @@ allow-star-arg-any = true
convention = "google"

[build-system]
requires = ["poetry-core>=2,<3"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
# CLI declaration
{{cookiecutter.target_id}} = '{{cookiecutter.library_name}}.target:Target{{ cookiecutter.destination_name }}.cli'
requires = [
"hatchling>=1,<2",
]
build-backend = "hatchling.build"
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def test_cookiecutter(session: nox.Session, replay_file_path: str) -> None:
+ '", develop = true \\}|',
"pyproject.toml",
)
session.run("poetry", "lock", external=True)
session.run("poetry", "install", external=True)
session.run("uv", "lock", external=True)
session.run("uv", "sync", external=True)

session.run("git", "init", "-b", "main", external=True)
session.run("git", "add", ".", external=True)
Expand Down

0 comments on commit f04ab25

Please sign in to comment.