H2O Cloud Discovery Python CLient
Project description
h2o-cloud-discovery
H2O Cloud Discovery Client.
Installation
pip install h2o-cloud-discovery
Usage
Package provides two main functions. Synchronous h2o_discovery.discover()
and asynchronous h2o_discovery.discover_async()
. Both functions return
a discovery object that can be used to obtain the information the H2O Cloud
environment, its services and clients.
When used within the H2O AI Cloud environment or locally with the H2O AI Cloud CLI configured, no further configuration is needed.
Both functions accept a environment
argument that can be used to specify the
H2O Cloud environment for which the discovery should be performed.
Alternatively, the H2O_CLOUD_ENVIRONMENT
environment variables can be used.
See API documentation for more details.
import h2o_discovery
discovery = h2o_discovery.discover()
# Print the H2O Cloud environment that was discovered.
print(discovery.environment.h2o_cloud_environment)
# Connect to the my service.
my_service_client = my_service.client(address=discovery.services["my-service"].uri)
Examples
Example: Use within a notebook to connect to the H2O AI Drive
# Install required packages.
import sys
!{sys.executable} -m pip install h2o-cloud-discovery h2o-authn[discovery]
# Load discovery for the current environment.
import h2o_discovery
discovery = h2o_discovery.discover()
# Create a token provider using the credentials loaded from the environment.
import h2o_authn.discovery
token_provider = h2o_authn.discovery.create_async(discovery)
# Install the H2O AI Drive client in the version specified by the available
# service.
import sys
!{sys.executable} -m pip install '{discovery.services["drive"].python_client}'
# Connect to the H2O AI Drive and list home objects.
import h2o_drive
home = await h2o_drive.MyHome(
token=token_provider,
endpoint_url=discovery.services["drive"].uri,
)
await home.list_objects()
Development
Project is managed using Hatch.
Testing
For quick development tests use:
hatch run devtest:pytest
Full test matrix can be run using:
hatch env remove test && hatch run test:pytest
Linting
hatch run lint:check
Formating and imports can be fixed using:
hatch run lint:fix
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file h2o_cloud_discovery-2.1.1.tar.gz
.
File metadata
- Download URL: h2o_cloud_discovery-2.1.1.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 754375697d002cb32d97997924e5774216cf948eecedf55e48e8fb8c82ba97bf |
|
MD5 | 13a4f96556b34cca5b4a56d3e7d3e59c |
|
BLAKE2b-256 | 54182c168cffc2e484c7c8084e056ea24ec5e9f12e46860616fc873aad22b7aa |
File details
Details for the file h2o_cloud_discovery-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: h2o_cloud_discovery-2.1.1-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7da48859e4e4c70ac9077f382c4ef77475839435395d10369f302f9acbc61ac0 |
|
MD5 | 0c6db5947a3dc0dc9a882293d14a93aa |
|
BLAKE2b-256 | dc40d9a79d49037d50e1a8c997910692993bd5da4b2600ee82c5b97f131ef2d6 |