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

bug: Cookiecutter tap-template errors out if VSCode IDE is not selected #2182

Closed
1 task done
menzenski opened this issue Jan 25, 2024 · 4 comments · Fixed by #2183
Closed
1 task done

bug: Cookiecutter tap-template errors out if VSCode IDE is not selected #2182

menzenski opened this issue Jan 25, 2024 · 4 comments · Fixed by #2183
Labels
kind/Bug Something isn't working valuestream/SDK

Comments

@menzenski
Copy link
Contributor

Singer SDK Version

0.34.1

Is this a regression?

  • Yes

Python Version

3.11

Bug scope

Cookiecutter templates

Operating System

macOS Ventura 13.6

Description

I went through the cookiecutter tap-template generation process and it errored out without creating a project directory. I believe this is due to this line? https://github.com/meltano/sdk/blob/main/cookiecutter/tap-template/hooks/post_gen_project.py#L31

It's also not clear what __prompts__ [default]: is doing - when I hit enter with the intent of selecting "default option", it errored, but I was able to provide a JSON object {} to move past that.

Code

cookiecutter https://github.com/meltano/sdk --directory="cookiecutter/tap-template"
You've downloaded /Users/matt/.cookiecutters/sdk before. Is it okay to delete and re-download it? [yes]: yes
source_name [MySourceName]: MySource
admin_name [FirstName LastName]: Matt Menzenski
admin_email [firstname.lastname@example.com]: matt@example.com
tap_id [tap-my-source]: tap-my-source
library_name [tap_my_source]:
variant [None (Skip)]:
Select stream_type:
1 - REST
2 - GraphQL
3 - SQL
4 - Other
Choose from 1, 2, 3, 4 [1]: 1
Select auth_method:
1 - API Key
2 - Bearer Token
3 - Basic Auth
4 - OAuth2
5 - JWT
6 - Custom or N/A
Choose from 1, 2, 3, 4, 5, 6 [1]: 2
Select include_ci_files:
1 - GitHub
2 - None
Choose from 1, 2 [1]: 1
Select license:
1 - Apache-2.0
2 - None
Choose from 1, 2 [1]: 1
Select ide:
1 - VSCode
2 - None
Choose from 1, 2 [1]: 2
__prompts__ [default]:
Error: Unable to decode to JSON.
__prompts__ [default]:
Error: Unable to decode to JSON.
__prompts__ [default]: {}
Traceback (most recent call last):
  File "/var/folders/ms/gk5mg99d1d3_6sn7bqyhzx0m0000gp/T/tmptczel5gz.py", line 31, in <module>
    shutil.rmtree(".vscode")
  File "/usr/local/Cellar/[email protected]/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py", line 724, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/usr/local/Cellar/[email protected]/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py", line 722, in rmtree
    orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: '.vscode'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
@menzenski menzenski added kind/Bug Something isn't working valuestream/SDK labels Jan 25, 2024
@menzenski
Copy link
Contributor Author

I've also confirmed that when I run through the cookiecutter tap-template generation with the same responses, but choosing 1 - VSCode instead of 2 - None, the project repository is generated successfully (and there is no .vscode directory in it, which is puzzling to me).

@edgarrmondragon
Copy link
Collaborator

edgarrmondragon commented Jan 25, 2024

Thanks for logging @menzenski! Looking into this.

UPDATE: #2183

@menzenski
Copy link
Contributor Author

Thanks @edgarrmondragon !

I created another tap project from the Cookiecutter template today and I think I know what was happening with these errors:

__prompts__ [default]:
Error: Unable to decode to JSON.

I had run those commands with the cookiecutter command, which was actually using cookiecutter 1.7.3 from my system Python 3.9.

Today I used the pipx run cookiecutter command, which used cookiecutter 2.5.0, and I did not have the issue with the __prompts__ field.

@edgarrmondragon
Copy link
Collaborator

I created another tap project from the Cookiecutter template today and I think I know what was happening with these errors:

__prompts__ [default]:
Error: Unable to decode to JSON.

I had run those commands with the cookiecutter command, which was actually using cookiecutter 1.7.3 from my system Python 3.9.

Today I used the pipx run cookiecutter command, which used cookiecutter 2.5.0, and I did not have the issue with the __prompts__ field.

Ah, gotcha. The minimum recommended cookiecutter version is a good thing to call out in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/Bug Something isn't working valuestream/SDK
Projects
None yet
2 participants