pygooglecloud package¶
Submodules¶
pygooglecloud.configs module¶
All configurations for pygooglecloud
pygooglecloud.main module¶
The default group of operations that pygooglecloud has
- pygooglecloud.main.check_credentials() None[source]¶
Verify that local Google credentials are present and well-formed.
This is a pure local-file check with NO network call, so it is safe to run from a shell startup hook without slowing down directory changes. It does not (and cannot, without the network) detect a key that has been disabled or revoked server-side; it catches the common cases of a missing or corrupt credentials file.
Two credential styles, with advice tailored to each: - service-account key: GOOGLE_APPLICATION_CREDENTIALS points at a JSON key
file (as set per-repo from the .gcp.conf project). A missing or malformed file means the key needs to be (re)placed.
user login: no GOOGLE_APPLICATION_CREDENTIALS; the gcloud Application Default Credentials file is used, refreshed via gcloud auth … login.
On success this is silent (so it adds no noise to a shell startup hook); only failures are reported, on stderr, with a non-zero exit.
- pygooglecloud.main.get_project_id() None[source]¶
Print the GCP project id for this repository.
The project is resolved purely from local files (no network, no ADC): 1. read ./.gcp.conf (at the git root) for the gcloud configuration name 2. read that gcloud configuration’s [core] project
Failures are reported as short one-line messages, no traceback.
- pygooglecloud.main.read_gcp_conf(text: str) dict[str, str][source]¶
Return the scalar key=value assignments of a .gcp.conf.
.gcp.conf is sourced by bash (the gcloud_*.sh scripts of utils-bash), so besides plain key=value lines it holds comments, blank lines and bash arrays such as:
- gcp_run_args=(
–allow-unauthenticated
)
Only the scalar assignments matter here; arrays are skipped up to their closing parenthesis, and a one-line array key=(…) is skipped too. Values keep their surrounding quotes stripped but are not otherwise expanded, so a value that references another variable comes back as written.
pygooglecloud.static module¶
version which can be consumed from within the module
Module contents¶
Initialize the module