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

synthtool generates code for wrong api version #654

Closed
arithmetic1728 opened this issue Jul 7, 2020 · 3 comments
Closed

synthtool generates code for wrong api version #654

arithmetic1728 opened this issue Jul 7, 2020 · 3 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@arithmetic1728
Copy link
Contributor

Environment details

  • OS: gLinux
  • Python version: 3.6.9
  • pip version: 20.1.1
  • synthtool version: 2020.02.04

Steps to reproduce

  1. clone googleapis repo, and export SYNTHTOOL_GOOGLEAPIS=/path/to/googleapis
  2. clone https://github.com/googleapis/python-websecurityscanner, and cd to the folder
  3. rm -rf google/ tests/unit/gapic docs/gapic
  4. use the synth.py from branch 'sijun': https://github.com/googleapis/python-websecurityscanner/tree/sijun
  5. run python3 -m synthtool, the generated code is: For reporting synthtool bug only python-websecurityscanner#19. Note that even the versions set in synth.py are v1alpha and v1beta, the generated version is v1.
@arithmetic1728
Copy link
Contributor Author

Here is the log when running python3 -m synthtool:

2020-07-06 20:59:51,967 synthtool [DEBUG] > Executing /usr/local/google/home/sijunliu/wks/python-websecurityscanner/synth.py.
On branch sijun
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	deleted:    google/cloud/websecurityscanner/__init__.py
	deleted:    google/cloud/websecurityscanner/py.typed
	deleted:    google/cloud/websecurityscanner_v1/__init__.py
	deleted:    google/cloud/websecurityscanner_v1/py.typed
	deleted:    google/cloud/websecurityscanner_v1/services/__init__.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/__init__.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/pagers.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/__init__.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py
	deleted:    google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py
	deleted:    google/cloud/websecurityscanner_v1/types/__init__.py
	deleted:    google/cloud/websecurityscanner_v1/types/crawled_url.py
	deleted:    google/cloud/websecurityscanner_v1/types/finding.py
	deleted:    google/cloud/websecurityscanner_v1/types/finding_addon.py
	deleted:    google/cloud/websecurityscanner_v1/types/finding_type_stats.py
	deleted:    google/cloud/websecurityscanner_v1/types/scan_config.py
	deleted:    google/cloud/websecurityscanner_v1/types/scan_config_error.py
	deleted:    google/cloud/websecurityscanner_v1/types/scan_run.py
	deleted:    google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py
	deleted:    google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py
	deleted:    google/cloud/websecurityscanner_v1/types/web_security_scanner.py
	deleted:    tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	log

no changes added to commit (use "git add" and/or "git commit -a")
2020-07-06 20:59:52,076 synthtool [DEBUG] > Ensuring dependencies.
2020-07-06 20:59:52,622 synthtool [DEBUG] > Using local googleapis at /usr/local/google/home/sijunliu/wks/googleapis
2020-07-06 20:59:52,623 synthtool [DEBUG] > Pulling Docker image: gapic-generator-python:latest
latest: Pulling from gapic-images/gapic-generator-python
Digest: sha256:abdb4a8de6717a240598cefd02dec098bf387e6255c80bdf1fd703601ab2ac41
Status: Image is up to date for gcr.io/gapic-images/gapic-generator-python:latest
gcr.io/gapic-images/gapic-generator-python:latest
2020-07-06 20:59:53,468 synthtool [DEBUG] > Generating code for: google/cloud/websecurityscanner/v1alpha.
2020-07-06 20:59:57,917 synthtool [SUCCESS] > Generated code into /tmp/tmp43czaex6.
2020-07-06 20:59:57,939 synthtool [DEBUG] > Pulling Docker image: gapic-generator-python:latest
latest: Pulling from gapic-images/gapic-generator-python
Digest: sha256:abdb4a8de6717a240598cefd02dec098bf387e6255c80bdf1fd703601ab2ac41
Status: Image is up to date for gcr.io/gapic-images/gapic-generator-python:latest
gcr.io/gapic-images/gapic-generator-python:latest
2020-07-06 20:59:58,794 synthtool [DEBUG] > Generating code for: google/cloud/websecurityscanner/v1beta.
2020-07-06 21:00:03,479 synthtool [SUCCESS] > Generated code into /tmp/tmp_rxhxo_w.
2020-07-06 21:00:03,587 synthtool [INFO] > Replaced '[\'"]sphinx[\'"]' in noxfile.py.
�[36mnox > �[33mRunning session blacken�[0m
�[36mnox > �[34mCreating virtual environment (virtualenv) using python3.6 in .nox/blacken�[0m
�[36mnox > �[34mpip install black==19.10b0�[0m
�[36mnox > �[34mblack docs google tests noxfile.py setup.py�[0m
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/__init__.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/__init__.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/crawled_url.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/__init__.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_type_stats.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/__init__.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner/__init__.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/docs/conf.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_addon.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config_error.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/noxfile.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/types/web_security_scanner.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/pagers.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py
reformatted /usr/local/google/home/sijunliu/wks/python-websecurityscanner/tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.py
All done! ✨ 🍰 ✨
24 files reformatted, 2 files left unchanged.
�[36mnox > �[32mSession blacken was successful.�[0m
2020-07-06 21:00:10,749 synthtool [DEBUG] > Wrote metadata to synth.metadata.
.coveragerc
.flake8
.github/CONTRIBUTING.md
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/ISSUE_TEMPLATE/support_request.md
.github/PULL_REQUEST_TEMPLATE.md
.github/release-please.yml
.gitignore
.kokoro/build.sh
.kokoro/continuous/common.cfg
.kokoro/continuous/continuous.cfg
.kokoro/docs/common.cfg
.kokoro/docs/docs.cfg
.kokoro/presubmit/common.cfg
.kokoro/presubmit/presubmit.cfg
.kokoro/publish-docs.sh
.kokoro/release.sh
.kokoro/release/common.cfg
.kokoro/release/release.cfg
.kokoro/samples/lint/common.cfg
.kokoro/samples/lint/continuous.cfg
.kokoro/samples/lint/periodic.cfg
.kokoro/samples/lint/presubmit.cfg
.kokoro/samples/python3.6/common.cfg
.kokoro/samples/python3.6/continuous.cfg
.kokoro/samples/python3.6/periodic.cfg
.kokoro/samples/python3.6/presubmit.cfg
.kokoro/samples/python3.7/common.cfg
.kokoro/samples/python3.7/continuous.cfg
.kokoro/samples/python3.7/periodic.cfg
.kokoro/samples/python3.7/presubmit.cfg
.kokoro/samples/python3.8/common.cfg
.kokoro/samples/python3.8/continuous.cfg
.kokoro/samples/python3.8/periodic.cfg
.kokoro/samples/python3.8/presubmit.cfg
.kokoro/test-samples.sh
.kokoro/trampoline.sh
CODE_OF_CONDUCT.md
CONTRIBUTING.rst
LICENSE
MANIFEST.in
docs/_static/custom.css
docs/_templates/layout.html
docs/conf.py.j2
docs/multiprocessing.rst
noxfile.py.j2
renovate.json
Skipping: samples/AUTHORING_GUIDE.md
Skipping: samples/CONTRIBUTING.md
scripts/decrypt-secrets.sh
scripts/readme-gen/readme_gen.py.j2
scripts/readme-gen/templates/README.tmpl.rst
scripts/readme-gen/templates/auth.tmpl.rst
scripts/readme-gen/templates/auth_api_key.tmpl.rst
scripts/readme-gen/templates/install_deps.tmpl.rst
scripts/readme-gen/templates/install_portaudio.tmpl.rst
setup.cfg
testing/.gitignore

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jul 7, 2020
@busunkim96
Copy link
Contributor

I'm able to reproduce this with the branch you provided.

I also tried generating the library with Bazel directly and the same thing happens (tar is labeled alpha but v1 is generated).

bazel build google/cloud/websecurityscanner/v1alpha:websecurityscanner-v1alpha-py
$ ls websecurityscanner-v1alpha-py/google/cloud/websecurityscanner
websecurityscanner/    websecurityscanner_v1/

Is there anything off with the configuration files? https://github.com/googleapis/googleapis/tree/cf41866c6f14f10a07aa1e2a1260fc0a2727d889/google/cloud/websecurityscanner/v1alpha

@busunkim96 busunkim96 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jul 8, 2020
@busunkim96 busunkim96 self-assigned this Jul 8, 2020
@busunkim96 busunkim96 removed the triage me I really want to be triaged. label Jul 8, 2020
@arithmetic1728
Copy link
Contributor Author

issue solved by: googleapis/gapic-generator-python#540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants