brainlessdb 1.1.0__tar.gz → 1.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 (37) hide show
  1. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/CHANGELOG.md +11 -0
  2. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/PKG-INFO +1 -1
  3. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/__init__.py +1 -1
  4. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/client.py +8 -3
  5. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/pyproject.toml +1 -1
  6. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_client.py +22 -0
  7. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/uv.lock +1 -1
  8. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/.gitignore +0 -0
  9. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/.python-version +0 -0
  10. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/README.md +0 -0
  11. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/bucket.py +0 -0
  12. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/collection.py +0 -0
  13. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/fields.py +0 -0
  14. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/ingest.py +0 -0
  15. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/registry.py +0 -0
  16. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/struct.py +0 -0
  17. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/cliff.toml +0 -0
  18. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/code_style_guide.md +0 -0
  19. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/justfile +0 -0
  20. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/test_results.txt +0 -0
  21. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/__init__.py +0 -0
  22. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/conftest.py +0 -0
  23. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/mock_nats.py +0 -0
  24. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_bucket.py +0 -0
  25. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_collection.py +0 -0
  26. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_dead_letter.py +0 -0
  27. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_deserialization.py +0 -0
  28. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_duplicates.py +0 -0
  29. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_fields.py +0 -0
  30. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_flush_errors.py +0 -0
  31. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_ingest.py +0 -0
  32. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_load_errors.py +0 -0
  33. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_registry.py +0 -0
  34. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_sync.py +0 -0
  35. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_thread_safety.py +0 -0
  36. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_update_atomic.py +0 -0
  37. {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_version.py +0 -0
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
5
 
6
+ ## [1.2.0] - 2026-11-15
7
+
8
+ ### 🚀 Features
9
+
10
+ - Plain __allowed_apps__ list grants access to a collection
11
+ - A class without allows_app() but with __allowed_apps__ (a list of app
12
+ namespaces) is allowed when the namespace is in the list. ucs_data
13
+ buckets declare only __allowed_apps__ and were all rejected with
14
+ AppAccessError. allows_app() still takes precedence.
15
+
16
+
6
17
  ## [1.1.0] - 2026-11-03
7
18
 
8
19
  ### 🚀 Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: brainlessdb
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Typed collections backed by NATS JetStream KV
5
5
  Author-email: "INSOFT s.r.o." <helpdesk@insoft.cz>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  """Brainless DB - Typed collections backed by NATS JetStream KV."""
2
2
 
3
- __version__ = "1.1.0"
3
+ __version__ = "1.2.0"
4
4
 
5
5
  from typing import Any, Optional, TypeVar
6
6
 
@@ -87,11 +87,16 @@ class BrainlessDB:
87
87
  """Validate __allowed_apps__. Errors are deferred to start() before
88
88
  start, raised immediately after."""
89
89
  allows_app = getattr(cls, "allows_app", None)
90
+ allowed_apps = getattr(cls, "__allowed_apps__", None)
90
91
  error = None
91
- if allows_app is None:
92
+ if allows_app is not None:
93
+ if not allows_app(self._namespace):
94
+ error = AppAccessError(cls.__name__, self._namespace)
95
+ elif allowed_apps is not None:
96
+ if self._namespace not in allowed_apps:
97
+ error = AppAccessError(cls.__name__, self._namespace)
98
+ else:
92
99
  error = AppAccessError(cls.__name__)
93
- elif not allows_app(self._namespace):
94
- error = AppAccessError(cls.__name__, self._namespace)
95
100
 
96
101
  if error is not None:
97
102
  if self._started:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brainlessdb"
3
- version = "1.1.0"
3
+ version = "1.2.0"
4
4
  description = "Typed collections backed by NATS JetStream KV"
5
5
  authors = [
6
6
  {name = "INSOFT s.r.o.", email = "helpdesk@insoft.cz"}
@@ -123,6 +123,28 @@ class TestAppAccess:
123
123
  with pytest.raises(RuntimeError, match="must declare __allowed_apps__"):
124
124
  await db.start()
125
125
 
126
+ def test_collection_allowed_apps_attribute(self):
127
+ """__allowed_apps__ without allows_app - namespace in the list is allowed."""
128
+ from brainlessdb import BrainlessBucket
129
+
130
+ class ListedV1(BrainlessBucket):
131
+ __allowed_apps__ = ["test", "other"]
132
+
133
+ db = BrainlessDB(namespace="test")
134
+ db.collection(ListedV1)
135
+ assert db._app_errors == []
136
+
137
+ def test_collection_allowed_apps_attribute_wrong_app(self):
138
+ """__allowed_apps__ without allows_app - namespace not in the list is an error."""
139
+ from brainlessdb import BrainlessBucket
140
+
141
+ class ListedV1(BrainlessBucket):
142
+ __allowed_apps__ = ["other"]
143
+
144
+ db = BrainlessDB(namespace="test")
145
+ db.collection(ListedV1)
146
+ assert len(db._app_errors) == 1
147
+
126
148
  @pytest.mark.asyncio
127
149
  async def test_collection_after_start_wrong_app_raises_immediately(self):
128
150
  """Wrong namespace after start — raises immediately."""
@@ -17,7 +17,7 @@ wheels = [
17
17
 
18
18
  [[package]]
19
19
  name = "brainlessdb"
20
- version = "1.1.0"
20
+ version = "1.0.0"
21
21
  source = { editable = "." }
22
22
  dependencies = [
23
23
  { name = "msgspec" },
File without changes
File without changes
File without changes
File without changes
File without changes