poelis-sdk 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of poelis-sdk might be problematic. Click here for more details.

poelis_sdk/__init__.py CHANGED
@@ -1,8 +1,29 @@
1
- """Poelis Python SDK public exports."""
1
+ """Poelis Python SDK public exports.
2
+
3
+ Exposes the primary client and resolves the package version from installed
4
+ metadata so it stays in sync with ``pyproject.toml`` without manual edits.
5
+ """
6
+
7
+ from importlib import metadata
2
8
 
3
9
  from .client import PoelisClient
4
10
 
5
- __version__ = "0.1.0"
6
- __all__ = ["PoelisClient"]
11
+ __all__ = ["PoelisClient", "__version__"]
12
+
13
+ def _resolve_version() -> str:
14
+ """Return installed package version or a dev fallback.
15
+
16
+ Returns:
17
+ str: Version string from package metadata, or ``"0.0.0-dev"`` when
18
+ metadata is unavailable (e.g., editable installs without built metadata).
19
+ """
20
+
21
+ try:
22
+ return metadata.version("poelis-sdk")
23
+ except metadata.PackageNotFoundError:
24
+ return "0.0.0-dev"
25
+
26
+
27
+ __version__: str = _resolve_version()
7
28
 
8
29
 
poelis_sdk/_transport.py CHANGED
@@ -1,19 +1,18 @@
1
1
  from __future__ import annotations
2
2
 
3
- """HTTP transport abstraction for the Poelis SDK.
4
-
5
- Provides a thin wrapper around httpx with sensible defaults for timeouts,
6
- retries, and headers including authentication and optional org scoping.
7
- """
8
-
9
3
  from typing import Any, Dict, Mapping, Optional
10
-
11
4
  import time
12
5
  import random
13
6
  import httpx
14
7
 
15
8
  from .exceptions import ClientError, HTTPError, NotFoundError, RateLimitError, ServerError, UnauthorizedError
16
9
 
10
+ """HTTP transport abstraction for the Poelis SDK.
11
+
12
+ Provides a thin wrapper around httpx with sensible defaults for timeouts,
13
+ retries, and headers including authentication and optional org scoping.
14
+ """
15
+
17
16
 
18
17
  class Transport:
19
18
  """Synchronous HTTP transport using httpx.Client.
poelis_sdk/browser.py CHANGED
@@ -1,14 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from typing import Any, Dict, List, Optional
4
+ import re
5
+
3
6
  """GraphQL-backed dot-path browser for Poelis SDK.
4
7
 
5
8
  Provides lazy, name-based navigation across workspaces → products → items → child items,
6
9
  with optional property listing on items. Designed for notebook UX.
7
10
  """
8
11
 
9
- from typing import Any, Dict, List, Optional
10
- import re
11
-
12
12
 
13
13
  class _Node:
14
14
  def __init__(self, client: Any, level: str, parent: Optional["_Node"], node_id: Optional[str], name: Optional[str]) -> None:
poelis_sdk/client.py CHANGED
@@ -1,14 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Core client for the Poelis Python SDK.
4
-
5
- This module exposes the `PoelisClient` which configures base URL, authentication,
6
- tenant scoping, and provides accessors for resource clients. The initial
7
- implementation is sync-first and keeps the transport layer swappable for
8
- future async parity.
9
- """
10
-
11
3
  from typing import Optional
4
+ import os
12
5
 
13
6
  from pydantic import BaseModel, Field, HttpUrl
14
7
  from ._transport import Transport
@@ -17,7 +10,14 @@ from .items import ItemsClient
17
10
  from .search import SearchClient
18
11
  from .workspaces import WorkspacesClient
19
12
  from .browser import Browser
20
- import os
13
+
14
+ """Core client for the Poelis Python SDK.
15
+
16
+ This module exposes the `PoelisClient` which configures base URL, authentication,
17
+ tenant scoping, and provides accessors for resource clients. The initial
18
+ implementation is sync-first and keeps the transport layer swappable for
19
+ future async parity.
20
+ """
21
21
 
22
22
 
23
23
  class ClientConfig(BaseModel):
@@ -30,7 +30,7 @@ class ClientConfig(BaseModel):
30
30
  timeout_seconds: Request timeout in seconds.
31
31
  """
32
32
 
33
- base_url: HttpUrl
33
+ base_url: HttpUrl = Field(default="https://poelis-be-py-753618215333.europe-west1.run.app")
34
34
  api_key: str = Field(min_length=1)
35
35
  org_id: str = Field(min_length=1)
36
36
  timeout_seconds: float = 30.0
@@ -44,13 +44,13 @@ class PoelisClient:
44
44
  resource accessors to unblock incremental development.
45
45
  """
46
46
 
47
- def __init__(self, base_url: str, api_key: str, org_id: str, timeout_seconds: float = 30.0) -> None:
47
+ def __init__(self, api_key: str, org_id: str, base_url: str = "https://poelis-be-py-753618215333.europe-west1.run.app", timeout_seconds: float = 30.0) -> None:
48
48
  """Initialize the client with API endpoint and credentials.
49
49
 
50
50
  Args:
51
- base_url: Base URL of the Poelis API.
52
51
  api_key: API key for API authentication.
53
52
  org_id: Tenant organization id to scope requests.
53
+ base_url: Base URL of the Poelis API. Defaults to production.
54
54
  timeout_seconds: Network timeout in seconds.
55
55
  """
56
56
 
@@ -81,23 +81,21 @@ class PoelisClient:
81
81
  """Construct a client using environment variables.
82
82
 
83
83
  Expected variables:
84
- - POELIS_BASE_URL
84
+ - POELIS_BASE_URL (optional, defaults to managed GCP endpoint)
85
85
  - POELIS_API_KEY
86
86
  - POELIS_ORG_ID
87
87
  """
88
88
 
89
- base_url = os.environ.get("POELIS_BASE_URL")
89
+ base_url = os.environ.get("POELIS_BASE_URL", "https://poelis-be-py-753618215333.europe-west1.run.app")
90
90
  api_key = os.environ.get("POELIS_API_KEY")
91
91
  org_id = os.environ.get("POELIS_ORG_ID")
92
92
 
93
- if not base_url:
94
- raise ValueError("POELIS_BASE_URL must be set")
95
93
  if not api_key:
96
94
  raise ValueError("POELIS_API_KEY must be set")
97
95
  if not org_id:
98
96
  raise ValueError("POELIS_ORG_ID must be set")
99
97
 
100
- return cls(base_url=base_url, api_key=api_key, org_id=org_id)
98
+ return cls(api_key=api_key, org_id=org_id, base_url=base_url)
101
99
 
102
100
  @property
103
101
  def base_url(self) -> str:
poelis_sdk/exceptions.py CHANGED
@@ -1,9 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
- """SDK exception hierarchy for Poelis."""
4
-
5
3
  from typing import Optional
6
4
 
5
+ """SDK exception hierarchy for Poelis."""
6
+
7
7
 
8
8
  class PoelisError(Exception):
9
9
  """Base SDK exception."""
poelis_sdk/items.py CHANGED
@@ -1,11 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Items resource client."""
4
-
5
3
  from typing import Generator, Any, Optional, Dict, List
6
4
 
7
5
  from ._transport import Transport
8
6
 
7
+ """Items resource client."""
8
+
9
9
 
10
10
  class ItemsClient:
11
11
  """Client for item resources (prototype exposes listing iterator only)."""
poelis_sdk/models.py CHANGED
@@ -1,11 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Pydantic models for SDK resources."""
4
-
5
3
  from typing import Optional
6
4
 
7
5
  from pydantic import BaseModel, Field
8
6
 
7
+ """Pydantic models for SDK resources."""
8
+
9
9
 
10
10
  class Product(BaseModel):
11
11
  """Product resource representation."""
poelis_sdk/products.py CHANGED
@@ -1,12 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Products resource client."""
4
-
5
3
  from typing import Generator, Optional, List
6
4
 
7
5
  from ._transport import Transport
8
6
  from .models import PaginatedProducts, Product
9
7
 
8
+ """Products resource client."""
9
+
10
10
 
11
11
  class ProductsClient:
12
12
  """Client for product resources."""
poelis_sdk/search.py CHANGED
@@ -1,11 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Search resource client using GraphQL endpoints only."""
4
-
5
3
  from typing import Any, Dict, Optional
6
4
 
7
5
  from ._transport import Transport
8
6
 
7
+ """Search resource client using GraphQL endpoints only."""
8
+
9
9
 
10
10
  class SearchClient:
11
11
  """Client for /v1/search endpoints (products, items, properties)."""
poelis_sdk/workspaces.py CHANGED
@@ -1,11 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
- """Workspaces GraphQL client."""
4
-
5
3
  from typing import Any, Dict, List, Optional
6
4
 
7
5
  from ._transport import Transport
8
6
 
7
+ """Workspaces GraphQL client."""
8
+
9
9
 
10
10
  class WorkspacesClient:
11
11
  """Client for querying workspaces via GraphQL."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: poelis-sdk
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Official Python SDK for Poelis
5
5
  Project-URL: Homepage, https://poelis.ai
6
6
  Project-URL: Source, https://github.com/PoelisTechnologies/poelis-python-sdk
@@ -31,9 +31,9 @@ GraphQL-first Python SDK for Poelis with a focus on great developer experience.
31
31
  from poelis_sdk import PoelisClient
32
32
 
33
33
  client = PoelisClient(
34
- base_url="https://api.poelis.ai", # or your environment
35
34
  api_key="poelis_live_A1B2C3...", # Organization Settings → API Keys
36
35
  org_id="tenant_uci_001", # same section
36
+ # base_url defaults to https://api.poelis.ai
37
37
  )
38
38
 
39
39
  # Workspaces → Products (GraphQL)
@@ -57,9 +57,11 @@ print(props["total"], len(props["hits"]))
57
57
 
58
58
  ### Base URL
59
59
 
60
- - Local development: `http://localhost:8000`
61
- - Staging (example): `https://api.staging.poelis.ai`
62
- - Production (example): `https://api.poelis.ai`
60
+ The SDK defaults to the production API (`https://api.poelis.ai`). You can override this for different environments:
61
+
62
+ - Local development: `base_url="http://localhost:8000"`
63
+ - Staging (example): `base_url="https://api.staging.poelis.ai"`
64
+ - Production (default): No need to specify, uses `https://api.poelis.ai`
63
65
 
64
66
  Confirm the exact URLs for your environments.
65
67
 
@@ -74,9 +76,9 @@ Note: Multi-tenancy uses `org_id` for scoping. When using API keys, the SDK sets
74
76
  5. You can rotate or revoke keys anytime. Prefer storing as env vars:
75
77
 
76
78
  ```bash
77
- export POELIS_BASE_URL=https://api.poelis.ai
78
79
  export POELIS_API_KEY=poelis_live_A1B2C3...
79
80
  export POELIS_ORG_ID=tenant_uci_001
81
+ # POELIS_BASE_URL is optional - defaults to https://api.poelis.ai
80
82
  ```
81
83
 
82
84
 
@@ -0,0 +1,17 @@
1
+ poelis_sdk/__init__.py,sha256=QzPuy0lsmF0JEOrcnHDWsUfR_WCO1XpegwrYpSGyUVI,738
2
+ poelis_sdk/_transport.py,sha256=0yLpcMbZB7KUmBBG3epwbGi2NwOqt0dwMBYh-Y8o6Pc,5830
3
+ poelis_sdk/browser.py,sha256=zyMoNqFCvKZDV4ZSFVk2N1-HHiq80gzmkGN3uRo1CuM,12409
4
+ poelis_sdk/client.py,sha256=Sr05go8eNpEXswWAhomQuSakE5Oai_kUsGDwHgPnnLY,3731
5
+ poelis_sdk/exceptions.py,sha256=qX5kpAr8ozJUOW-CNhmspWVIE-bvUZT_PUnimYuBxNY,1101
6
+ poelis_sdk/items.py,sha256=uFm-fu16QUOsVnlnEDF012zpgvySlN9N0SXMwIWXeOw,2183
7
+ poelis_sdk/models.py,sha256=zKbqHkK2xOdkqWUQlmu-BZ0Zyj8uC2d10PK69f3QUHo,470
8
+ poelis_sdk/products.py,sha256=Byc5XBNruIO-vAGxDom0lRWA3xxD6korMhoajPz83R4,2073
9
+ poelis_sdk/search.py,sha256=YxtjR8AD6tOeVNTVWc8J_l9YkVu2f-EnC_udkMAeFiM,4122
10
+ poelis_sdk/workspaces.py,sha256=LNVt73nqdssNx42_YB_V5Qp35kEdFn9rNBYmEjpM7vk,1518
11
+ poelis_sdk/.github/workflows/sdk-ci.yml,sha256=hWO-igHeTAsxEJGCueteEQnAEi00GWXJJPa8DWgqhHM,750
12
+ poelis_sdk/.github/workflows/sdk-docs.yml,sha256=bS1uUxOKRMA6TWrmzzJHTokyP0Nt0aJwojcLAgLoEhs,1166
13
+ poelis_sdk/.github/workflows/sdk-publish-testpypi.yml,sha256=FBZcfDrtUijs6rcC8WeIimi9SfgoB8Xm5pTNtcztT44,776
14
+ poelis_sdk-0.1.2.dist-info/METADATA,sha256=jGVzZZFVynSO28j2FE02st7UekeGOZEGRxaJP08zu3U,3280
15
+ poelis_sdk-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ poelis_sdk-0.1.2.dist-info/licenses/LICENSE,sha256=EEmE_r8wk_pdXB8CWp1LG6sBOl7--hNSS2kV94cI6co,1075
17
+ poelis_sdk-0.1.2.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- poelis_sdk/__init__.py,sha256=6pyvKcM6imsuCMm-VIINFNa-hXK9fUmcg86EWshPAlk,126
2
- poelis_sdk/_transport.py,sha256=RIyBffRR-9uz2iUb46AcRSR8rtsuyjSjFeY-EZ-BtP8,5831
3
- poelis_sdk/browser.py,sha256=2LblJveGsFMRXCK45S8hM1j3cWowLYYiR_YR7D6dQn8,12409
4
- poelis_sdk/client.py,sha256=lNjBZ7vVNsHzsHfkpxKdkP9UYjjBuzutS7tZXVSvtQI,3556
5
- poelis_sdk/exceptions.py,sha256=O7LJn8ZH1ZpaAx7xk7rnxkp6VgJy8ZbSV7yX6arI2tE,1101
6
- poelis_sdk/items.py,sha256=uKs9LBMP3en_TkUCkzj53KTfGeSjph5E3mfXeAl_YO0,2183
7
- poelis_sdk/models.py,sha256=OtGuv8w4n6p6X_Qlm8dE2B2Apq10gqwyPopitLz9A1Q,470
8
- poelis_sdk/products.py,sha256=qyZz-QnLgXTgxAXuTbnLEjIE_GrobtfVKkyIRSe7hxU,2073
9
- poelis_sdk/search.py,sha256=FSLkczztSQoYfolMRhUAZ7M4wI8PIeE6Ny0c40LGKng,4122
10
- poelis_sdk/workspaces.py,sha256=kqxIoFlSdaTWdeARjZgTUs_Gy-GF-tkRZCNKCChNsug,1518
11
- poelis_sdk/.github/workflows/sdk-ci.yml,sha256=hWO-igHeTAsxEJGCueteEQnAEi00GWXJJPa8DWgqhHM,750
12
- poelis_sdk/.github/workflows/sdk-docs.yml,sha256=bS1uUxOKRMA6TWrmzzJHTokyP0Nt0aJwojcLAgLoEhs,1166
13
- poelis_sdk/.github/workflows/sdk-publish-testpypi.yml,sha256=FBZcfDrtUijs6rcC8WeIimi9SfgoB8Xm5pTNtcztT44,776
14
- poelis_sdk-0.1.0.dist-info/METADATA,sha256=l9QximRzNb7kkKnqYLQjTT5xQo7IaOieH-2PqpU9gmQ,3108
15
- poelis_sdk-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- poelis_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=EEmE_r8wk_pdXB8CWp1LG6sBOl7--hNSS2kV94cI6co,1075
17
- poelis_sdk-0.1.0.dist-info/RECORD,,