GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Change gcloud package to google.cloud by dhermes · Pull Request #2223 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Aug 30, 2016

Copy link
Copy Markdown
Contributor

Also use namespace packages throughout.

The commit messages will be quite useful, as almost all of them contain bash scripts used to generated the commit.

Fixes #1978

/cc @jonparrott


Currently the PR has problems (e.g. imports don't work for tox), but I wanted to get it out there as a start since it is such a monster.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dhermes dhermes added packaging do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Aug 30, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 30, 2016
theacodes
theacodes reviewed Aug 30, 2016
View reviewed changes
Comment thread google/__init__.py Outdated
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path___ = pkgutil.extend_path(__path__, __name__)

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
dhermes force-pushed the namespace-change branch from 45b46c8 to 102b781 Compare August 30, 2016 19:41
@daspecster

daspecster commented Aug 30, 2016

Copy link
Copy Markdown
Contributor

@dhermes, I'm sure this will break json-docs as well.
I can start playing with that from this branch though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Aug 30, 2016

Copy link
Copy Markdown
Contributor Author

@daspecster Definitely. I was planning on asking for your help at some point. Trying to get the basic tox envs working first.

daspecster reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes theacodes mentioned this pull request Aug 30, 2016
Running and bundling tests with namespace packages #2225
Closed
@dhermes
dhermes force-pushed the namespace-change branch from 4acb8ef to a30295d Compare September 3, 2016 04:41
dhermes added 21 commits September 6, 2016 09:30
@dhermes
Renaming gcloud/ directory to google/cloud/.
261c969
Done via:

$ mkdir google
$ git mv gcloud google/cloud
@dhermes
Renaming "import gcloud" statements as google.cloud.
e55a1d8
Done via:

$ git grep -l 'import gcloud' | \
> xargs sed -i s/'import gcloud'/'import google.cloud'/g
@dhermes
Renaming "from gcloud import *" statements as google.cloud.
416071b
Done via:

$ git grep -l 'from gcloud import' | \
> xargs sed -i s/'from gcloud import'/'from google.cloud import'/g
@dhermes
Renaming ">>> from gcloud.foo.bar import *" statements as google.cloud.
835578f
Done via:

$ git grep -l '>>> from gcloud.' | \
> xargs sed -i s/'>>> from gcloud.'/'>>> from google.cloud.'/g
@dhermes
Updating gcloud->google.cloud imports in gRPC rewrite scripts.
d05a9d4
@dhermes
Rename remaining "gcloud" imports as "google.cloud".
822e719
This was done entirely via sed. First checked that
the remaining imports were at the start of their
respective lines:

$ git grep 'from gcloud.*import' > anywhere.txt
$ git grep '^[[:space:]]*from gcloud.*import' > line_start.txt
$ diff -s anywhere.txt line_start.txt
Files anywhere.txt and line_start.txt are identical
$ rm -f anywhere.txt line_start.txt

Then put all the imports in a text file

$ git grep -h '^[[:space:]]*from gcloud.*import' > imports.txt

Then parsed that file to get a list of the modules:

$ cat << EOF > get_mods.py
> def get_import(line):
>     a, b, c, d = line.strip().split(None, 3)
>     assert a == 'from'
>     assert c == 'import'
>     try:
>         e, f, g = b.split('.', 2)
>     except ValueError:
>         e, f = b.split('.')
>     assert e == 'gcloud'
>     return f
>
> with open('imports.txt', 'rb') as file_obj:
>     imported = sorted(set(map(get_import, file_obj.readlines())))
>
> for mod in imported:
>     print(mod)
>
> EOF
$ python get_mods.py > mods.txt
$ rm -f imports.txt get_mods.py

Then using the list of modules to rewrite the imports

$ cat << 'EOF' > all-sed.sh
> for mod in $(cat mods.txt); do
>     git grep -l "from gcloud.${mod}" | \
>     xargs sed -i s/"from gcloud.${mod}"/"from google.cloud.${mod}"/g
> done
>
> EOF
$ /bin/bash all-sed.sh
$ rm -f all-sed.sh mods.txt
@dhermes
Renaming mentions of "gcloud-python" as "google-cloud-python".
ab18ce8
Done via:

$ git grep -l 'gcloud-python' | \
> xargs sed -i s/gcloud-python/google-cloud-python/g
@dhermes
Renaming mentions of "hack-on-gcloud" as "hack-on-google-cloud-python".
c13d2ec
Done via:

$ git grep -l 'hack-on-gcloud' | \
> xargs sed -i s/hack-on-gcloud/hack-on-google-cloud-python/g
@dhermes
Renaming mentions of "gcloud" docs automodules as "google.cloud".
f29999a
Done via:

$ git grep -l 'automodule:: gcloud' | \
> xargs sed -i s/'automodule:: gcloud'/'automodule:: google.cloud'/g
@dhermes
Renaming docs mentions of "gcloud" as "google-cloud".
f12fee4
Done via:

$ git grep -l '<gcloud.' | \
> xargs sed -i s/'<gcloud.'/'<google.cloud.'/g

$ git grep -l '`gcloud\.' | \
> xargs sed -i s/'`gcloud\.'/'`google.cloud.'/g
@dhermes
Renaming docs path in JSON docs (gcloud->google/cloud).
ae89f77
Done via:

$ git grep -l '"gcloud/' | \
> xargs sed -i s/'"gcloud\/'/'"google\/cloud\/'/g
@dhermes
Replacing usage of gcloud with google-cloud in docs config.
381d236
@dhermes
Replacing gcloud with google-cloud in scripts directory.
3649f3a
Many usages were ad-hoc so this was done by hand rather
than via a sed script.
@dhermes
Renaming all GCLOUD_* env. vars. as GOOGLE_CLOUD_*.
ab59f8d
Done via:

$ git grep -l 'GCLOUD_' | \
> xargs sed -i s/'GCLOUD_'/'GOOGLE_CLOUD_'/g
@dhermes
Renaming all GCloudError as GoogleCloudError.
e12cc95
Done via:

$ git grep -l GCloudError | \
> xargs sed -i s/GCloudError/GoogleCloudError/g
@dhermes
Renaming all ~gcloud references as google.cloud.
faab61c
Done via:

$ git grep -l '~gcloud' | \
> xargs sed -i s/'~gcloud'/'~google.cloud'/g
@dhermes
Cleaning up remaining renames of gcloud->google-cloud.
5910b22
@dhermes
Adding __init__.py to make google/ a package.
e6139ac
@dhermes
Adding __init__.py to make google/ a package.
73d2986
commit 6faf161
Author: Danny Hermes <[email protected]>
Date:   Tue Aug 30 12:39:46 2016 -0700

Converting almost all packages to namespace packages.

As a result, the module objects for those packages can no longer
contain members. Hence the following is no longer possible:

>>> from google.cloud import storage
>>> client = storage.Client()

The "_generated" packages have not been converted to namespace
packages and neither have "google.cloud.logging.handlers"
nor "google.cloud.logging.handlers.transports".

In addition, some members of "google.cloud.logging" have been
moved into "google.cloud.logging.client" in order to be
importable.

Finally, the unit tests all pass at this commit, but `tox`
fails to run them: the namespace imports appear broken to
`tox` even though they aren't broken to the `virtualenv`
for the given `tox` environment.
@dhermes
Fixing lint issues after package rename.
adf5e21
@dhermes
Fixing docs issues after package rename.
e03a7f8
tseaver
tseaver reviewed Sep 6, 2016
View reviewed changes
Comment thread google/cloud/_helpers.py
# pylint: disable=ungrouped-imports
from google.cloud.environment_vars import PROJECT
from google.cloud.environment_vars import CREDENTIALS
# pylint: enable=ungrouped-imports

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Sep 6, 2016

Copy link
Copy Markdown
Contributor Author

@tseaver Renames that are also a concern:

gcloud-python-expenses-demo
google-cloud-python.readthedocs.org
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver reviewed Sep 6, 2016
View reviewed changes
Comment thread google/cloud/datastore/batch.py
Helper method for ``Batch.put``.

:type entity_pb: :class:`google.cloud.datastore._generated.entity_pb2.Entity`
:type entity_pb: :class:`.datastore._generated.entity_pb2.Entity`

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes mentioned this pull request Sep 6, 2016
Add 'Client.list_projects'. #2254
Merged
@dhermes

dhermes commented Sep 6, 2016

Copy link
Copy Markdown
Contributor Author

@tseaver Other than the path changes on docstrings, anything else for me to do?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Sep 7, 2016

Copy link
Copy Markdown
Contributor

@dhermes Nope, I think we have to trust our tests here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Sep 7, 2016

Copy link
Copy Markdown
Contributor Author

@tseaver merging now to stop blocking other PRs and to avoid having a long Travis wait time. Will send the docstring fixes in a new PR ASAP. Also going to rename the repo immediately after merging

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
dhermes merged commit e407bfb into googleapis:master Sep 7, 2016
@dhermes
dhermes deleted the namespace-change branch September 7, 2016 17:09
@dhermes dhermes removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 7, 2016
@dhermes

dhermes commented Sep 7, 2016

Copy link
Copy Markdown
Contributor Author

FYI AppVeyor seems happy: https://ci.appveyor.com/project/dhermes/gcloud-python/build/1.0.631.master

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Sep 7, 2016
@dhermes
Updating some Sphinx class links.
69429ae
Follow-up to PR googleapis#2223. The Sphinx mechanism of using
a `.` to mean "go find this class" can be confusing,
so we make sure the `.` also is a relative path.
@dhermes dhermes mentioned this pull request Sep 7, 2016
Updating some Sphinx class links. #2257
Merged
@tseaver

tseaver commented Sep 7, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@dhermes System tests for pubsub and logging are failing, due to the namespace packages.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes mentioned this pull request Sep 7, 2016
Travis build broken due to GCLOUD --> GOOGLE_CLOUD rename #2259
Closed
@tseaver

tseaver commented Sep 7, 2016

Copy link
Copy Markdown
Contributor

I'm working on a fix for them.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Sep 7, 2016

Copy link
Copy Markdown
Contributor Author

Just filed #2259 for the overall fix. Something more specific busted for logging and pubsub?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Sep 7, 2016

Copy link
Copy Markdown
Contributor

Namespace packages break the client construction for pubsub and logging.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 7, 2016
Fix logging/pubub system tests #2260
Merged
Shorten instance ID to match restrictions. #2261
Merged
dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Sep 7, 2016
@dhermes
Updating some Sphinx class links.
d11baf2
Follow-up to PR googleapis#2223. The Sphinx mechanism of using
a `.` to mean "go find this class" can be confusing,
so we make sure the `.` also is a relative path.
@tseaver tseaver mentioned this pull request Sep 8, 2016
Revert change to User-Agent header #2271
Closed
This was referenced Sep 16, 2016
Removing pubsub and logging as namespace packages. #2334
Merged
Cut 0.19.0 release. #2270
Merged
parthea pushed a commit that referenced this pull request Mar 6, 2026
@raulcd @Linchin
chore: update PyPI URL for official nightly pyarrow repository (#2223)
9e81f4f
Co-authored-by: Lingqing Gan <[email protected]>
parthea pushed a commit that referenced this pull request Apr 1, 2026
@jialuoo
chore: Migrate maximum_op operator to SQLGlot (#2223)
613f990
Migrated the maximum_op and minimum_op operators to SQLGlot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement. packaging

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@dhermes @daspecster @tseaver @theacodes @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.