-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Published package is missing discovery files in discovery_cache #1214
Comments
Fixes #1214 The [MANIFEST.in](https://packaging.python.org/guides/using-manifest-in/) controls which files are included in the published package. You can verify that this fixes the problem (missing discovery docs leading to failing `discovery.build()` calls) by building the package and installing the library from the tarfile. - `python3 -m venv env` - `source env/bin/activate` - `python3 -m setup.py sdist` - `python3 -m pip install dist/google-api-python-client-2.0.0.tar.gz` ``` (env) busunkim@busunkim:~/github/google-api-python-client$ python3 Python 3.6.9 (default, Feb 24 2020, 21:10:07) [GCC 9.2.1 20190909] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import googleapiclient >>> from googleapiclient import discovery >>> client = discovery.build("cloudprofiler", "v2") >>> ```
Version 2.0.1 also has the same issue. The issue is resolved by changing this line from
to
|
Fixes #1214 🦕 I was able to re-create the issue by using the following steps. 1) Create a clean `pyenv` environment 2) Download google-api-python-client-2.0.1 from PyPi [here](https://files.pythonhosted.org/packages/dc/67/a228c05a28288fdfde6e8c1a27a62e10ee265664c0f1d59070e6e0dc6242/google-api-python-client-2.0.1.tar.gz) and unzip it 3) Install it using `pip install <Unzipped Directory>` 4) Confirm `discovery.build()` fails on any call To Verify the fix, repeat the steps above, but apply the update in this PR prior to installing the library.
@parthea, the issue still exists in 2.0.2 for me.
and I got the same error:
After I downgraded to 1.12.8, the error is gone. |
Okay, I just found out: #1225 (comment) and #1225 (comment) Our API is indeed private at this point. |
@chensun |
Yes, I saw that, it's in the 2nd comments I referenced above. In the original comment, it says:
So my thinking was why bother upgrading to 2.x, yet changing the code to make it behave just like 1.x. There's no known features from 2.x that we want to take advantage of at this moment. So why not just use 1.x until our API becomes public, by that time we can lift the version restriction without changing the code twice. WDYT? @Ark-kun |
I'm re-opening this issue to propose a change to improve the behaviour in version 2.0.2. By design, The following sample code from #935 will result in a breaking change when upgrading to 2.0.2 if the discovery document is not public because the user has not specified
I'd like to propose to make the above code work. Looking at the above snippet, one can assume that the user wants to retrieve discovery documents dynamically since they have provided the If a user specifies the If we proceed, the docs would be updated to explain the new behaviour. |
cc @busunkim96 for review |
Closing this off, as the discussion is already in #1225 and we are going to proceed with this change. |
Many thanks to the @wyk9787 for noticing this and reaching out.
All calls to
discovery.build()
using2.0.0
fail with "unknown api name or version".This is because the published package has no
discovery_cache/documents
directory.python3 -m venv env
source env/bin/activate
python3 -m pip install google-api-python-client
ls env/lib/python*/site-packages/googleapiclient/discovery_cache
The text was updated successfully, but these errors were encountered: