Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"autoDocstring.docstringFormat": "numpy",
"python.defaultInterpreterPath": "./venv/bin/python",
"emeraldwalk.runonsave": {
"commands": [
{
"cmd": "./venv/bin/cleer inspect --log-level DEBUG ${file}"
}
]
},
"cSpell.words": [
"afunc",
"aioboto",
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
-->

## [0.1.0a6] - 2026-08-27

Support for Authzee spec 0.5.0.

### Added

- `ValidateBatchRequestResult` TypedDict type
- `validate_request_result_schema` - Return value schema for the `validate_request` function

### Changed

- Updated typing for Python 3.11+
- `List[X]` → `list[X]`, `Dict[X, Y]` → `dict[X, Y]`, `Union[X, Y]` → `X | Y`
- Removed `List`, `Dict`, `Union` from typing imports
- `validate_batch_request` now returns `ValidateBatchRequestResult` with `{error, batch}` instead of `GenericResult`
- `batch` contains per-item validation errors (or None for valid items)
- `validate_batch_request_result_schema` renamed `batch_errors` field to `batch`
- `validate_request` in `InProcessCompute` now respects the full `ValidateRequestConfig`
- Uses `use_list_context_defs`, `use_list_identity_defs`, `use_list_resource_defs` config options
- `validate_batch_request` in `InProcessCompute` now returns per-item errors in `batch` instead of failing fast
- `InProcessCompute`
- Updated `validate_request` and `validate_batch_request` to be much more efficient, and fully support all config options for `get_*` vs `list_*`.
- Default config - parallel paging set to false by default.

### Removed

- `compute_storage_kwargs` parameter from `Authzee` and `AuthzeeAsync`
- Compute module now receives `storage_kwargs` directly
- If different storage kwargs are needed, create a separate Authzee instance with `InProcessCompute`


## [0.1.0a5] - 2026-08-19

New revamp to support Authzee spec 0.4.0.
Expand Down
1 change: 0 additions & 1 deletion full_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
storage_kwargs={ # KWArgs for storage module instances
"storage_dict": storage_dict
},
compute_storage_kwargs=None, # Optional override storage KWArgs for compute module
config={ # Optional AuthzeeConfigOverride
"authzee": {
"raise_errors": True # raise exceptions on errors
Expand Down
4 changes: 2 additions & 2 deletions src/authzee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
or [](authzee.authzee_async.AuthzeeAsync) for asyncio support!
"""

__version__ = "0.1.0a5"
__version__ = "0.1.0a6"

__all__ = [
"Authzee",
Expand All @@ -28,7 +28,7 @@

logger.disable("authzee")

authzee_specification_version = "0.4.0"
authzee_specification_version = "0.5.0"

from authzee import exceptions, reference, types
from authzee.authzee import Authzee
Expand Down
14 changes: 5 additions & 9 deletions src/authzee/authzee.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import asyncio
import datetime
from typing import Any, Callable, Dict, Type
from typing import Any, Callable, Type

from authzee.authzee_async import AuthzeeAsync
from authzee.compute.compute_module import ComputeModule
Expand All @@ -24,14 +24,12 @@ class Authzee:
JSON query function.
compute_type : Type[ComputeModule]
Compute Module Type.
compute_kwargs : Dict[str, Any]
compute_kwargs : dict[str, Any]
Compute module KWArgs used to create instances.
storage_type : Type[StorageModule]
Storage Module Type.
storage_kwargs : Dict[str, Any]
storage_kwargs : dict[str, Any]
Storage module KWArgs used to create instances.
compute_storage_kwargs : Dict[str, Any], optional
Override storage module KWArgs that the compute module will use. May only include KWArgs you want to override.
config : AuthzeeConfigOverride, optional
Authzee configuration. May only include config keys you want to override.

Expand Down Expand Up @@ -187,10 +185,9 @@ def __init__(
self,
execute: Callable[[str, Any], Any],
compute_type: Type[ComputeModule],
compute_kwargs: Dict[str, Any],
compute_kwargs: dict[str, Any],
storage_type: Type[StorageModule],
storage_kwargs: Dict[str, Any],
compute_storage_kwargs: Dict[str, Any]=None,
storage_kwargs: dict[str, Any],
config: AuthzeeConfigOverride=None
):
self._authzee_async = AuthzeeAsync(
Expand All @@ -199,7 +196,6 @@ def __init__(
compute_kwargs=compute_kwargs,
storage_type=storage_type,
storage_kwargs=storage_kwargs,
compute_storage_kwargs=compute_storage_kwargs,
config=config
)

Expand Down
32 changes: 18 additions & 14 deletions src/authzee/authzee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from asyncio import gather
import datetime
from typing import Any, Callable, Dict, Type
from typing import Any, Callable, Type

from authzee.compute.compute_module import ComputeModule
from authzee.config import default_config, override_config
Expand All @@ -28,14 +28,12 @@ class AuthzeeAsync:
JSON query function.
compute_type : Type[ComputeModule]
Compute Module Type.
compute_kwargs : Dict[str, Any]
compute_kwargs : dict[str, Any]
Compute module KWArgs used to create instances.
storage_type : Type[StorageModule]
Storage Module Type.
storage_kwargs : Dict[str, Any]
storage_kwargs : dict[str, Any]
Storage module KWArgs used to create instances.
compute_storage_kwargs : Dict[str, Any], optional
Override storage module KWArgs that the compute module will use. May only include KWArgs you want to override.
config : AuthzeeConfigOverride, optional
Authzee configuration. May only include config keys you want to override.

Expand Down Expand Up @@ -188,18 +186,16 @@ def __init__(
self,
execute: Callable[[str, Any], Any],
compute_type: Type[ComputeModule],
compute_kwargs: Dict[str, Any],
compute_kwargs: dict[str, Any],
storage_type: Type[StorageModule],
storage_kwargs: Dict[str, Any],
compute_storage_kwargs: Dict[str, Any]=None,
storage_kwargs: dict[str, Any],
config: AuthzeeConfigOverride=None
):
self._execute = execute
self._compute_type = compute_type
self._compute_kwargs = compute_kwargs
self._storage_type = storage_type
self._storage_kwargs = storage_kwargs
self._compute_storage_kwargs = storage_kwargs if compute_storage_kwargs is None else storage_kwargs | compute_storage_kwargs
self._config: AuthzeeConfig = override_config(config, default_config)
self._compute: ComputeModule = None
self._storage: StorageModule = None
Expand Down Expand Up @@ -287,7 +283,7 @@ async def start(
self._compute.start(
execute=self._execute,
storage_type=self._storage_type,
storage_kwargs=self._compute_storage_kwargs,
storage_kwargs=self._storage_kwargs,
config=config['start']['compute_start']
),
self._storage.start(config['start']['storage_start'])
Expand Down Expand Up @@ -2741,7 +2737,7 @@ async def validate_batch_request(
self,
batch_request: AuthzeeBatchRequest,
config: AuthzeeConfigOverride | None=None
) -> GenericResult:
) -> ValidateBatchRequestResult:
"""Validate a batch authorization request without evaluating it.

Parameters
Expand Down Expand Up @@ -2818,10 +2814,17 @@ async def validate_batch_request(

Returns
-------
GenericResult
ValidateBatchRequestResult
```python
{
"error": None
"error": None,
"batch": [
None,
{ # or None
"error_type": "request",
"message": "Description of what went wrong for this batch item."
}
]
}
```

Expand All @@ -2832,7 +2835,8 @@ async def validate_batch_request(
"error": {
"error_type": "request",
"message": "Description of what went wrong."
}
},
"batch": []
}
```

Expand Down
6 changes: 3 additions & 3 deletions src/authzee/compute/compute_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ComputeModule"
]

from typing import Any, Callable, Dict, Type
from typing import Any, Callable, Type

from authzee.exceptions import NotImplementedError
from authzee.module_locality import ModuleLocality
Expand Down Expand Up @@ -38,7 +38,7 @@ async def start(
self,
execute: Callable[[str, Any], Any],
storage_type: Type[StorageModule],
storage_kwargs: Dict[str, Any],
storage_kwargs: dict[str, Any],
config: ComputeStartConfig
) -> GenericResult:
"""Start up compute module.
Expand Down Expand Up @@ -125,7 +125,7 @@ async def validate_batch_request(
self,
batch_request: AuthzeeBatchRequest,
config: ValidateBatchRequestConfig
) -> GenericResult:
) -> ValidateBatchRequestResult:
"""Validate a batch request.
"""
raise NotImplementedError()
Expand Down
Loading
Loading