Skip to content

Commit

Permalink
feat: Declare [gcp] extras for google deps
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykGala committed Dec 9, 2024
1 parent ee8f7e2 commit 08c90a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ attrs = ">=21.3.0"
python-dateutil = "^2.8.0"
PyJWT = "^2.0.0"
protobuf = ">=4,<6"
google-cloud-iam = "^2.0.0"
google-auth = "^2.0.0"
google-cloud-iam = { version = "^2.0.0", optional = true }
google-auth = { version = "^2.0.0", optional = true }


[tool.poetry.extras]
gcp = ["google-auth", "google-cloud-iam"]

[tool.poetry]
name = "neptune-api"
Expand Down
4 changes: 2 additions & 2 deletions src/neptune_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,14 @@ async def async_auth_flow(self, request: httpx.Request) -> typing.AsyncGenerator
yield request


USE_IAP = os.environ.get("NEPTUNE_GCP_USE_IAP", False) in {"true", "t", "1", "True"}
USE_IAP = os.environ.get("NEPTUNE_GCP_USE_IAP", "false").lower() in {"true", "t", "1"}

if USE_IAP:
import google.auth
from google.cloud import iam_credentials_v1

NEPTUNE_IAP_SERVICE_ACCOUNT = _get_env(
"NEPTUNE_GCP_IAP_SERVICE_ACCOUNT", "NEPTUNE_GCP_IAP_SERVICE_ACCOUNT is not set"
"NEPTUNE_GCP_IAP_SERVICE_ACCOUNT", "NEPTUNE_GCP_IAP_SERVICE_ACCOUNT is not set for IAP authentication"
)

@dataclass
Expand Down

0 comments on commit 08c90a9

Please sign in to comment.