filament-api 0.8.2__tar.gz

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.
Files changed (75) hide show
  1. filament_api-0.8.2/LICENSE +21 -0
  2. filament_api-0.8.2/PKG-INFO +290 -0
  3. filament_api-0.8.2/README.md +258 -0
  4. filament_api-0.8.2/pyproject.toml +86 -0
  5. filament_api-0.8.2/src/filament/__init__.py +79 -0
  6. filament_api-0.8.2/src/filament/_client.py +2446 -0
  7. filament_api-0.8.2/src/filament/_compression.py +229 -0
  8. filament_api-0.8.2/src/filament/_condition_builder.py +517 -0
  9. filament_api-0.8.2/src/filament/_exceptions.py +77 -0
  10. filament_api-0.8.2/src/filament/_file_upload.py +156 -0
  11. filament_api-0.8.2/src/filament/_serialization.py +831 -0
  12. filament_api-0.8.2/src/filament/_specified_properties.py +79 -0
  13. filament_api-0.8.2/src/filament/_wire_formats.py +113 -0
  14. filament_api-0.8.2/src/filament/py.typed +0 -0
  15. filament_api-0.8.2/src/filament/types/__init__.py +3 -0
  16. filament_api-0.8.2/src/filament/types/conditions.py +668 -0
  17. filament_api-0.8.2/src/filament/types/generated/__init__.py +8 -0
  18. filament_api-0.8.2/src/filament/types/generated/api.py +218 -0
  19. filament_api-0.8.2/src/filament/types/generated/base/__init__.py +2 -0
  20. filament_api-0.8.2/src/filament/types/generated/base/base.py +90 -0
  21. filament_api-0.8.2/src/filament/types/generated/connections/__init__.py +14 -0
  22. filament_api-0.8.2/src/filament/types/generated/connections/api_key_service.py +15 -0
  23. filament_api-0.8.2/src/filament/types/generated/connections/cast_service.py +60 -0
  24. filament_api-0.8.2/src/filament/types/generated/connections/event_service.py +60 -0
  25. filament_api-0.8.2/src/filament/types/generated/connections/generic.py +131 -0
  26. filament_api-0.8.2/src/filament/types/generated/connections/note_service.py +22 -0
  27. filament_api-0.8.2/src/filament/types/generated/connections/schedule_service.py +40 -0
  28. filament_api-0.8.2/src/filament/types/generated/connections/scope_item_service.py +125 -0
  29. filament_api-0.8.2/src/filament/types/generated/connections/scope_service.py +22 -0
  30. filament_api-0.8.2/src/filament/types/generated/connections/scope_task_type_service.py +45 -0
  31. filament_api-0.8.2/src/filament/types/generated/connections/scope_template_item_service.py +19 -0
  32. filament_api-0.8.2/src/filament/types/generated/connections/specialty_service.py +15 -0
  33. filament_api-0.8.2/src/filament/types/generated/connections/task_service.py +112 -0
  34. filament_api-0.8.2/src/filament/types/generated/connections/user_service.py +24 -0
  35. filament_api-0.8.2/src/filament/types/generated/entities/__init__.py +35 -0
  36. filament_api-0.8.2/src/filament/types/generated/entities/actual_service.py +81 -0
  37. filament_api-0.8.2/src/filament/types/generated/entities/api_key_service.py +34 -0
  38. filament_api-0.8.2/src/filament/types/generated/entities/availability_service.py +55 -0
  39. filament_api-0.8.2/src/filament/types/generated/entities/cast_service.py +28 -0
  40. filament_api-0.8.2/src/filament/types/generated/entities/core.py +392 -0
  41. filament_api-0.8.2/src/filament/types/generated/entities/currency_service.py +52 -0
  42. filament_api-0.8.2/src/filament/types/generated/entities/current_instant_service.py +36 -0
  43. filament_api-0.8.2/src/filament/types/generated/entities/event_service.py +108 -0
  44. filament_api-0.8.2/src/filament/types/generated/entities/file_settings_service.py +31 -0
  45. filament_api-0.8.2/src/filament/types/generated/entities/generic.py +107 -0
  46. filament_api-0.8.2/src/filament/types/generated/entities/media_service.py +114 -0
  47. filament_api-0.8.2/src/filament/types/generated/entities/note_service.py +60 -0
  48. filament_api-0.8.2/src/filament/types/generated/entities/organization_service.py +109 -0
  49. filament_api-0.8.2/src/filament/types/generated/entities/permissions_service.py +169 -0
  50. filament_api-0.8.2/src/filament/types/generated/entities/review_group_service.py +32 -0
  51. filament_api-0.8.2/src/filament/types/generated/entities/schedule_service.py +241 -0
  52. filament_api-0.8.2/src/filament/types/generated/entities/schedule_settings_service.py +184 -0
  53. filament_api-0.8.2/src/filament/types/generated/entities/scope_category_service.py +31 -0
  54. filament_api-0.8.2/src/filament/types/generated/entities/scope_cost_service.py +55 -0
  55. filament_api-0.8.2/src/filament/types/generated/entities/scope_group_service.py +76 -0
  56. filament_api-0.8.2/src/filament/types/generated/entities/scope_item_service.py +175 -0
  57. filament_api-0.8.2/src/filament/types/generated/entities/scope_milestone_service.py +47 -0
  58. filament_api-0.8.2/src/filament/types/generated/entities/scope_service.py +70 -0
  59. filament_api-0.8.2/src/filament/types/generated/entities/scope_task_type_service.py +99 -0
  60. filament_api-0.8.2/src/filament/types/generated/entities/scope_template_item_service.py +44 -0
  61. filament_api-0.8.2/src/filament/types/generated/entities/skill_service.py +102 -0
  62. filament_api-0.8.2/src/filament/types/generated/entities/skill_type_service.py +30 -0
  63. filament_api-0.8.2/src/filament/types/generated/entities/specialty_service.py +23 -0
  64. filament_api-0.8.2/src/filament/types/generated/entities/task_service.py +233 -0
  65. filament_api-0.8.2/src/filament/types/generated/entities/task_status_service.py +49 -0
  66. filament_api-0.8.2/src/filament/types/generated/entities/time_log_service.py +47 -0
  67. filament_api-0.8.2/src/filament/types/generated/entities/user_license_service.py +68 -0
  68. filament_api-0.8.2/src/filament/types/generated/entities/user_service.py +152 -0
  69. filament_api-0.8.2/src/filament/types/generated/entities/user_settings_service.py +37 -0
  70. filament_api-0.8.2/src/filament/types/generated/enums.py +1264 -0
  71. filament_api-0.8.2/src/filament/types/generated/misc.py +1343 -0
  72. filament_api-0.8.2/src/filament/types/generated/shared.py +58 -0
  73. filament_api-0.8.2/src/filament/types/options.py +286 -0
  74. filament_api-0.8.2/src/filament/user_defined_properties.py +359 -0
  75. filament_api-0.8.2/src/filament_mypy_plugin.py +242 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Filament Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.4
2
+ Name: filament-api
3
+ Version: 0.8.2
4
+ Summary: Async Python client for the Filament platform, communicating over SignalR
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Author: Filament Software
8
+ Requires-Python: >=3.10,<4.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Framework :: AsyncIO
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Provides-Extra: crc32c
21
+ Requires-Dist: brotli (>=1.2)
22
+ Requires-Dist: google-crc32c (>=1.5) ; extra == "crc32c"
23
+ Requires-Dist: httpx (>=0.27)
24
+ Requires-Dist: pysignalr (>=1.3.0)
25
+ Requires-Dist: uuid-utils (>=0.9)
26
+ Project-URL: Documentation, https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md
27
+ Project-URL: Homepage, https://github.com/FilamentSoftware/filament-api-python
28
+ Project-URL: Issues, https://github.com/FilamentSoftware/filament-api-python/issues
29
+ Project-URL: Repository, https://github.com/FilamentSoftware/filament-api-python
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Filament Python API
33
+
34
+ An async Python client for the Filament platform, communicating over SignalR.
35
+
36
+ ## Documentation
37
+
38
+ Full, multi-page documentation lives in [`docs/`](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md):
39
+
40
+ - [Getting Started](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/getting-started.md) — install, connect, authenticate, error handling
41
+ - [Finding Entity & Connection Types](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/finding-types.md) — where every type and enum lives
42
+ - [Type Reference](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/type-reference.md) — auto-generated catalogue of every entity, connection, and enum
43
+ - [Reading Data](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/reading-data.md) — queries, ordering, paging, projections
44
+ - [Building Conditions](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/conditions.md) — the typed condition builder and operators
45
+ - [Modifying Data](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/modifying-data.md) — create, update, delete, partial updates
46
+ - [User-defined Properties](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/user-defined-properties.md) — discover, read, write, query, and administer runtime properties
47
+ - [Subscriptions](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/subscriptions.md) — real-time updates and lifecycle events
48
+ - [Data Options](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/data-options.md) — the typed `DataOption` key-value type
49
+ - [API Reference](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/api-reference.md) — `FilamentClient`, the response envelope, exceptions
50
+
51
+ Runnable scripts are in [`examples/`](https://github.com/FilamentSoftware/filament-api-python/tree/main/examples/). The sections below are a quick
52
+ overview; see the docs for the full detail.
53
+
54
+ ### Claude Code skill
55
+
56
+ This repo doubles as a [Claude Code](https://claude.com/claude-code) plugin that
57
+ ships a `using-filament-api` skill. Install it in any project that uses this
58
+ package so Claude has the API reference on hand:
59
+
60
+ ```text
61
+ /plugin marketplace add FilamentSoftware/filament-api-python
62
+ /plugin install filament-api@filament
63
+ ```
64
+
65
+ The skill routes Claude to the bundled [`docs/`](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md) — it stays in
66
+ sync with the documentation rather than duplicating it. Once installed, invoke it
67
+ with `/filament-api:using-filament-api`.
68
+
69
+ ## Requirements
70
+
71
+ - Python 3.10, 3.11, 3.12, or 3.13
72
+
73
+ ## Installation
74
+
75
+ Stable releases are published to [PyPI](https://pypi.org/project/filament-api/):
76
+
77
+ ```bash
78
+ pip install filament-api
79
+ # or
80
+ poetry add filament-api
81
+ ```
82
+
83
+ If your deployment's file store uses CRC32C checksums (GCS), install the
84
+ `crc32c` extra:
85
+
86
+ ```bash
87
+ pip install "filament-api[crc32c]"
88
+ ```
89
+
90
+ ### Installing from the internal index (Filament staff / dev builds)
91
+
92
+ Every release, including the development builds cut from `develop`, is also
93
+ published to Filament's internal Google Cloud Artifact Registry. Its virtual
94
+ repository serves those releases together with a mirror of PyPI, so use it as
95
+ your **only** index (`--index-url`, not `--extra-index-url`, which would let a
96
+ same-named package on PyPI compete with the internal one).
97
+
98
+ Access requires the `roles/artifactregistry.reader` role on the repository and
99
+ [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials)
100
+ (e.g. `gcloud auth application-default login`). Ask your Filament contact for
101
+ access.
102
+
103
+ With pip:
104
+
105
+ ```bash
106
+ pip install keyrings.google-artifactregistry-auth
107
+ pip install --index-url https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/ filament-api
108
+ ```
109
+
110
+ With Poetry:
111
+
112
+ ```bash
113
+ poetry self add keyrings.google-artifactregistry-auth
114
+ poetry source add --priority=primary filament-internal https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/
115
+ poetry add filament-api
116
+ ```
117
+
118
+ Dev builds are PEP 440 pre-releases (e.g. `0.8.1.dev4`), so installers skip
119
+ them unless asked. Use `pip install --pre ...`, pin an exact version
120
+ (`filament-api==0.8.1.dev4`), or `poetry add filament-api --allow-prereleases`
121
+ (which sets `allow-prereleases = true` on the dependency).
122
+
123
+ ## Usage
124
+
125
+ ```python
126
+ import asyncio
127
+ import filament
128
+ from filament.types import ReadDataRequest, ReadDataTypeRequest
129
+
130
+ async def main() -> None:
131
+ async with filament.FilamentClient(
132
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
133
+ ) as f:
134
+ result = await f.read_data(
135
+ ReadDataRequest(request=ReadDataTypeRequest(type_name="UserEntity"))
136
+ )
137
+
138
+ asyncio.run(main())
139
+ ```
140
+
141
+ The server, port, and path are configurable:
142
+
143
+ ```python
144
+ f = filament.FilamentClient(
145
+ organization_id="my-org",
146
+ api_key_name="my-key",
147
+ api_key="secret",
148
+ server="https://backend.filament-software.com",
149
+ port=1234,
150
+ path="api/v1",
151
+ )
152
+ ```
153
+
154
+ ### Conditions (Typed)
155
+
156
+ Build type-safe query conditions with the `Condition` builder. The mypy plugin validates field names and value types at type-check time.
157
+
158
+ ```python
159
+ from filament import Condition
160
+ from filament.types.generated.entities.user_service import UserEntity
161
+ from filament.types.generated.enums import UserStatusEnum
162
+ from filament.types.generated.misc import ReadDataRequest, ReadDataTypeRequest
163
+
164
+ # Mypy validates that "schedule_status" exists on UserEntity
165
+ # and that the value is a UserStatusEnum
166
+ condition = Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled)
167
+
168
+ # Comparable fields support ordering operations
169
+ condition = Condition(UserEntity).prop("given_name").less_than("M")
170
+
171
+ # Combine conditions
172
+ condition = Condition.and_(
173
+ Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled),
174
+ Condition(UserEntity).prop("given_name").like("%Alice%"),
175
+ )
176
+
177
+ # Use in queries
178
+ async def main() -> None:
179
+ async with filament.FilamentClient(
180
+ organization_id="my-org", api_key_name="key", api_key="secret",
181
+ ) as f:
182
+ result = await f.read_data(
183
+ ReadDataRequest(request=ReadDataTypeRequest(
184
+ type_name="UserEntity",
185
+ condition=condition,
186
+ ))
187
+ )
188
+ ```
189
+
190
+ To enable mypy validation, add to your `pyproject.toml`:
191
+
192
+ ```toml
193
+ [tool.mypy]
194
+ plugins = ["filament_mypy_plugin"]
195
+ ```
196
+
197
+ ### Conditions (Untyped)
198
+
199
+ For quick usage without entity class references, use the convenience constructors:
200
+
201
+ ```python
202
+ from filament.types.conditions import and_, equal_to, less_than, like
203
+
204
+ condition = and_(
205
+ equal_to("scheduleStatus", "1"),
206
+ like("givenName", "%Alice%"),
207
+ )
208
+ ```
209
+
210
+ ### Data Options
211
+
212
+ Typed key-value options for service data requests:
213
+
214
+ ```python
215
+ from filament.types.options import string_option, int_option, bool_option
216
+
217
+ options = {
218
+ "mode": string_option("preview"),
219
+ "limit": int_option(100),
220
+ "includeDeleted": bool_option(False),
221
+ }
222
+ ```
223
+
224
+ ### Subscriptions
225
+
226
+ Subscribe to real-time data updates with a callback:
227
+
228
+ ```python
229
+ from uuid_utils import UUID
230
+
231
+ from filament.types.generated.misc import SubscriptionConfig, ServiceDataUpdate
232
+ from filament.types.generated.enums import DataProcessingStatus, SubscriptionMode
233
+
234
+ def on_update(update: ServiceDataUpdate) -> None:
235
+ print("Data changed:", update.modified_entities)
236
+
237
+ scenario_id = UUID(int=0) # replace with your scenario ID
238
+
239
+ async def main() -> None:
240
+ async with filament.FilamentClient(
241
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
242
+ ) as f:
243
+ result = await f.subscribe(
244
+ SubscriptionConfig(
245
+ scenario_id=scenario_id,
246
+ status=DataProcessingStatus.Pending,
247
+ type_name="TaskEntity",
248
+ mode=SubscriptionMode.Data,
249
+ ),
250
+ callback=on_update,
251
+ )
252
+ ```
253
+
254
+ ### Event Callbacks
255
+
256
+ Register callbacks for processing lifecycle events:
257
+
258
+ ```python
259
+ async with filament.FilamentClient(
260
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
261
+ ) as f:
262
+ f.on_processing_started(lambda status: print("Started:", status.scenario_id))
263
+ f.on_processing_completed(lambda status: print("Done:", status.scenario_id))
264
+ f.on_processing_failed(lambda status: print("Failed:", status.message))
265
+ ```
266
+
267
+ ## Development
268
+
269
+ Working on the client itself needs [Poetry](https://python-poetry.org/):
270
+
271
+ ```bash
272
+ # Install with test dependencies
273
+ poetry install --with test
274
+
275
+ # Run tests
276
+ poetry run pytest tests/ -v
277
+
278
+ # Run type checking
279
+ poetry run mypy src/
280
+ ```
281
+
282
+ Releases are built and published by `.github/workflows/create-release.yml`: every
283
+ release goes to the internal Artifact Registry, and stable releases also go to
284
+ PyPI. See [Publishing releases](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/publishing.md) for the flow and the
285
+ one-off setup.
286
+
287
+ ## License
288
+
289
+ [MIT](https://github.com/FilamentSoftware/filament-api-python/blob/main/LICENSE)
290
+
@@ -0,0 +1,258 @@
1
+ # Filament Python API
2
+
3
+ An async Python client for the Filament platform, communicating over SignalR.
4
+
5
+ ## Documentation
6
+
7
+ Full, multi-page documentation lives in [`docs/`](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md):
8
+
9
+ - [Getting Started](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/getting-started.md) — install, connect, authenticate, error handling
10
+ - [Finding Entity & Connection Types](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/finding-types.md) — where every type and enum lives
11
+ - [Type Reference](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/type-reference.md) — auto-generated catalogue of every entity, connection, and enum
12
+ - [Reading Data](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/reading-data.md) — queries, ordering, paging, projections
13
+ - [Building Conditions](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/conditions.md) — the typed condition builder and operators
14
+ - [Modifying Data](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/modifying-data.md) — create, update, delete, partial updates
15
+ - [User-defined Properties](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/user-defined-properties.md) — discover, read, write, query, and administer runtime properties
16
+ - [Subscriptions](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/subscriptions.md) — real-time updates and lifecycle events
17
+ - [Data Options](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/data-options.md) — the typed `DataOption` key-value type
18
+ - [API Reference](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/api-reference.md) — `FilamentClient`, the response envelope, exceptions
19
+
20
+ Runnable scripts are in [`examples/`](https://github.com/FilamentSoftware/filament-api-python/tree/main/examples/). The sections below are a quick
21
+ overview; see the docs for the full detail.
22
+
23
+ ### Claude Code skill
24
+
25
+ This repo doubles as a [Claude Code](https://claude.com/claude-code) plugin that
26
+ ships a `using-filament-api` skill. Install it in any project that uses this
27
+ package so Claude has the API reference on hand:
28
+
29
+ ```text
30
+ /plugin marketplace add FilamentSoftware/filament-api-python
31
+ /plugin install filament-api@filament
32
+ ```
33
+
34
+ The skill routes Claude to the bundled [`docs/`](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md) — it stays in
35
+ sync with the documentation rather than duplicating it. Once installed, invoke it
36
+ with `/filament-api:using-filament-api`.
37
+
38
+ ## Requirements
39
+
40
+ - Python 3.10, 3.11, 3.12, or 3.13
41
+
42
+ ## Installation
43
+
44
+ Stable releases are published to [PyPI](https://pypi.org/project/filament-api/):
45
+
46
+ ```bash
47
+ pip install filament-api
48
+ # or
49
+ poetry add filament-api
50
+ ```
51
+
52
+ If your deployment's file store uses CRC32C checksums (GCS), install the
53
+ `crc32c` extra:
54
+
55
+ ```bash
56
+ pip install "filament-api[crc32c]"
57
+ ```
58
+
59
+ ### Installing from the internal index (Filament staff / dev builds)
60
+
61
+ Every release, including the development builds cut from `develop`, is also
62
+ published to Filament's internal Google Cloud Artifact Registry. Its virtual
63
+ repository serves those releases together with a mirror of PyPI, so use it as
64
+ your **only** index (`--index-url`, not `--extra-index-url`, which would let a
65
+ same-named package on PyPI compete with the internal one).
66
+
67
+ Access requires the `roles/artifactregistry.reader` role on the repository and
68
+ [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials)
69
+ (e.g. `gcloud auth application-default login`). Ask your Filament contact for
70
+ access.
71
+
72
+ With pip:
73
+
74
+ ```bash
75
+ pip install keyrings.google-artifactregistry-auth
76
+ pip install --index-url https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/ filament-api
77
+ ```
78
+
79
+ With Poetry:
80
+
81
+ ```bash
82
+ poetry self add keyrings.google-artifactregistry-auth
83
+ poetry source add --priority=primary filament-internal https://europe-west2-python.pkg.dev/filament-artifacts/python/simple/
84
+ poetry add filament-api
85
+ ```
86
+
87
+ Dev builds are PEP 440 pre-releases (e.g. `0.8.1.dev4`), so installers skip
88
+ them unless asked. Use `pip install --pre ...`, pin an exact version
89
+ (`filament-api==0.8.1.dev4`), or `poetry add filament-api --allow-prereleases`
90
+ (which sets `allow-prereleases = true` on the dependency).
91
+
92
+ ## Usage
93
+
94
+ ```python
95
+ import asyncio
96
+ import filament
97
+ from filament.types import ReadDataRequest, ReadDataTypeRequest
98
+
99
+ async def main() -> None:
100
+ async with filament.FilamentClient(
101
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
102
+ ) as f:
103
+ result = await f.read_data(
104
+ ReadDataRequest(request=ReadDataTypeRequest(type_name="UserEntity"))
105
+ )
106
+
107
+ asyncio.run(main())
108
+ ```
109
+
110
+ The server, port, and path are configurable:
111
+
112
+ ```python
113
+ f = filament.FilamentClient(
114
+ organization_id="my-org",
115
+ api_key_name="my-key",
116
+ api_key="secret",
117
+ server="https://backend.filament-software.com",
118
+ port=1234,
119
+ path="api/v1",
120
+ )
121
+ ```
122
+
123
+ ### Conditions (Typed)
124
+
125
+ Build type-safe query conditions with the `Condition` builder. The mypy plugin validates field names and value types at type-check time.
126
+
127
+ ```python
128
+ from filament import Condition
129
+ from filament.types.generated.entities.user_service import UserEntity
130
+ from filament.types.generated.enums import UserStatusEnum
131
+ from filament.types.generated.misc import ReadDataRequest, ReadDataTypeRequest
132
+
133
+ # Mypy validates that "schedule_status" exists on UserEntity
134
+ # and that the value is a UserStatusEnum
135
+ condition = Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled)
136
+
137
+ # Comparable fields support ordering operations
138
+ condition = Condition(UserEntity).prop("given_name").less_than("M")
139
+
140
+ # Combine conditions
141
+ condition = Condition.and_(
142
+ Condition(UserEntity).prop("schedule_status").equal_to(UserStatusEnum.Enabled),
143
+ Condition(UserEntity).prop("given_name").like("%Alice%"),
144
+ )
145
+
146
+ # Use in queries
147
+ async def main() -> None:
148
+ async with filament.FilamentClient(
149
+ organization_id="my-org", api_key_name="key", api_key="secret",
150
+ ) as f:
151
+ result = await f.read_data(
152
+ ReadDataRequest(request=ReadDataTypeRequest(
153
+ type_name="UserEntity",
154
+ condition=condition,
155
+ ))
156
+ )
157
+ ```
158
+
159
+ To enable mypy validation, add to your `pyproject.toml`:
160
+
161
+ ```toml
162
+ [tool.mypy]
163
+ plugins = ["filament_mypy_plugin"]
164
+ ```
165
+
166
+ ### Conditions (Untyped)
167
+
168
+ For quick usage without entity class references, use the convenience constructors:
169
+
170
+ ```python
171
+ from filament.types.conditions import and_, equal_to, less_than, like
172
+
173
+ condition = and_(
174
+ equal_to("scheduleStatus", "1"),
175
+ like("givenName", "%Alice%"),
176
+ )
177
+ ```
178
+
179
+ ### Data Options
180
+
181
+ Typed key-value options for service data requests:
182
+
183
+ ```python
184
+ from filament.types.options import string_option, int_option, bool_option
185
+
186
+ options = {
187
+ "mode": string_option("preview"),
188
+ "limit": int_option(100),
189
+ "includeDeleted": bool_option(False),
190
+ }
191
+ ```
192
+
193
+ ### Subscriptions
194
+
195
+ Subscribe to real-time data updates with a callback:
196
+
197
+ ```python
198
+ from uuid_utils import UUID
199
+
200
+ from filament.types.generated.misc import SubscriptionConfig, ServiceDataUpdate
201
+ from filament.types.generated.enums import DataProcessingStatus, SubscriptionMode
202
+
203
+ def on_update(update: ServiceDataUpdate) -> None:
204
+ print("Data changed:", update.modified_entities)
205
+
206
+ scenario_id = UUID(int=0) # replace with your scenario ID
207
+
208
+ async def main() -> None:
209
+ async with filament.FilamentClient(
210
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
211
+ ) as f:
212
+ result = await f.subscribe(
213
+ SubscriptionConfig(
214
+ scenario_id=scenario_id,
215
+ status=DataProcessingStatus.Pending,
216
+ type_name="TaskEntity",
217
+ mode=SubscriptionMode.Data,
218
+ ),
219
+ callback=on_update,
220
+ )
221
+ ```
222
+
223
+ ### Event Callbacks
224
+
225
+ Register callbacks for processing lifecycle events:
226
+
227
+ ```python
228
+ async with filament.FilamentClient(
229
+ organization_id="my-org", api_key_name="my-key", api_key="secret",
230
+ ) as f:
231
+ f.on_processing_started(lambda status: print("Started:", status.scenario_id))
232
+ f.on_processing_completed(lambda status: print("Done:", status.scenario_id))
233
+ f.on_processing_failed(lambda status: print("Failed:", status.message))
234
+ ```
235
+
236
+ ## Development
237
+
238
+ Working on the client itself needs [Poetry](https://python-poetry.org/):
239
+
240
+ ```bash
241
+ # Install with test dependencies
242
+ poetry install --with test
243
+
244
+ # Run tests
245
+ poetry run pytest tests/ -v
246
+
247
+ # Run type checking
248
+ poetry run mypy src/
249
+ ```
250
+
251
+ Releases are built and published by `.github/workflows/create-release.yml`: every
252
+ release goes to the internal Artifact Registry, and stable releases also go to
253
+ PyPI. See [Publishing releases](https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/publishing.md) for the flow and the
254
+ one-off setup.
255
+
256
+ ## License
257
+
258
+ [MIT](https://github.com/FilamentSoftware/filament-api-python/blob/main/LICENSE)
@@ -0,0 +1,86 @@
1
+ [project]
2
+ name = "filament-api"
3
+ version = "0.8.2"
4
+ description = "Async Python client for the Filament platform, communicating over SignalR"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{name = "Filament Software"}]
9
+ requires-python = ">=3.10,<4.0"
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Framework :: AsyncIO",
13
+ "Intended Audience :: Developers",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Typing :: Typed",
22
+ ]
23
+ # brotli is required (not an optional extra like crc32c): [CompressedProperty]
24
+ # values are decoded automatically on read, so decoding must not depend on
25
+ # install choices.
26
+ dependencies = ["uuid-utils>=0.9", "pysignalr>=1.3.0", "httpx>=0.27", "brotli>=1.2"]
27
+
28
+ # CRC32C checksums are only needed when a deployment's file store advertises
29
+ # FileChecksumAlgorithm.Crc32cBase64 (GCS). stdlib has no CRC32C, so it is an
30
+ # optional extra rather than a hard dependency: install with
31
+ # ``pip install filament-api[crc32c]`` when required.
32
+ [project.optional-dependencies]
33
+ crc32c = ["google-crc32c>=1.5"]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/FilamentSoftware/filament-api-python"
37
+ Repository = "https://github.com/FilamentSoftware/filament-api-python"
38
+ Documentation = "https://github.com/FilamentSoftware/filament-api-python/blob/main/docs/README.md"
39
+ Issues = "https://github.com/FilamentSoftware/filament-api-python/issues"
40
+
41
+ [build-system]
42
+ # >=2.2 for PEP 639 license expressions (license = "MIT", license-files).
43
+ requires = ["poetry-core>=2.2"]
44
+ build-backend = "poetry.core.masonry.api"
45
+
46
+ [tool.poetry]
47
+ # Poetry builds with its bundled poetry-core, so build-system.requires alone
48
+ # does not stop an older Poetry from mishandling the PEP 639 license fields.
49
+ requires-poetry = ">=2.2"
50
+ packages = [
51
+ {include = "filament", from = "src"},
52
+ {include = "filament_mypy_plugin.py", from = "src"},
53
+ ]
54
+
55
+ [tool.poetry.group.test.dependencies]
56
+ pytest = ">=8.0"
57
+ pytest-asyncio = ">=1.0"
58
+ pytest-cov = ">=6.0"
59
+ # Required by tests/test_mypy_plugin.py, which type-checks snippets in-process
60
+ # to verify the condition-builder mypy plugin.
61
+ mypy = ">=1.0"
62
+
63
+ [tool.poetry.group.types.dependencies]
64
+ mypy = ">=1.0"
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+
69
+ [tool.mypy]
70
+ python_version = "3.10"
71
+ strict = true
72
+ plugins = ["src/filament_mypy_plugin.py"]
73
+
74
+ [[tool.mypy.overrides]]
75
+ module = ["pysignalr", "pysignalr.*"]
76
+ ignore_missing_imports = true
77
+
78
+ # Optional extra (filament-api[crc32c]); no type stubs published.
79
+ [[tool.mypy.overrides]]
80
+ module = ["google_crc32c"]
81
+ ignore_missing_imports = true
82
+
83
+ # Required dependency; ships no type hints and no stubs package exists.
84
+ [[tool.mypy.overrides]]
85
+ module = ["brotli"]
86
+ ignore_missing_imports = true