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(templates): Add email field and use human-readable questions in templates #1905

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion cookiecutter/mapper-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"name": "MyMapperName",
"admin_name": "FirstName LastName",
"admin_email": "firstname.lastname@example.com",
"mapper_id": "mapper-{{ cookiecutter.name.lower() }}",
"library_name": "{{ cookiecutter.mapper_id.replace('-', '_') }}",
"variant": "None (Skip)",
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
"license": ["Apache-2.0"],
"__prompts__": {
"name": "The name of the mapper, in CamelCase",
"admin_name": "Provide your [bold yellow]full name[/]",
"admin_email": "Provide your [bold yellow]email[/]",
"mapper_id": "The ID of the tap, in kebab-case",
"library_name": "The name of the library, in snake_case. This is how the library will be imported in Python.",
"include_ci_files": "Whether to include CI files for a common CI services",
"license": "The license for the project"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "{{cookiecutter.mapper_id}}"
version = "0.0.1"
description = "`{{cookiecutter.mapper_id}}` is a Singer mapper {{cookiecutter.name}}, built with the Meltano Singer SDK."
readme = "README.md"
authors = ["{{ cookiecutter.admin_name }}"]
authors = ["{{ cookiecutter.admin_name }} <{{ cookiecutter.admin_email }}>"]
keywords = [
"ELT",
"Mapper",
Expand Down
14 changes: 13 additions & 1 deletion cookiecutter/tap-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"source_name": "MySourceName",
"admin_name": "FirstName LastName",
"admin_email": "firstname.lastname@example.com",
"tap_id": "tap-{{ cookiecutter.source_name.lower() }}",
"library_name": "{{ cookiecutter.tap_id.replace('-', '_') }}",
"variant": "None (Skip)",
Expand All @@ -14,5 +15,16 @@
"Custom or N/A"
],
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
"license": ["Apache-2.0"],
"__prompts__": {
"source_name": "The name of the source, in CamelCase",
"admin_name": "Provide your [bold yellow]full name[/]",
"admin_email": "Provide your [bold yellow]email[/]",
"tap_id": "The ID of the tap, in kebab-case",
"library_name": "The name of the library, in snake_case. This is how the library will be imported in Python.",
"stream_type": "The type of stream the source provides",
"auth_method": "The [bold red]authentication[/] method used by the source, for REST and GraphQL sources",
"include_ci_files": "Whether to include CI files for a common CI services",
"license": "The license for the project"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "{{cookiecutter.tap_id}}"
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 }}"]
authors = ["{{ cookiecutter.admin_name }} <{{ cookiecutter.admin_email }}>"]
keywords = [
"ELT",
"{{cookiecutter.source_name}}",
Expand Down
13 changes: 12 additions & 1 deletion cookiecutter/target-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{
"destination_name": "MyDestinationName",
"admin_name": "FirstName LastName",
"admin_email": "firstname.lastname@example.com",
"target_id": "target-{{ cookiecutter.destination_name.lower() }}",
"library_name": "{{ cookiecutter.target_id.replace('-', '_') }}",
"variant": "None (Skip)",
"serialization_method": ["Per record", "Per batch", "SQL"],
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
"license": ["Apache-2.0"],
"__prompts__": {
"name": "The name of the mapper, in CamelCase",
"admin_name": "Provide your [bold yellow]full name[/]",
"admin_email": "Provide your [bold yellow]email[/]",
"mapper_id": "The ID of the tap, in kebab-case",
"library_name": "The name of the library, in snake_case. This is how the library will be imported in Python.",
"serialization_method": "The serialization method to use for loading data",
"include_ci_files": "Whether to include CI files for a common CI services",
"license": "The license for the project"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "{{cookiecutter.target_id}}"
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 }}"]
authors = ["{{ cookiecutter.admin_name }} <{{ cookiecutter.admin_email }}>"]
keywords = [
"ELT",
"{{cookiecutter.destination_name}}",
Expand Down
18 changes: 18 additions & 0 deletions docs/dev_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ generated `README.md` file to complete your new tap or target. You can also refe
[Meltano Tutorial](https://docs.meltano.com/tutorials/custom-extractor) for a more
detailed guide.

````{admonition} Avoid repeating yourself
If you find yourself repeating the same inputs to the cookiecutter, you can create a
`cookiecutterrc` file in your home directory to set default values for the prompts.

For example, if you want to set the default value for your name and email, and the
default stream type and authentication method, you can add the following to your
`~/.cookiecutterrc` file:

```yaml
# ~/.cookiecutterrc
default_context:
admin_name: Johnny B. Goode
admin_email: jbg@example.com
stream_type: REST
auth_method: Bearer Token
```
````

### Using an existing library

In some cases, there may already be a library that connects to the API and all you need the SDK for
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/mapper-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"name": "MyMapperName",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"mapper_id": "mapper-base",
"library_name": "mapper_base",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-graphql-jwt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "GraphQLJWTTemplateTest",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-graphql-jwt",
"library_name": "tap_graphql_jwt",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-other-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-other-custom",
"library_name": "tap_other_custom",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-api_key-github.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-api_key-github",
"library_name": "tap_rest_api_key_github",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-basic_auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-basic_auth",
"library_name": "tap_rest_basic_auth",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-bearer_token.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-bearer_token",
"library_name": "tap_rest_bearer_token",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-custom",
"library_name": "tap_rest_custom",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-jwt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-jwt",
"library_name": "tap_rest_jwt",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-rest-oauth2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-rest-oauth2",
"library_name": "tap_rest_oauth2",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/tap-sql-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"source_name": "AutomaticTestTap",
"admin_name": "Automatic Tester",
"admin_email": "auto.tester@example.com",
"tap_id": "tap-sql-custom",
"library_name": "tap_sql_custom",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/target-per_record.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"destination_name": "MyDestinationName",
"admin_name": "FirstName LastName",
"admin_email": "firstname.lastname@example.com",
"target_id": "target-per_record",
"library_name": "target_per_record",
"variant": "None (Skip)",
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/target-sql.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cookiecutter": {
"destination_name": "MyDestinationName",
"admin_name": "FirstName LastName",
"admin_email": "firstname.lastname@example.com",
"target_id": "target-sql",
"library_name": "target_sql",
"variant": "None (Skip)",
Expand Down