Skip to content

Commit

Permalink
chore: Update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 15, 2025
1 parent b4c6ecc commit abede1d
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 43 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "cookiecutter/**"
- "samples/**"
- "singer_sdk/**"
- "tests/**"
Expand All @@ -18,7 +17,6 @@ on:
- main
- v*
paths:
- "cookiecutter/**"
- "samples/**"
- "singer_sdk/**"
- "tests/**"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ repos:
)$
- repo: https://github.com/python-poetry/poetry
rev: 2.0.1
rev: 2.0.0
hooks:
- id: poetry-check
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: {{ '${{ steps.baipp.outputs.package_version }}' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp

publish:
name: Publish to PyPI
Expand All @@ -23,7 +24,13 @@ jobs:
## TODO: optionally provide the name of the environment for the trusted
## publisher on PyPI
## https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
# environment: pypi
# environment:
# name: pypi
{%- if cookiecutter.variant != "None (Skip)" %}
# url: https://pypi.org/project/"{{cookiecutter.variant}}-{{cookiecutter.mapper_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- else %}
# url: https://pypi.org/project/"{{cookiecutter.mapper_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- endif %}
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool.poetry]
[project]
{%- if cookiecutter.variant != "None (Skip)" %}
name = "{{cookiecutter.variant}}-{{cookiecutter.mapper_id}}"
{%- else %}
Expand All @@ -7,14 +7,15 @@ name = "{{cookiecutter.mapper_id}}"
version = "0.0.1"
description = "Singer mapper {{cookiecutter.name}}, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["{{ cookiecutter.admin_name }} <{{ cookiecutter.admin_email }}>"]
authors = [{ name = "{{ cookiecutter.admin_name }}", email = "{{ cookiecutter.admin_email }}" }]
keywords = [
"ELT",
"Mapper",
"{{cookiecutter.name}}",
]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -23,14 +24,18 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
license = "Apache-2.0"
license-files = [ "LICENSE" ]
requires-python = ">=3.9"
dynamic = ["dependencies"]

[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
]
{%- endif %}

[tool.poetry.dependencies]
python = ">=3.9"
singer-sdk = { version="~=0.43.1"{{ ', extras = ["faker"]' if cookiecutter.faker_extra }} }
fs-s3fs = { version = "~=1.1.1", optional = true }

Expand All @@ -42,7 +47,9 @@ singer-sdk = { version="~=0.43.1", extras = ["testing"] }
s3 = ["fs-s3fs"]

[tool.pytest.ini_options]
addopts = '--durations=10'
addopts = [
"--durations=10",
]

[tool.mypy]
python_version = "3.12"
Expand All @@ -65,7 +72,7 @@ allow-star-arg-any = true
convention = "google"

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

[tool.poetry.scripts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ requires =
tox>=4.19

[testenv]
pass_env =
MAPPER_*
deps =
pytest
commands =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: {{ '${{ steps.baipp.outputs.package_version }}' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp

publish:
name: Publish to PyPI
Expand All @@ -23,7 +24,13 @@ jobs:
## TODO: optionally provide the name of the environment for the trusted
## publisher on PyPI
## https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
# environment: pypi
# environment:
# name: pypi
{%- if cookiecutter.variant != "None (Skip)" %}
# url: https://pypi.org/project/"{{cookiecutter.variant}}-{{cookiecutter.tap_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- else %}
# url: https://pypi.org/project/"{{cookiecutter.tap_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- endif %}
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion cookiecutter/tap-template/{{cookiecutter.tap_id}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ Now you can test and orchestrate using Meltano:
```bash
# Test invocation:
meltano invoke {{ cookiecutter.tap_id }} --version
# OR run a test `elt` pipeline:

# OR run a test ELT pipeline:
meltano run {{ cookiecutter.tap_id }} target-jsonl
```

Expand Down
17 changes: 12 additions & 5 deletions cookiecutter/tap-template/{{cookiecutter.tap_id}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool.poetry]
[project]
{%- if cookiecutter.variant != "None (Skip)" %}
name = "{{cookiecutter.variant}}-{{cookiecutter.tap_id}}"
{%- else %}
Expand All @@ -7,13 +7,14 @@ name = "{{cookiecutter.tap_id}}"
version = "0.0.1"
description = "Singer tap for {{cookiecutter.source_name}}, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["{{ cookiecutter.admin_name }} <{{ cookiecutter.admin_email }}>"]
authors = [{ name = "{{ cookiecutter.admin_name }}", email = "{{ cookiecutter.admin_email }}" }]
keywords = [
"ELT",
"{{cookiecutter.source_name}}",
]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -22,14 +23,18 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
license = "Apache-2.0"
license-files = [ "LICENSE" ]
requires-python = ">=3.9"
dynamic = ["dependencies"]

[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
]
{%- endif %}

[tool.poetry.dependencies]
python = ">=3.9"
singer-sdk = { version="~=0.43.1", extras = [
{%- if cookiecutter.auth_method == "JWT" -%}"jwt", {% endif -%}
{%- if cookiecutter.faker_extra -%}"faker",{%- endif -%}
Expand All @@ -54,7 +59,9 @@ singer-sdk = { version="~=0.43.1", extras = ["testing"] }
s3 = ["fs-s3fs"]

[tool.pytest.ini_options]
addopts = '--durations=10'
addopts = [
"--durations=10",
]

[tool.mypy]
python_version = "3.12"
Expand Down Expand Up @@ -82,7 +89,7 @@ allow-star-arg-any = true
convention = "google"

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

[tool.poetry.scripts]
Expand Down
2 changes: 2 additions & 0 deletions cookiecutter/tap-template/{{cookiecutter.tap_id}}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ requires =
tox>=4.19

[testenv]
pass_env =
TAP_*
deps =
pytest
commands =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: {{ '${{ steps.baipp.outputs.package_version }}' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp

publish:
name: Publish to PyPI
Expand All @@ -23,7 +24,13 @@ jobs:
## TODO: optionally provide the name of the environment for the trusted
## publisher on PyPI
## https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
# environment: pypi
# environment:
# name: pypi
{%- if cookiecutter.variant != "None (Skip)" %}
# url: https://pypi.org/project/"{{cookiecutter.variant}}-{{cookiecutter.target_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- else %}
# url: https://pypi.org/project/"{{cookiecutter.target_id}}"/{{ '${{ steps.baipp.outputs.package_version }}' }}
{%- endif %}
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ You can easily run `{{ cookiecutter.target_id }}` by itself or in a pipeline usi
```bash
{{ cookiecutter.target_id }} --version
{{ cookiecutter.target_id }} --help
# Test using the "Carbon Intensity" sample:
tap-carbon-intensity | {{ cookiecutter.target_id }} --config /path/to/{{ cookiecutter.target_id }}-config.json
# Test using the "Smoke Test" tap:
tap-smoke-test | {{ cookiecutter.target_id }} --config /path/to/{{ cookiecutter.target_id }}-config.json
```

## Developer Resources
Expand Down Expand Up @@ -122,8 +122,9 @@ Now you can test and orchestrate using Meltano:
```bash
# Test invocation:
meltano invoke {{ cookiecutter.target_id }} --version
# OR run a test `elt` pipeline with the Carbon Intensity sample tap:
meltano run tap-carbon-intensity {{ cookiecutter.target_id }}

# OR run a test ELT pipeline with the Smoke Test sample tap:
meltano run tap-smoke-test {{ cookiecutter.target_id }}
```

### SDK Dev Guide
Expand Down
Loading

0 comments on commit abede1d

Please sign in to comment.