xtr-orm 4.0.4__tar.gz → 5.0.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.
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/PKG-INFO +23 -19
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/README.md +21 -10
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/pyproject.toml +7 -13
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/pyproject.toml.orig +7 -17
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/SKILL.md +12 -6
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/references/commands.md +3 -2
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/references/messenger.md +3 -3
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/__init__.py +1 -1
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/messenger/__init__.py +1 -1
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/LICENSE +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/references/connections.md +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/references/migrations.md +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/bundle/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/bundle/connection_config.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/bundle/orm_bundle.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/bundle/orm_config.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/bundle/orm_mappings_pass.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/_reporting.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/connection_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/database_create_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/database_drop_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_current_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_diff_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_dump_schema_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_execute_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_generate_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_latest_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_list_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_migrate_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_rollup_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_status_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_up_to_date_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/migrations_version_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/command/run_sql_command.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/connection_registry.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/database/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/database/database_manager.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/invalid_argument_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/migration_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/missing_database_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/orm_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/session_unavailable_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/unknown_connection_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/exception/unsupported_database_error.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/mapping_driver_interface.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/messenger/close_connection_middleware.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/messenger/open_transaction_logger_middleware.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/messenger/transaction_middleware.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/_environment.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/_history.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/_revisions.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/_schema.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/available_migration.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/direction.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/executed_migration.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/execution_result.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/migration_plan.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/migration_status.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/migrations_config.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/migrator.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/migrations/template/script.py.mako +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/py.typed +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/recipe/__init__.py +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/recipe/files/config/orm.py.tmpl +0 -0
- {xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/recipe/manifest.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xtr-orm
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.0
|
|
4
4
|
Summary: Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection.
|
|
5
5
|
Keywords: orm,database,migrations,sqlalchemy,alembic,asyncio
|
|
6
6
|
Author: Xterr
|
|
@@ -20,18 +20,11 @@ Requires-Dist: advanced-alchemy>=1.11
|
|
|
20
20
|
Requires-Dist: alembic>=1.20
|
|
21
21
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.41
|
|
22
22
|
Requires-Dist: typing-extensions>=4.4
|
|
23
|
-
Requires-Dist: xtr-logging-contracts>=
|
|
24
|
-
Requires-Dist: xtr-console>=4.0,<5 ; extra == 'console'
|
|
25
|
-
Requires-Dist: xtr-dependency-injection>=4.0,<5 ; extra == 'di'
|
|
26
|
-
Requires-Dist: xtr-service-contracts>=4.0,<5 ; extra == 'di'
|
|
27
|
-
Requires-Dist: xtr-messenger>=4.0,<5 ; extra == 'messenger'
|
|
23
|
+
Requires-Dist: xtr-logging-contracts>=5.0,<6
|
|
28
24
|
Requires-Dist: asyncmy>=0.2.9 ; extra == 'mysql'
|
|
29
25
|
Requires-Dist: asyncpg>=0.29 ; extra == 'postgres'
|
|
30
26
|
Requires-Dist: aiosqlite>=0.20 ; extra == 'sqlite'
|
|
31
27
|
Requires-Python: >=3.11
|
|
32
|
-
Provides-Extra: console
|
|
33
|
-
Provides-Extra: di
|
|
34
|
-
Provides-Extra: messenger
|
|
35
28
|
Provides-Extra: mysql
|
|
36
29
|
Provides-Extra: postgres
|
|
37
30
|
Provides-Extra: sqlite
|
|
@@ -78,16 +71,22 @@ its engine and session options, where its revisions live — and get:
|
|
|
78
71
|
## Install
|
|
79
72
|
|
|
80
73
|
```sh
|
|
81
|
-
uv add "xtr-orm[postgres]"
|
|
82
|
-
uv add "xtr-orm[
|
|
74
|
+
uv add "xtr-orm[postgres]" # asyncpg
|
|
75
|
+
uv add "xtr-orm[postgres]" xtr-dependency-injection # + the container, for the OrmBundle
|
|
76
|
+
uv add xtr-console # beside it: the orm:* commands
|
|
77
|
+
uv add xtr-messenger # beside it: the message bus middleware
|
|
83
78
|
```
|
|
84
79
|
|
|
85
80
|
| Extra | Brings | For |
|
|
86
81
|
|---|---|---|
|
|
87
82
|
| `postgres` / `mysql` / `sqlite` | `asyncpg` / `asyncmy` / `aiosqlite` | The async driver of your database |
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
|
|
84
|
+
No xtr package is an extra, and the container is not a dependency: the `OrmBundle` — engines,
|
|
85
|
+
sessions, migrators from one configuration — is used when
|
|
86
|
+
[xtr-dependency-injection](../xtr-dependency-injection) is installed beside the package, and a
|
|
87
|
+
`Migrator` works without it, as the [Quick start](#quick-start) shows. Installed beside it too,
|
|
88
|
+
[xtr-console](../xtr-console) brings the `orm:*` commands and [xtr-messenger](../xtr-messenger)
|
|
89
|
+
the [message bus middleware](#message-bus-middleware).
|
|
91
90
|
|
|
92
91
|
## Quick start
|
|
93
92
|
|
|
@@ -199,9 +198,10 @@ Everything adding this package to an application on
|
|
|
199
198
|
[xtr-dependency-injection](../xtr-dependency-injection) takes — and, read backwards, what
|
|
200
199
|
removing it undoes.
|
|
201
200
|
|
|
202
|
-
- **Install** — `uv add "xtr-orm[
|
|
203
|
-
|
|
204
|
-
for the
|
|
201
|
+
- **Install** — `uv add "xtr-orm[postgres]" xtr-dependency-injection`: the bundle needs the
|
|
202
|
+
container installed beside it, never as an extra; `mysql` or `sqlite` instead of `postgres` for
|
|
203
|
+
those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
|
|
204
|
+
the [message bus middleware](#message-bus-middleware).
|
|
205
205
|
- **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
|
|
206
206
|
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
|
|
207
207
|
`default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
|
|
@@ -227,6 +227,10 @@ removing it undoes.
|
|
|
227
227
|
|
|
228
228
|
## Kernel / bundle
|
|
229
229
|
|
|
230
|
+
With [xtr-dependency-injection](../xtr-dependency-injection) installed beside the package — it is
|
|
231
|
+
not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bundle and name the
|
|
232
|
+
connections:
|
|
233
|
+
|
|
230
234
|
```python
|
|
231
235
|
# app/bundles.py
|
|
232
236
|
from xtr_orm.bundle import OrmBundle
|
|
@@ -455,8 +459,8 @@ migrate = MigrationsMigrateCommand(registry)
|
|
|
455
459
|
|
|
456
460
|
## Message bus middleware
|
|
457
461
|
|
|
458
|
-
With
|
|
459
|
-
session the way any service does, and three middleware — registered by name — decide what
|
|
462
|
+
With xtr-messenger installed beside it and a kernel running both bundles, a message handler asks
|
|
463
|
+
for a session the way any service does, and three middleware — registered by name — decide what
|
|
460
464
|
happens to it. Nothing is added to a bus by itself: the bus lists the ones it wants.
|
|
461
465
|
|
|
462
466
|
```python
|
|
@@ -39,16 +39,22 @@ its engine and session options, where its revisions live — and get:
|
|
|
39
39
|
## Install
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
uv add "xtr-orm[postgres]"
|
|
43
|
-
uv add "xtr-orm[
|
|
42
|
+
uv add "xtr-orm[postgres]" # asyncpg
|
|
43
|
+
uv add "xtr-orm[postgres]" xtr-dependency-injection # + the container, for the OrmBundle
|
|
44
|
+
uv add xtr-console # beside it: the orm:* commands
|
|
45
|
+
uv add xtr-messenger # beside it: the message bus middleware
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
| Extra | Brings | For |
|
|
47
49
|
|---|---|---|
|
|
48
50
|
| `postgres` / `mysql` / `sqlite` | `asyncpg` / `asyncmy` / `aiosqlite` | The async driver of your database |
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
No xtr package is an extra, and the container is not a dependency: the `OrmBundle` — engines,
|
|
53
|
+
sessions, migrators from one configuration — is used when
|
|
54
|
+
[xtr-dependency-injection](../xtr-dependency-injection) is installed beside the package, and a
|
|
55
|
+
`Migrator` works without it, as the [Quick start](#quick-start) shows. Installed beside it too,
|
|
56
|
+
[xtr-console](../xtr-console) brings the `orm:*` commands and [xtr-messenger](../xtr-messenger)
|
|
57
|
+
the [message bus middleware](#message-bus-middleware).
|
|
52
58
|
|
|
53
59
|
## Quick start
|
|
54
60
|
|
|
@@ -160,9 +166,10 @@ Everything adding this package to an application on
|
|
|
160
166
|
[xtr-dependency-injection](../xtr-dependency-injection) takes — and, read backwards, what
|
|
161
167
|
removing it undoes.
|
|
162
168
|
|
|
163
|
-
- **Install** — `uv add "xtr-orm[
|
|
164
|
-
|
|
165
|
-
for the
|
|
169
|
+
- **Install** — `uv add "xtr-orm[postgres]" xtr-dependency-injection`: the bundle needs the
|
|
170
|
+
container installed beside it, never as an extra; `mysql` or `sqlite` instead of `postgres` for
|
|
171
|
+
those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
|
|
172
|
+
the [message bus middleware](#message-bus-middleware).
|
|
166
173
|
- **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
|
|
167
174
|
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
|
|
168
175
|
`default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
|
|
@@ -188,6 +195,10 @@ removing it undoes.
|
|
|
188
195
|
|
|
189
196
|
## Kernel / bundle
|
|
190
197
|
|
|
198
|
+
With [xtr-dependency-injection](../xtr-dependency-injection) installed beside the package — it is
|
|
199
|
+
not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bundle and name the
|
|
200
|
+
connections:
|
|
201
|
+
|
|
191
202
|
```python
|
|
192
203
|
# app/bundles.py
|
|
193
204
|
from xtr_orm.bundle import OrmBundle
|
|
@@ -416,8 +427,8 @@ migrate = MigrationsMigrateCommand(registry)
|
|
|
416
427
|
|
|
417
428
|
## Message bus middleware
|
|
418
429
|
|
|
419
|
-
With
|
|
420
|
-
session the way any service does, and three middleware — registered by name — decide what
|
|
430
|
+
With xtr-messenger installed beside it and a kernel running both bundles, a message handler asks
|
|
431
|
+
for a session the way any service does, and three middleware — registered by name — decide what
|
|
421
432
|
happens to it. Nothing is added to a bus by itself: the bus lists the ones it wants.
|
|
422
433
|
|
|
423
434
|
```python
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xtr-orm"
|
|
3
|
-
version = "
|
|
3
|
+
version = "5.0.0"
|
|
4
4
|
description = "Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -30,7 +30,7 @@ dependencies = [
|
|
|
30
30
|
"alembic>=1.20",
|
|
31
31
|
"sqlalchemy[asyncio]>=2.0.41",
|
|
32
32
|
"typing-extensions>=4.4",
|
|
33
|
-
"xtr-logging-contracts>=
|
|
33
|
+
"xtr-logging-contracts>=5.0,<6",
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[[project.authors]]
|
|
@@ -41,12 +41,6 @@ email = "me@xterr.dev"
|
|
|
41
41
|
postgres = ["asyncpg>=0.29"]
|
|
42
42
|
sqlite = ["aiosqlite>=0.20"]
|
|
43
43
|
mysql = ["asyncmy>=0.2.9"]
|
|
44
|
-
di = [
|
|
45
|
-
"xtr-dependency-injection>=4.0,<5",
|
|
46
|
-
"xtr-service-contracts>=4.0,<5",
|
|
47
|
-
]
|
|
48
|
-
console = ["xtr-console>=4.0,<5"]
|
|
49
|
-
messenger = ["xtr-messenger>=4.0,<5"]
|
|
50
44
|
|
|
51
45
|
[project.entry-points."xtr_dependency_injection.bundles"]
|
|
52
46
|
orm = "xtr_orm.bundle:OrmBundle"
|
|
@@ -63,11 +57,11 @@ dev = [
|
|
|
63
57
|
"anyio>=4.0",
|
|
64
58
|
"ty>=0.0.83",
|
|
65
59
|
"aiosqlite>=0.20",
|
|
66
|
-
"xtr-console>=
|
|
67
|
-
"xtr-dependency-injection>=
|
|
68
|
-
"xtr-logging>=
|
|
69
|
-
"xtr-messenger>=
|
|
70
|
-
"xtr-service-contracts>=
|
|
60
|
+
"xtr-console>=5.0,<6",
|
|
61
|
+
"xtr-dependency-injection>=5.0,<6",
|
|
62
|
+
"xtr-logging>=5.0,<6",
|
|
63
|
+
"xtr-messenger>=5.0,<6",
|
|
64
|
+
"xtr-service-contracts>=5.0,<6",
|
|
71
65
|
]
|
|
72
66
|
|
|
73
67
|
[build-system]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xtr-orm"
|
|
3
|
-
version = "
|
|
3
|
+
version = "5.0.0"
|
|
4
4
|
description = "Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -26,7 +26,7 @@ dependencies = [
|
|
|
26
26
|
"alembic>=1.20",
|
|
27
27
|
"sqlalchemy[asyncio]>=2.0.41",
|
|
28
28
|
"typing-extensions>=4.4",
|
|
29
|
-
"xtr-logging-contracts>=
|
|
29
|
+
"xtr-logging-contracts>=5.0,<6",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
[project.optional-dependencies]
|
|
@@ -39,16 +39,6 @@ sqlite = [
|
|
|
39
39
|
mysql = [
|
|
40
40
|
"asyncmy>=0.2.9",
|
|
41
41
|
]
|
|
42
|
-
di = [
|
|
43
|
-
"xtr-dependency-injection>=4.0,<5",
|
|
44
|
-
"xtr-service-contracts>=4.0,<5",
|
|
45
|
-
]
|
|
46
|
-
console = [
|
|
47
|
-
"xtr-console>=4.0,<5",
|
|
48
|
-
]
|
|
49
|
-
messenger = [
|
|
50
|
-
"xtr-messenger>=4.0,<5",
|
|
51
|
-
]
|
|
52
42
|
|
|
53
43
|
# Advertises the bundle so debug:bundles can name it when installed but not listed.
|
|
54
44
|
# Advertising activates nothing: an application lists the bundles it wants.
|
|
@@ -69,11 +59,11 @@ dev = [
|
|
|
69
59
|
"ty>=0.0.83",
|
|
70
60
|
# Every test runs on SQLite files under the test's own directory: no server.
|
|
71
61
|
"aiosqlite>=0.20",
|
|
72
|
-
"xtr-console>=
|
|
73
|
-
"xtr-dependency-injection>=
|
|
74
|
-
"xtr-logging>=
|
|
75
|
-
"xtr-messenger>=
|
|
76
|
-
"xtr-service-contracts>=
|
|
62
|
+
"xtr-console>=5.0,<6",
|
|
63
|
+
"xtr-dependency-injection>=5.0,<6",
|
|
64
|
+
"xtr-logging>=5.0,<6",
|
|
65
|
+
"xtr-messenger>=5.0,<6",
|
|
66
|
+
"xtr-service-contracts>=5.0,<6",
|
|
77
67
|
]
|
|
78
68
|
|
|
79
69
|
[build-system]
|
|
@@ -20,6 +20,9 @@ connection's name. Everything is async; there is no sync counterpart.
|
|
|
20
20
|
- Write a revision from your models: `orm:migrations:diff --message "add invoices"`. Apply:
|
|
21
21
|
`orm:migrations:migrate`. Read it: `orm:migrations:status`.
|
|
22
22
|
- Without a container: `Migrator(engine, MigrationsConfig(directory="migrations"), Base.metadata)`.
|
|
23
|
+
- In an application, with xtr-dependency-injection installed beside the package (it is not a
|
|
24
|
+
dependency): activate `OrmBundle` and inject what it registers. Only `xtr_orm.bundle` needs the
|
|
25
|
+
container.
|
|
23
26
|
- A library bringing its own tables registers an `OrmMappingsPass` from its bundle's `build`; its
|
|
24
27
|
driver's `load_metadata` must be idempotent.
|
|
25
28
|
- One transaction per message: list `orm_transaction` in the bus's `middleware`; handlers never
|
|
@@ -187,8 +190,9 @@ tables and returns the names it added. Subclassing it has the type checker hold
|
|
|
187
190
|
|
|
188
191
|
## Console commands
|
|
189
192
|
|
|
190
|
-
Needs the
|
|
191
|
-
`OrmConfig.default_connection`. The ones that change the database ask first; `-n`
|
|
193
|
+
Needs xtr-console installed beside the package. Every command takes `--connection NAME`,
|
|
194
|
+
defaulting to `OrmConfig.default_connection`. The ones that change the database ask first; `-n`
|
|
195
|
+
answers yes.
|
|
192
196
|
|
|
193
197
|
| Command | Does |
|
|
194
198
|
|---|---|
|
|
@@ -224,8 +228,10 @@ migrate = MigrationsMigrateCommand(registry)
|
|
|
224
228
|
writes a starting `config/orm.py` with the `default` connection, and `DATABASE_URL` in `.env`. That
|
|
225
229
|
is the steps below a recipe can do; the middleware it prints for you to add.
|
|
226
230
|
|
|
227
|
-
1. **Install** — `uv add "xtr-orm[
|
|
228
|
-
|
|
231
|
+
1. **Install** — `uv add "xtr-orm[postgres]" xtr-dependency-injection`: the bundle needs the
|
|
232
|
+
container installed beside it, never as an extra; `mysql` or `sqlite` instead of `postgres`.
|
|
233
|
+
Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for the bus
|
|
234
|
+
middleware.
|
|
229
235
|
2. **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`
|
|
230
236
|
(`from xtr_orm.bundle import OrmBundle`).
|
|
231
237
|
3. **Brings along** — the logging and console bundles when those packages are installed, each
|
|
@@ -277,8 +283,8 @@ directory; a non-default connection defaults to `%kernel.project_dir%/migrations
|
|
|
277
283
|
|
|
278
284
|
## One transaction per message
|
|
279
285
|
|
|
280
|
-
With
|
|
281
|
-
Nothing is added to a bus by itself — the bus lists what it wants, and order matters.
|
|
286
|
+
With xtr-messenger installed beside it and both bundles active, three middleware are registered
|
|
287
|
+
by name. Nothing is added to a bus by itself — the bus lists what it wants, and order matters.
|
|
282
288
|
|
|
283
289
|
```python
|
|
284
290
|
# <app>/config/messenger.py
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# The `orm:*` console commands
|
|
2
2
|
|
|
3
|
-
Needs
|
|
4
|
-
when the console bundle is active, and each acts on the connections the bundle
|
|
3
|
+
Needs xtr-console installed beside xtr-orm: `uv add xtr-console`. With a container, the bundle
|
|
4
|
+
declares them when the console bundle is active, and each acts on the connections the bundle
|
|
5
|
+
registered.
|
|
5
6
|
|
|
6
7
|
Every command takes `--connection NAME`; the default connection is used without it. The ones that
|
|
7
8
|
change the database ask first, and `-n` answers yes. `--message` names the revision and its file.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Message bus middleware
|
|
2
2
|
|
|
3
|
-
Needs
|
|
4
|
-
`xtr_orm.messenger` is done for you and each middleware is registered under its name for
|
|
5
|
-
configuration to list.
|
|
3
|
+
Needs xtr-messenger installed beside xtr-orm: `uv add xtr-messenger`. With both bundles active,
|
|
4
|
+
importing `xtr_orm.messenger` is done for you and each middleware is registered under its name for
|
|
5
|
+
a bus configuration to list.
|
|
6
6
|
|
|
7
7
|
| Name | Class | Does | Arguments |
|
|
8
8
|
|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ registry.register("default", engine=engine, migrator=migrator, database=database
|
|
|
17
17
|
command = MigrationsMigrateCommand(registry)
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Needs
|
|
20
|
+
Needs xtr-console installed beside this package.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
from __future__ import annotations
|
|
@@ -7,7 +7,7 @@ messenger bundle is active, and the messenger bundle registers each by that
|
|
|
7
7
|
name. Without one, build them with a :class:`~xtr_orm.ConnectionRegistry`
|
|
8
8
|
and put the instances in the configuration.
|
|
9
9
|
|
|
10
|
-
Needs
|
|
10
|
+
Needs xtr-messenger installed beside this package.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
File without changes
|
{xtr_orm-4.0.4 → xtr_orm-5.0.0}/src/xtr_orm/.agents/skills/xtr-orm/references/connections.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|