Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support declaring variant for use in package name #1241

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f5cd1ef
support sourcing version when package name differs from executable name
Dec 5, 2022
6498ff3
make package_name optional
Dec 5, 2022
4d77bfa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2022
a1a98f9
Update singer_sdk/plugin_base.py
Dec 5, 2022
0e8264c
linting
Dec 5, 2022
fd60579
add variant and package_name properties, and update cookiecutter
Dec 6, 2022
dab7a20
update pyproject.toml
Dec 6, 2022
8a7b52f
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Dec 6, 2022
84dd542
fix missing tag
Dec 6, 2022
020ba29
Merge branch 'kgpayne/version-when-package-name-differs-from-exec-nam…
Dec 6, 2022
5c279c8
fix jinja formatting
Dec 6, 2022
5c7fb53
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Dec 6, 2022
925026b
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Dec 7, 2022
4077106
revert plugin_base changes
Dec 7, 2022
3b3edca
revert cookiecutter variant changes
Dec 7, 2022
b6eac31
Merge branch 'kgpayne/version-when-package-name-differs-from-exec-nam…
Dec 7, 2022
5b6197a
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Dec 14, 2022
b826326
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Dec 15, 2022
f14b64f
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Feb 8, 2023
27122e7
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Feb 8, 2023
fb6481c
Merge branch 'main' into kgpayne/version-when-package-name-differs-fr…
Feb 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions cookiecutter/tap-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
{
"source_name": "MySourceName",
"admin_name": "FirstName LastName",
"tap_id": "tap-{{ cookiecutter.source_name.lower() }}",
"library_name": "{{ cookiecutter.tap_id.replace('-', '_') }}",
"stream_type": [
"REST",
"GraphQL",
"SQL",
"Other"
],
"auth_method": [
"API Key",
"Bearer Token",
"Basic Auth",
"OAuth2",
"JWT",
"Custom or N/A"
],
"include_cicd_sample_template": [
"GitHub",
"None (Skip)"
]
"source_name": "MySourceName",
"admin_name": "FirstName LastName",
"tap_id": "tap-{{ cookiecutter.source_name.lower() }}",
"library_name": "{{ cookiecutter.tap_id.replace('-', '_') }}",
"variant": "None (Skip)",
"stream_type": ["REST", "GraphQL", "SQL", "Other"],
"auth_method": [
"API Key",
"Bearer Token",
"Basic Auth",
"OAuth2",
"JWT",
"Custom or N/A"
],
"include_cicd_sample_template": ["GitHub", "None (Skip)"]
}
7 changes: 7 additions & 0 deletions cookiecutter/tap-template/cookiecutter.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ tests:
stream_type: Other
auth_method: Custom or N/A
include_cicd_sample_template: GitHub

- source_name: OtherCustomTemplateTest
tap_id: test-tap-other-custom-type
variant: meltanolabs
stream_type: Other
auth_method: Custom or N/A
include_cicd_sample_template: "None (Skip)"
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
name = "{{cookiecutter.variant}}-{{cookiecutter.tap_id}}"
{%- else %}
name = "{{cookiecutter.tap_id}}"
{%- endif %}
version = "0.0.1"
description = "`{{cookiecutter.tap_id}}` is a Singer tap for {{cookiecutter.source_name}}, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["{{ cookiecutter.admin_name }}"]
keywords = [
"ELT",
"{{cookiecutter.source_name}}",
]
license = "Apache 2.0"
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
]
{%- endif %}

[tool.poetry.dependencies]
python = "<3.11,>=3.7.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

class Tap{{ cookiecutter.source_name }}({{ 'SQL' if cookiecutter.stream_type == 'SQL' else '' }}Tap):
"""{{ cookiecutter.source_name }} tap class."""

name = "{{ cookiecutter.tap_id }}"

# TODO: Update this section with the actual config values you expect:
Expand Down
13 changes: 7 additions & 6 deletions cookiecutter/target-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"destination_name": "MyDestinationName",
"admin_name": "FirstName LastName",
"target_id": "target-{{ cookiecutter.destination_name.lower() }}",
"library_name": "{{ cookiecutter.target_id.replace('-', '_') }}",
"serialization_method": ["Per record", "Per batch", "SQL"]
}
"destination_name": "MyDestinationName",
"admin_name": "FirstName LastName",
"target_id": "target-{{ cookiecutter.destination_name.lower() }}",
"library_name": "{{ cookiecutter.target_id.replace('-', '_') }}",
"variant": "None (Skip)",
"serialization_method": ["Per record", "Per batch", "SQL"]
}
4 changes: 4 additions & 0 deletions cookiecutter/target-template/cookiecutter.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ tests:
- destination_name: SQLSinkTest
target_id: target-sqlsink-test
serialization_method: SQL
- destination_name: TargetRecordSinkTest
target_id: target-recordsink-test
variant: meltanolabs
serialization_method: Per record
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
[tool.poetry]
{%- if cookiecutter.variant != "None (Skip)" %}
name = "{{cookiecutter.variant}}-{{cookiecutter.target_id}}"
{%- else %}
name = "{{cookiecutter.target_id}}"
{%- endif %}
version = "0.0.1"
description = "`{{cookiecutter.target_id}}` is a Singer target for {{cookiecutter.destination_name}}, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["{{ cookiecutter.admin_name }}"]
keywords = [
"ELT",
"{{cookiecutter.destination_name}}",
]
license = "Apache 2.0"
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
{ include = "{{cookiecutter.library_name}}" },
]
kgpayne marked this conversation as resolved.
Show resolved Hide resolved
{%- endif %}

[tool.poetry.dependencies]
python = "<3.11,>=3.7.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Target{{ cookiecutter.destination_name }}({{ target_class }}):
"""Sample target for {{ cookiecutter.destination_name }}."""

name = "{{ cookiecutter.target_id }}"

config_jsonschema = th.PropertiesList(
{%- if cookiecutter.serialization_method == "SQL" %}
th.Property(
Expand Down