xtr-orm 5.0.0__tar.gz → 5.1.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-5.0.0 → xtr_orm-5.1.0}/PKG-INFO +8 -8
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/README.md +7 -7
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/pyproject.toml +1 -1
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/pyproject.toml.orig +1 -1
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/.agents/skills/xtr-orm/SKILL.md +6 -6
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/.agents/skills/xtr-orm/references/messenger.md +1 -1
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/recipe/manifest.toml +1 -1
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/LICENSE +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/.agents/skills/xtr-orm/references/commands.md +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/.agents/skills/xtr-orm/references/connections.md +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/.agents/skills/xtr-orm/references/migrations.md +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/bundle/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/bundle/connection_config.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/bundle/orm_bundle.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/bundle/orm_config.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/bundle/orm_mappings_pass.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/_reporting.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/connection_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/database_create_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/database_drop_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_current_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_diff_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_dump_schema_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_execute_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_generate_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_latest_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_list_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_migrate_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_rollup_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_status_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_up_to_date_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/migrations_version_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/command/run_sql_command.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/connection_registry.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/database/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/database/database_manager.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/invalid_argument_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/migration_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/missing_database_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/orm_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/session_unavailable_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/unknown_connection_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/exception/unsupported_database_error.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/mapping_driver_interface.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/messenger/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/messenger/close_connection_middleware.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/messenger/open_transaction_logger_middleware.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/messenger/transaction_middleware.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/_environment.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/_history.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/_revisions.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/_schema.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/available_migration.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/direction.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/executed_migration.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/execution_result.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/migration_plan.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/migration_status.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/migrations_config.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/migrator.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/migrations/template/script.py.mako +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/py.typed +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/recipe/__init__.py +0 -0
- {xtr_orm-5.0.0 → xtr_orm-5.1.0}/src/xtr_orm/recipe/files/config/orm.py.tmpl +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xtr-orm
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.1.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
|
|
@@ -203,15 +203,15 @@ removing it undoes.
|
|
|
203
203
|
those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
|
|
204
204
|
the [message bus middleware](#message-bus-middleware).
|
|
205
205
|
- **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
|
|
206
|
-
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
|
|
206
|
+
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/packages/orm.py` with the
|
|
207
207
|
`default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
|
|
208
208
|
cannot make for you.
|
|
209
|
-
- **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported from
|
|
209
|
+
- **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported from
|
|
210
210
|
`xtr_orm.bundle`.
|
|
211
211
|
- **Brings along** — the logging and console bundles, when those packages are installed.
|
|
212
212
|
With the messenger bundle active too, the [middleware](#message-bus-middleware) are
|
|
213
213
|
registered for a bus to list.
|
|
214
|
-
- **Configure** — the recipe writes a starting `<app>/config/orm.py` with the `default`
|
|
214
|
+
- **Configure** — the recipe writes a starting `<app>/config/packages/orm.py` with the `default`
|
|
215
215
|
connection reading `DATABASE_URL`, its revisions in `migrations` in the project directory and
|
|
216
216
|
diffs against the models advanced-alchemy registers. Add connections, replicas and table
|
|
217
217
|
definitions to that `@configure` function returning `OrmConfig` — see
|
|
@@ -221,7 +221,7 @@ removing it undoes.
|
|
|
221
221
|
[Options in the URL](#options-in-the-url).
|
|
222
222
|
- **Ignore** — nothing: commit `migrations/`.
|
|
223
223
|
- **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
|
|
224
|
-
entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
|
|
224
|
+
entry, delete `<app>/config/packages/orm.py`, then `uv remove xtr-orm`.
|
|
225
225
|
- **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
|
|
226
226
|
`orm:migrations:status` reaches the database.
|
|
227
227
|
|
|
@@ -232,14 +232,14 @@ not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bun
|
|
|
232
232
|
connections:
|
|
233
233
|
|
|
234
234
|
```python
|
|
235
|
-
# app/bundles.py
|
|
235
|
+
# app/config/bundles.py
|
|
236
236
|
from xtr_orm.bundle import OrmBundle
|
|
237
237
|
|
|
238
238
|
BUNDLES = {OrmBundle: {"all": True}}
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
```python
|
|
242
|
-
# app/config/orm.py
|
|
242
|
+
# app/config/packages/orm.py
|
|
243
243
|
from xtr_dependency_injection import configure, env
|
|
244
244
|
from xtr_orm.bundle import ConnectionConfig, OrmConfig
|
|
245
245
|
|
|
@@ -479,7 +479,7 @@ class NotifyAccounting:
|
|
|
479
479
|
```
|
|
480
480
|
|
|
481
481
|
```python
|
|
482
|
-
# app/config/messenger.py
|
|
482
|
+
# app/config/packages/messenger.py
|
|
483
483
|
MessageBusConfig(
|
|
484
484
|
middleware=[
|
|
485
485
|
"orm_close_connection",
|
|
@@ -171,15 +171,15 @@ removing it undoes.
|
|
|
171
171
|
those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
|
|
172
172
|
the [message bus middleware](#message-bus-middleware).
|
|
173
173
|
- **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
|
|
174
|
-
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
|
|
174
|
+
*Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/packages/orm.py` with the
|
|
175
175
|
`default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
|
|
176
176
|
cannot make for you.
|
|
177
|
-
- **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported from
|
|
177
|
+
- **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported from
|
|
178
178
|
`xtr_orm.bundle`.
|
|
179
179
|
- **Brings along** — the logging and console bundles, when those packages are installed.
|
|
180
180
|
With the messenger bundle active too, the [middleware](#message-bus-middleware) are
|
|
181
181
|
registered for a bus to list.
|
|
182
|
-
- **Configure** — the recipe writes a starting `<app>/config/orm.py` with the `default`
|
|
182
|
+
- **Configure** — the recipe writes a starting `<app>/config/packages/orm.py` with the `default`
|
|
183
183
|
connection reading `DATABASE_URL`, its revisions in `migrations` in the project directory and
|
|
184
184
|
diffs against the models advanced-alchemy registers. Add connections, replicas and table
|
|
185
185
|
definitions to that `@configure` function returning `OrmConfig` — see
|
|
@@ -189,7 +189,7 @@ removing it undoes.
|
|
|
189
189
|
[Options in the URL](#options-in-the-url).
|
|
190
190
|
- **Ignore** — nothing: commit `migrations/`.
|
|
191
191
|
- **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
|
|
192
|
-
entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
|
|
192
|
+
entry, delete `<app>/config/packages/orm.py`, then `uv remove xtr-orm`.
|
|
193
193
|
- **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
|
|
194
194
|
`orm:migrations:status` reaches the database.
|
|
195
195
|
|
|
@@ -200,14 +200,14 @@ not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bun
|
|
|
200
200
|
connections:
|
|
201
201
|
|
|
202
202
|
```python
|
|
203
|
-
# app/bundles.py
|
|
203
|
+
# app/config/bundles.py
|
|
204
204
|
from xtr_orm.bundle import OrmBundle
|
|
205
205
|
|
|
206
206
|
BUNDLES = {OrmBundle: {"all": True}}
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
```python
|
|
210
|
-
# app/config/orm.py
|
|
210
|
+
# app/config/packages/orm.py
|
|
211
211
|
from xtr_dependency_injection import configure, env
|
|
212
212
|
from xtr_orm.bundle import ConnectionConfig, OrmConfig
|
|
213
213
|
|
|
@@ -447,7 +447,7 @@ class NotifyAccounting:
|
|
|
447
447
|
```
|
|
448
448
|
|
|
449
449
|
```python
|
|
450
|
-
# app/config/messenger.py
|
|
450
|
+
# app/config/packages/messenger.py
|
|
451
451
|
MessageBusConfig(
|
|
452
452
|
middleware=[
|
|
453
453
|
"orm_close_connection",
|
|
@@ -14,7 +14,7 @@ connection's name. Everything is async; there is no sync counterpart.
|
|
|
14
14
|
|
|
15
15
|
- Inject `Injected[AsyncSession]` for the default connection;
|
|
16
16
|
`Annotated[AsyncSession, Target("reports")]` for another. Never build a session yourself.
|
|
17
|
-
- Name databases in `<app>/config/orm.py` with a `@configure` function returning `OrmConfig`.
|
|
17
|
+
- Name databases in `<app>/config/packages/orm.py` with a `@configure` function returning `OrmConfig`.
|
|
18
18
|
- Set `DATABASE_URL` with an async driver: `postgresql+asyncpg://`, `mysql+asyncmy://`,
|
|
19
19
|
`sqlite+aiosqlite:///`. Engine and session options may ride on its query.
|
|
20
20
|
- Write a revision from your models: `orm:migrations:diff --message "add invoices"`. Apply:
|
|
@@ -225,14 +225,14 @@ migrate = MigrationsMigrateCommand(registry)
|
|
|
225
225
|
## Use in an application
|
|
226
226
|
|
|
227
227
|
`uv run xtr-recipes recipes:sync` applies the recipe shipped with this package: it lists `OrmBundle`,
|
|
228
|
-
writes a starting `config/orm.py` with the `default` connection, and `DATABASE_URL` in `.env`. That
|
|
228
|
+
writes a starting `config/packages/orm.py` with the `default` connection, and `DATABASE_URL` in `.env`. That
|
|
229
229
|
is the steps below a recipe can do; the middleware it prints for you to add.
|
|
230
230
|
|
|
231
231
|
1. **Install** — `uv add "xtr-orm[postgres]" xtr-dependency-injection`: the bundle needs the
|
|
232
232
|
container installed beside it, never as an extra; `mysql` or `sqlite` instead of `postgres`.
|
|
233
233
|
Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for the bus
|
|
234
234
|
middleware.
|
|
235
|
-
2. **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`
|
|
235
|
+
2. **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`
|
|
236
236
|
(`from xtr_orm.bundle import OrmBundle`).
|
|
237
237
|
3. **Brings along** — the logging and console bundles when those packages are installed, each
|
|
238
238
|
optional. With the logging bundle active an `orm` channel is added and every migrator logs the
|
|
@@ -242,7 +242,7 @@ is the steps below a recipe can do; the middleware it prints for you to add.
|
|
|
242
242
|
advanced-alchemy registers.
|
|
243
243
|
|
|
244
244
|
```python
|
|
245
|
-
# <app>/config/orm.py
|
|
245
|
+
# <app>/config/packages/orm.py
|
|
246
246
|
from xtr_dependency_injection import configure, env
|
|
247
247
|
from xtr_orm.bundle import ConnectionConfig, MigrationsConfig, OrmConfig
|
|
248
248
|
|
|
@@ -274,7 +274,7 @@ is the steps below a recipe can do; the middleware it prints for you to add.
|
|
|
274
274
|
8. **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
|
|
275
275
|
`orm:migrations:status` reaches the database.
|
|
276
276
|
9. **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
|
|
277
|
-
entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
|
|
277
|
+
entry, delete `<app>/config/packages/orm.py`, then `uv remove xtr-orm`.
|
|
278
278
|
|
|
279
279
|
`OrmConfig` has two fields: `default_connection` (`"default"`) and `connections`
|
|
280
280
|
(`{"default": ConnectionConfig()}`). Two connections may not keep their revisions in one
|
|
@@ -287,7 +287,7 @@ With xtr-messenger installed beside it and both bundles active, three middleware
|
|
|
287
287
|
by name. Nothing is added to a bus by itself — the bus lists what it wants, and order matters.
|
|
288
288
|
|
|
289
289
|
```python
|
|
290
|
-
# <app>/config/messenger.py
|
|
290
|
+
# <app>/config/packages/messenger.py
|
|
291
291
|
MessageBusConfig(
|
|
292
292
|
middleware=[
|
|
293
293
|
"orm_close_connection", # outermost: closes after the transaction ended
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# Destination under the application package = template under this recipe.
|
|
10
10
|
# The default connection on DATABASE_URL, written out so the application has
|
|
11
11
|
# one place to add replicas, connections and its models' metadata.
|
|
12
|
-
"config/orm.py" = "files/config/orm.py.tmpl"
|
|
12
|
+
"config/packages/orm.py" = "files/config/orm.py.tmpl"
|
|
13
13
|
|
|
14
14
|
[env]
|
|
15
15
|
# Read when a connection is first used — engine, session, migrator or command —
|
|
File without changes
|
|
File without changes
|
{xtr_orm-5.0.0 → xtr_orm-5.1.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
|
|
File without changes
|