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
Please see RELEASE.md for the release process.
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
Metadata
Release files for h2o-cloud-discovery 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h2o_cloud_discovery-3.3.0.tar.gz | 20.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h2o_cloud_discovery-3.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.6 kB
Release files / h2o_cloud_discovery-3.3.0.tar.gz
| Download URL | h2o_cloud_discovery-3.3.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2477859de5206450d249e4524c313707947e1932403c0268f201c5cee66a933b
|
|
BLAKE2b-256 checksum How to use checksums |
983026bcab4a7b0a8f382a6b7669c1bb51ff708445ce41652126e7abd1c40891
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / h2o_cloud_discovery-3.3.0-py3-none-any.whl
| Download URL | h2o_cloud_discovery-3.3.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f7aab1464a7ad114dff17f397c256c7118d7eefdf60640179e490f96534d322
|
|
BLAKE2b-256 checksum How to use checksums |
689f078e2846e98b7d21e908c35eb378417e919a99532b97b9aa81496078cda2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|