From 294bb516052d49b8089db4a59d9b833d05f09cb9 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 17 Sep 2024 00:03:40 -0700 Subject: [PATCH] chore!: remove "apiclient" package "apiclient" was created in 2014 as a stop-gap to help people transition from "apiclient" to "googleapiclient". This transition should have been completed in the past 10 years. However now this is creating package pollution that interferes with another PyPI package called "api-client" that also writes to ".../site-packages/apiclient/" and conflicts with this package. BREAKING CHANGE: removes "apiclient" package which may still break those who haven't transitioned. --- MANIFEST.in | 1 - apiclient/__init__.py | 27 --------------------------- docs/build | 2 +- docs/media.md | 2 +- googleapiclient/discovery.py | 6 +++--- noxfile.py | 1 - samples/prediction/prediction.py | 2 +- setup.py | 2 +- tools/gae-zip-creator.sh | 4 ++-- 9 files changed, 9 insertions(+), 38 deletions(-) delete mode 100644 apiclient/__init__.py diff --git a/MANIFEST.in b/MANIFEST.in index 5b18ef64d9d..a45277d7ece 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -recursive-include apiclient *.json *.py recursive-include googleapiclient *.json *.py include CHANGELOG include LICENSE diff --git a/apiclient/__init__.py b/apiclient/__init__.py deleted file mode 100644 index e7f205af3d7..00000000000 --- a/apiclient/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Retain apiclient as an alias for googleapiclient.""" - -from googleapiclient import channel, discovery, errors, http, mimeparse, model - -try: - from googleapiclient import sample_tools -except ImportError: - # Silently ignore, because the vast majority of consumers won't use it and - # it has deep dependence on oauth2client, an optional dependency. - sample_tools = None -from googleapiclient import schema - -_SUBMODULES = { - "channel": channel, - "discovery": discovery, - "errors": errors, - "http": http, - "mimeparse": mimeparse, - "model": model, - "sample_tools": sample_tools, - "schema": schema, -} - -import sys - -for module_name, module in _SUBMODULES.items(): - sys.modules["apiclient.%s" % module_name] = module diff --git a/docs/build b/docs/build index 4792292f364..21095970022 100755 --- a/docs/build +++ b/docs/build @@ -17,7 +17,7 @@ # Author: jcgregorio@google.com (Joe Gregorio) # # Creates the documentation set for the library by -# running pydoc on all the files in apiclient. +# running pydoc on all the files in googleapiclient. # # Notes: You may have to update the location of the # App Engine library for your local system. diff --git a/docs/media.md b/docs/media.md index 433c01b4823..329c2d19422 100644 --- a/docs/media.md +++ b/docs/media.md @@ -60,7 +60,7 @@ If a request fails, an [`googleapiclient.errors.HttpError`](https://googleapis.g The following is a good exception handling pattern for resumable media uploads: ```py -except apiclient.errors.HttpError, e: +except googleapiclient.errors.HttpError, e: if e.resp.status in [404]: # Start the upload all over again. elif e.resp.status in [500, 502, 503, 504]: diff --git a/googleapiclient/discovery.py b/googleapiclient/discovery.py index f7bbd77763c..3f722d43e8a 100644 --- a/googleapiclient/discovery.py +++ b/googleapiclient/discovery.py @@ -1506,9 +1506,9 @@ def new_batch_http_request(callback=None): callback: callable, A callback to be called for each response, of the form callback(id, response, exception). The first parameter is the request id, and the second is the deserialized response object. The - third is an apiclient.errors.HttpError exception object if an HTTP - error occurred while processing the request, or None if no error - occurred. + third is a googleapiclient.errors.HttpError exception object if an + HTTP error occurred while processing the request, or None if no + error occurred. Returns: A BatchHttpRequest object based on the discovery document. diff --git a/noxfile.py b/noxfile.py index b0f7f2d5a00..1645779b659 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,7 +20,6 @@ BLACK_VERSION = "black==22.3.0" ISORT_VERSION = "isort==5.10.1" BLACK_PATHS = [ - "apiclient", "googleapiclient", "scripts", "tests", diff --git a/samples/prediction/prediction.py b/samples/prediction/prediction.py index 67f14d71400..e1ef39b0e57 100644 --- a/samples/prediction/prediction.py +++ b/samples/prediction/prediction.py @@ -44,7 +44,7 @@ import sys import time -from apiclient import sample_tools +from googleapiclient import sample_tools from oauth2client import client diff --git a/setup.py b/setup.py index 6f735a2fc4b..1580446371a 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ from setuptools import setup -packages = ["apiclient", "googleapiclient", "googleapiclient/discovery_cache"] +packages = ["googleapiclient", "googleapiclient/discovery_cache"] install_requires = [ "httplib2>=0.19.0,<1.dev0", diff --git a/tools/gae-zip-creator.sh b/tools/gae-zip-creator.sh index 152d5f96eea..8cea85e3947 100755 --- a/tools/gae-zip-creator.sh +++ b/tools/gae-zip-creator.sh @@ -17,7 +17,7 @@ ENV_PATH=${ROOT_PATH}/ve LOG_PATH=${ROOT_PATH}/gae_zip_build.log # The api client version -APICLIENT_VERSION=$(python -c "import apiclient; print apiclient.__version__") +APICLIENT_VERSION=$(python -c "import googleapiclient; print googleapiclient.__version__") # Where to create the zip. DIST_PATH=$(pwd)/dist/gae @@ -57,7 +57,7 @@ echo "Built zip in ${ZIP_PATH}" # Sanity test the zip. # TODO (afshar): Run the complete test suite. echo "Sanity testing the zip:" -export SANITY_MODS="httplib2 apiclient uritemplate oauth2client" +export SANITY_MODS="httplib2 googleapiclient uritemplate oauth2client" export SANITY_ZIP=${ZIP_PATH} export PYTHONPATH=${ZIP_PATH} ${ENV_PATH}/bin/python -c "import sys, os