Skip to content

Commit ab67b61

Browse files
authored
Introduce and use consistently APIOptions throughout (#323)
* new api options machinery ready in place * WIP switching to new api options. client done * WIP on the options, Database module done * WIP on switching to new options, collections are missing * wip in the Options switch: tests are missing * options everywhere, tests working as well * moving scalar defaults from api_options to defaults.py * support for custom headers in all request-issuing objects * export API options at higher level * removed a spurious emb.h.prov. coercion test
1 parent d51ab3a commit ab67b61

25 files changed

+3384
-1498
lines changed

CHANGES

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
v 2.0.0
22
=======
3+
Support for arbitrary 'database' and 'admin' headers throughout the object chain
4+
Reworked the options system:
5+
- an APIOptions object inherited at each "spawn" operation, with overrides
6+
- environment-dependent defaults if nothing supplied
7+
- "spawn" operations expose top-level aliases for selected settings
8+
- per-method overrides. For timeouts, `max_time_ms` becomes an alias for more specific timeout types
9+
- collection and database's `info` method gets timeout parameters
10+
- (not user-facing) classes in the hierarchy other than DataAPIClient have breaking changes in their constructor (now options-first and keyword-arg-only)
311
Major restructuring of the codebase into directories
412
- BaseCursor not exported by astrapy.cursors anymore
513
- some imports (supposedly not used externally) changed slightly
614
- adapted and limited scope of test_imports.py
15+
Removed AstraDBDatabaseAdmin's `from_api_endpoint` static method (reason: unused)
716
Rename main branch from 'master' ==> `main`
817
Cursors' state described by the `CursorState` enum
918
Removal of several deprecated modules/features from previous versions:
@@ -15,6 +24,7 @@ Removal of several deprecated modules/features from previous versions:
1524
- 'caller_name' and 'caller_version' parameters where `callers` is now expected
1625
- 'id' and 'region' to DataAPIClient's 'get_database' (and async version). Use `api_endpoint` which is now the one positional parameter.
1726
- 'region' parameter of AstraDBDatabaseAdmin.get[_async]_database (was ignored already in the method)
27+
- 'max_time_ms' parameter in AstraDBDatabaseAdmin's constructor and its `from_astra_db_admin` method (was already ignored in the body)
1828
- The 'max_time_ms' parameter in DataAPIClient's 'get_database' method.
1929
- Accordingly, the syntax `client[api_endpoint]` also does not accept a database ID anymore.
2030
- 'namespace' parameter of several methods of: DataAPIClient, admin objects, Database and Collection (use `keyspace`)

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,18 @@ from astrapy.ids import (
408408
)
409409
```
410410

411+
API Options:
412+
413+
```python
414+
from astrapy.api_options import (
415+
APIOptions,
416+
DataAPIURLOptions,
417+
DevOpsAPIURLOptions,
418+
PayloadTransformOptions,
419+
TimeoutOptions,
420+
)
421+
```
422+
411423
Result classes:
412424

413425
```python

astrapy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_version() -> str:
4949
__version__: str = get_version()
5050

5151

52+
from astrapy import api_options # noqa: E402, F401
5253
from astrapy.admin import ( # noqa: E402
5354
AstraDBAdmin,
5455
AstraDBDatabaseAdmin,

0 commit comments

Comments
 (0)