semblance-foundry 0.1.2__tar.gz → 0.2.0__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 (33) hide show
  1. {semblance_foundry-0.1.2/src/semblance_foundry.egg-info → semblance_foundry-0.2.0}/PKG-INFO +16 -8
  2. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/README.md +6 -3
  3. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/pyproject.toml +11 -5
  4. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/app.py +9 -8
  5. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/compatibility.yaml +1 -1
  6. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/services/ontologies/routes.py +8 -1
  7. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/testing.py +15 -5
  8. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0/src/semblance_foundry.egg-info}/PKG-INFO +16 -8
  9. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry.egg-info/requires.txt +9 -2
  10. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/LICENSE.md +0 -0
  11. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/setup.cfg +0 -0
  12. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/__init__.py +0 -0
  13. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/auth.py +0 -0
  14. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/cli.py +0 -0
  15. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/compatibility.py +0 -0
  16. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/config.py +0 -0
  17. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/errors.py +0 -0
  18. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/fixtures/__init__.py +0 -0
  19. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/fixtures/defaults/__init__.py +0 -0
  20. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/fixtures/defaults/acme.yaml +0 -0
  21. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/fixtures/loaders.py +0 -0
  22. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/ids.py +0 -0
  23. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/models/__init__.py +0 -0
  24. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/pagination.py +0 -0
  25. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/py.typed +0 -0
  26. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/registry.py +0 -0
  27. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/services/__init__.py +0 -0
  28. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/services/ontologies/__init__.py +0 -0
  29. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry/state.py +0 -0
  30. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry.egg-info/SOURCES.txt +0 -0
  31. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry.egg-info/dependency_links.txt +0 -0
  32. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry.egg-info/entry_points.txt +0 -0
  33. {semblance_foundry-0.1.2 → semblance_foundry-0.2.0}/src/semblance_foundry.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semblance-foundry
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Unofficial local HTTP simulation of selected Palantir Foundry API v2 ontology operations
5
5
  Author: Semblance Contributors
6
6
  License-Expression: MIT
@@ -11,19 +11,24 @@ Keywords: foundry,palantir,mock,simulation,testing,fastapi
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Topic :: Software Development :: Testing
18
- Requires-Python: >=3.10
17
+ Requires-Python: >=3.11
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE.md
21
- Requires-Dist: semblance<0.9,>=0.7.0
20
+ Requires-Dist: semblance<1.0,>=0.10.0
22
21
  Requires-Dist: pydantic>=2.0.0
23
22
  Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: test
24
+ Requires-Dist: fastapi>=0.133.0; extra == "test"
25
+ Requires-Dist: starlette>=1.3.1; extra == "test"
26
+ Requires-Dist: httpx2>=2.13; extra == "test"
24
27
  Provides-Extra: dev
25
28
  Requires-Dist: pytest>=7.0.0; extra == "dev"
26
- Requires-Dist: httpx>=0.25.0; extra == "dev"
29
+ Requires-Dist: fastapi>=0.133.0; extra == "dev"
30
+ Requires-Dist: starlette>=1.3.1; extra == "dev"
31
+ Requires-Dist: httpx2>=2.13; extra == "dev"
27
32
  Requires-Dist: ruff>=0.16.0; extra == "dev"
28
33
  Requires-Dist: mypy>=1.0.0; extra == "dev"
29
34
  Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
@@ -39,14 +44,17 @@ This package is **not affiliated with, endorsed by, or equivalent to Palantir**.
39
44
 
40
45
  Verified against public API v2 documentation dated **2026-08-18**. See `compatibility.yaml` (also served at `/.well-known/foundry-mock-compatibility.json`).
41
46
 
42
- Requires `semblance` 0.7.x or 0.8.x (`>=0.7.0,<0.9`).
47
+ Requires Python 3.11+ and `semblance` 0.10.x (`>=0.10.0,<1.0`). Python 3.10 users can use Foundry 0.1.x with `semblance<0.10`.
43
48
 
44
49
  ## Install
45
50
 
46
51
  ```bash
47
- pip install semblance-foundry
52
+ pip install "semblance-foundry[test]"
48
53
  ```
49
54
 
55
+ The `[test]` extra installs the in-process HTTP client used in the quick start.
56
+ For CLI-only use, `pip install semblance-foundry` is enough.
57
+
50
58
  From a clone of this repository:
51
59
 
52
60
  ```bash
@@ -111,7 +119,7 @@ foundry.register_query("employeesByOffice", lambda params, state: {"data": []})
111
119
 
112
120
  List endpoints use `pageSize` / `pageToken` / `nextPageToken`. Tokens are opaque and checksummed. Tampering or cross-resource reuse returns `InvalidPageToken` (400). Default page size 100, max 1000.
113
121
 
114
- ## Known unsupported (0.1.2)
122
+ ## Known unsupported (0.2.0)
115
123
 
116
124
  - Action apply / applyBatch — `501 UnsupportedOperation` only when `auth=strict`; otherwise 404
117
125
  - Aggregates, object sets, datasets, transactions, orchestration, streams
@@ -6,14 +6,17 @@ This package is **not affiliated with, endorsed by, or equivalent to Palantir**.
6
6
 
7
7
  Verified against public API v2 documentation dated **2026-08-18**. See `compatibility.yaml` (also served at `/.well-known/foundry-mock-compatibility.json`).
8
8
 
9
- Requires `semblance` 0.7.x or 0.8.x (`>=0.7.0,<0.9`).
9
+ Requires Python 3.11+ and `semblance` 0.10.x (`>=0.10.0,<1.0`). Python 3.10 users can use Foundry 0.1.x with `semblance<0.10`.
10
10
 
11
11
  ## Install
12
12
 
13
13
  ```bash
14
- pip install semblance-foundry
14
+ pip install "semblance-foundry[test]"
15
15
  ```
16
16
 
17
+ The `[test]` extra installs the in-process HTTP client used in the quick start.
18
+ For CLI-only use, `pip install semblance-foundry` is enough.
19
+
17
20
  From a clone of this repository:
18
21
 
19
22
  ```bash
@@ -78,7 +81,7 @@ foundry.register_query("employeesByOffice", lambda params, state: {"data": []})
78
81
 
79
82
  List endpoints use `pageSize` / `pageToken` / `nextPageToken`. Tokens are opaque and checksummed. Tampering or cross-resource reuse returns `InvalidPageToken` (400). Default page size 100, max 1000.
80
83
 
81
- ## Known unsupported (0.1.2)
84
+ ## Known unsupported (0.2.0)
82
85
 
83
86
  - Action apply / applyBatch — `501 UnsupportedOperation` only when `auth=strict`; otherwise 404
84
87
  - Aggregates, object sets, datasets, transactions, orchestration, streams
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "semblance-foundry"
7
- version = "0.1.2"
7
+ version = "0.2.0"
8
8
  description = "Unofficial local HTTP simulation of selected Palantir Foundry API v2 ontology operations"
9
9
  readme = "README.md"
10
- requires-python = ">=3.10"
10
+ requires-python = ">=3.11"
11
11
  license = "MIT"
12
12
  license-files = ["LICENSE.md"]
13
13
  authors = [{name = "Semblance Contributors"}]
@@ -16,21 +16,27 @@ classifiers = [
16
16
  "Development Status :: 3 - Alpha",
17
17
  "Intended Audience :: Developers",
18
18
  "Programming Language :: Python :: 3",
19
- "Programming Language :: Python :: 3.10",
20
19
  "Programming Language :: Python :: 3.11",
21
20
  "Programming Language :: Python :: 3.12",
22
21
  "Topic :: Software Development :: Testing",
23
22
  ]
24
23
  dependencies = [
25
- "semblance>=0.7.0,<0.9",
24
+ "semblance>=0.10.0,<1.0",
26
25
  "pydantic>=2.0.0",
27
26
  "pyyaml>=6.0",
28
27
  ]
29
28
 
30
29
  [project.optional-dependencies]
30
+ test = [
31
+ "fastapi>=0.133.0",
32
+ "starlette>=1.3.1",
33
+ "httpx2>=2.13",
34
+ ]
31
35
  dev = [
32
36
  "pytest>=7.0.0",
33
- "httpx>=0.25.0",
37
+ "fastapi>=0.133.0",
38
+ "starlette>=1.3.1",
39
+ "httpx2>=2.13",
34
40
  "ruff>=0.16.0",
35
41
  "mypy>=1.0.0",
36
42
  "types-PyYAML>=6.0.0",
@@ -7,7 +7,7 @@ from collections.abc import Callable
7
7
  from importlib.metadata import PackageNotFoundError
8
8
  from importlib.metadata import version as pkg_version
9
9
  from pathlib import Path
10
- from typing import Any
10
+ from typing import Any, Self
11
11
 
12
12
  from fastapi import FastAPI
13
13
 
@@ -31,7 +31,7 @@ def _distribution_version() -> str:
31
31
  try:
32
32
  return pkg_version("semblance-foundry")
33
33
  except PackageNotFoundError:
34
- return "0.1.2"
34
+ return "0.2.0"
35
35
 
36
36
 
37
37
  class FoundryMock:
@@ -44,15 +44,16 @@ class FoundryMock:
44
44
  self._rng = random.Random(self.config.seed)
45
45
  self.ontologies = OntologyMutations(self.state)
46
46
 
47
- def load_fixture(self, path: str | Path) -> FoundryMock:
48
- callbacks = dict(self.state.query_callbacks)
49
- self.state.clear()
50
- self.state.query_callbacks.update(callbacks)
47
+ def load_fixture(self, path: str | Path) -> Self:
51
48
  doc = load_fixture_file(path)
52
- apply_fixture(doc, self.state)
49
+ staged_state = FoundryState(seed=self.config.seed)
50
+ staged_state.query_callbacks.update(self.state.query_callbacks)
51
+ apply_fixture(doc, staged_state)
52
+ self.state = staged_state
53
+ self.ontologies._state = staged_state
53
54
  return self
54
55
 
55
- def load_bundled_fixture(self, name: str = "acme") -> FoundryMock:
56
+ def load_bundled_fixture(self, name: str = "acme") -> Self:
56
57
  """Load a fixture shipped with the package (currently ``acme``)."""
57
58
  loader = _BUNDLED_FIXTURES.get(name)
58
59
  if loader is None:
@@ -1,4 +1,4 @@
1
- packageVersion: "0.1.2"
1
+ packageVersion: "0.2.0"
2
2
  documentedAt: "2026-08-18"
3
3
  source: "https://www.palantir.com/docs/foundry/api/v2"
4
4
  operations:
@@ -126,7 +126,14 @@ def _match_where(obj: dict[str, Any], where: dict[str, Any] | None) -> bool:
126
126
  error_name="InvalidQuery",
127
127
  parameters={"reason": "and.value must be a list"},
128
128
  )
129
- return all(_match_where(obj, c) for c in clauses if isinstance(c, dict))
129
+ if any(not isinstance(clause, dict) for clause in clauses):
130
+ raise FoundryError(
131
+ status_code=400,
132
+ error_code="INVALID_ARGUMENT",
133
+ error_name="InvalidQuery",
134
+ parameters={"reason": "and.value must contain filter objects"},
135
+ )
136
+ return all(_match_where(obj, clause) for clause in clauses)
130
137
  raise FoundryError(
131
138
  status_code=400,
132
139
  error_code="INVALID_ARGUMENT",
@@ -4,14 +4,24 @@ from __future__ import annotations
4
4
 
5
5
  from collections.abc import Iterator
6
6
  from pathlib import Path
7
- from typing import Any
7
+ from typing import TYPE_CHECKING, Any
8
8
 
9
- from fastapi.testclient import TestClient
9
+ from fastapi import FastAPI
10
10
 
11
11
  from semblance_foundry.app import FoundryMock
12
12
  from semblance_foundry.config import FoundryMockConfig
13
13
  from semblance_foundry.fixtures.loaders import bundled_acme_path
14
14
 
15
+ if TYPE_CHECKING:
16
+ from fastapi.testclient import TestClient
17
+
18
+
19
+ def _make_test_client(app: FastAPI) -> TestClient:
20
+ """Load the optional test client backend only when a helper is used."""
21
+ from fastapi.testclient import TestClient
22
+
23
+ return TestClient(app)
24
+
15
25
 
16
26
  class FoundryMockContext:
17
27
  """Load a fixture, yield a TestClient, reset state on exit."""
@@ -31,7 +41,7 @@ class FoundryMockContext:
31
41
  self._client: TestClient | None = None
32
42
 
33
43
  def __enter__(self) -> TestClient:
34
- self._client = TestClient(self.mock.as_fastapi())
44
+ self._client = _make_test_client(self.mock.as_fastapi())
35
45
  return self._client
36
46
 
37
47
  def __exit__(self, *exc: Any) -> None:
@@ -50,7 +60,7 @@ def foundry_test_client(
50
60
  if mock is None:
51
61
  mock = FoundryMock(config or FoundryMockConfig())
52
62
  mock.load_fixture(fixture if fixture is not None else bundled_acme_path())
53
- return TestClient(mock.as_fastapi())
63
+ return _make_test_client(mock.as_fastapi())
54
64
 
55
65
 
56
66
  def acme_client_iter(
@@ -58,7 +68,7 @@ def acme_client_iter(
58
68
  ) -> Iterator[tuple[FoundryMock, TestClient]]:
59
69
  mock = FoundryMock(config or FoundryMockConfig(seed=42))
60
70
  mock.load_fixture(bundled_acme_path())
61
- client = TestClient(mock.as_fastapi())
71
+ client = _make_test_client(mock.as_fastapi())
62
72
  try:
63
73
  yield mock, client
64
74
  finally:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semblance-foundry
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Unofficial local HTTP simulation of selected Palantir Foundry API v2 ontology operations
5
5
  Author: Semblance Contributors
6
6
  License-Expression: MIT
@@ -11,19 +11,24 @@ Keywords: foundry,palantir,mock,simulation,testing,fastapi
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Topic :: Software Development :: Testing
18
- Requires-Python: >=3.10
17
+ Requires-Python: >=3.11
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE.md
21
- Requires-Dist: semblance<0.9,>=0.7.0
20
+ Requires-Dist: semblance<1.0,>=0.10.0
22
21
  Requires-Dist: pydantic>=2.0.0
23
22
  Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: test
24
+ Requires-Dist: fastapi>=0.133.0; extra == "test"
25
+ Requires-Dist: starlette>=1.3.1; extra == "test"
26
+ Requires-Dist: httpx2>=2.13; extra == "test"
24
27
  Provides-Extra: dev
25
28
  Requires-Dist: pytest>=7.0.0; extra == "dev"
26
- Requires-Dist: httpx>=0.25.0; extra == "dev"
29
+ Requires-Dist: fastapi>=0.133.0; extra == "dev"
30
+ Requires-Dist: starlette>=1.3.1; extra == "dev"
31
+ Requires-Dist: httpx2>=2.13; extra == "dev"
27
32
  Requires-Dist: ruff>=0.16.0; extra == "dev"
28
33
  Requires-Dist: mypy>=1.0.0; extra == "dev"
29
34
  Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
@@ -39,14 +44,17 @@ This package is **not affiliated with, endorsed by, or equivalent to Palantir**.
39
44
 
40
45
  Verified against public API v2 documentation dated **2026-08-18**. See `compatibility.yaml` (also served at `/.well-known/foundry-mock-compatibility.json`).
41
46
 
42
- Requires `semblance` 0.7.x or 0.8.x (`>=0.7.0,<0.9`).
47
+ Requires Python 3.11+ and `semblance` 0.10.x (`>=0.10.0,<1.0`). Python 3.10 users can use Foundry 0.1.x with `semblance<0.10`.
43
48
 
44
49
  ## Install
45
50
 
46
51
  ```bash
47
- pip install semblance-foundry
52
+ pip install "semblance-foundry[test]"
48
53
  ```
49
54
 
55
+ The `[test]` extra installs the in-process HTTP client used in the quick start.
56
+ For CLI-only use, `pip install semblance-foundry` is enough.
57
+
50
58
  From a clone of this repository:
51
59
 
52
60
  ```bash
@@ -111,7 +119,7 @@ foundry.register_query("employeesByOffice", lambda params, state: {"data": []})
111
119
 
112
120
  List endpoints use `pageSize` / `pageToken` / `nextPageToken`. Tokens are opaque and checksummed. Tampering or cross-resource reuse returns `InvalidPageToken` (400). Default page size 100, max 1000.
113
121
 
114
- ## Known unsupported (0.1.2)
122
+ ## Known unsupported (0.2.0)
115
123
 
116
124
  - Action apply / applyBatch — `501 UnsupportedOperation` only when `auth=strict`; otherwise 404
117
125
  - Aggregates, object sets, datasets, transactions, orchestration, streams
@@ -1,13 +1,20 @@
1
- semblance<0.9,>=0.7.0
1
+ semblance<1.0,>=0.10.0
2
2
  pydantic>=2.0.0
3
3
  pyyaml>=6.0
4
4
 
5
5
  [dev]
6
6
  pytest>=7.0.0
7
- httpx>=0.25.0
7
+ fastapi>=0.133.0
8
+ starlette>=1.3.1
9
+ httpx2>=2.13
8
10
  ruff>=0.16.0
9
11
  mypy>=1.0.0
10
12
  types-PyYAML>=6.0.0
11
13
 
12
14
  [sdk]
13
15
  foundry-platform-sdk==1.101.0
16
+
17
+ [test]
18
+ fastapi>=0.133.0
19
+ starlette>=1.3.1
20
+ httpx2>=2.13