minix 0.2.2__tar.gz → 0.2.4__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.
- {minix-0.2.2 → minix-0.2.4}/PKG-INFO +298 -57
- {minix-0.2.2 → minix-0.2.4}/README.md +293 -53
- {minix-0.2.2 → minix-0.2.4}/minix/core/bootstrap/bootstrap.py +7 -2
- minix-0.2.4/minix/core/cli/commands/__init__.py +19 -0
- minix-0.2.4/minix/core/cli/commands/add_module.py +262 -0
- minix-0.2.4/minix/core/cli/commands/add_module_scaffold.py +792 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/cli/commands/init.py +84 -30
- minix-0.2.4/minix/core/cli/commands/init_prompts.py +99 -0
- minix-0.2.4/minix/core/cli/commands/init_scaffold.py +181 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/global_settings.py +8 -8
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/minix_settings.py +4 -4
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/.env.example +35 -4
- minix-0.2.4/minix/core/conf/project_template/AGENTS.md +199 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/Dockerfile +6 -1
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/config.py +23 -11
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/docker-compose.yml +51 -6
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/__init__.py +1 -1
- minix-0.2.4/minix/core/connectors/sql_connector/__init__.py +9 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/sql_connector/sql_connector.py +97 -22
- minix-0.2.4/minix/core/connectors/sql_connector/transaction.py +145 -0
- {minix-0.2.2 → minix-0.2.4}/pyproject.toml +8 -2
- minix-0.2.2/minix/core/cli/commands/__init__.py +0 -11
- minix-0.2.2/minix/core/cli/commands/init_scaffold.py +0 -78
- minix-0.2.2/minix/core/connectors/sql_connector/__init__.py +0 -1
- {minix-0.2.2 → minix-0.2.4}/minix/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/bootstrap/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/cli/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/cli/cli.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/cli/options.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/builders.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/env.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/.dockerignore +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/.gitignore +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/entries/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/entries/api.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/entries/beat.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/conf/project_template/entries/worker.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/connector.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/object_storage_connector/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/object_storage_connector/config.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/object_storage_connector/connector.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/qdrant_connector/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/qdrant_connector/connector.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/redis_connector/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/connectors/redis_connector/redis_connector.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/consumer/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/consumer/async_consumer.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/controller/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/controller/controller.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/entity/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/entity/entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/entity/qdrant_entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/entity/redis_entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/entity/sql_entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/install/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/install/installable.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/model/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/model/embedding_model.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/model/mlflow_model.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/model/model.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/model/model_registry.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/module/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/module/business_module/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/module/business_module/business_module.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/module/module.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/dependencies.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/entities/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/entities/api_key_entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/module.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/repositories/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/repositories/api_key_repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/services/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/auth/services/api_key_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/config.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/controllers/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/controllers/oidc_controller.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/dependencies.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/entities/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/entities/oidc_user_entity.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/module.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/repositories/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/repositories/oidc_user_repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/services/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/services/oidc_discovery_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/services/oidc_user_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/modules/oidc/session.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/object_storage/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/object_storage/config.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/object_storage/connector.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/registry/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/registry/registry.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/qdrant/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/qdrant/qdrant_repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/redis/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/redis/redis_repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/sql/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/repository/sql/sql_repository.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/scheduler.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/task/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/task/task.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/task/workflow_tasks.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/scheduler/workflow.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/base_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/helper_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/qdrant/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/qdrant/qdrant_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/redis/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/redis/redis_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/sql/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/service/sql/sql_service.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/mlflow/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/mlflow/log_metric.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/singleton/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/singleton/singleton.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/string/__init__.py +0 -0
- {minix-0.2.2 → minix-0.2.4}/minix/core/utils/string/to_snake_case.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: minix
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A modular Python framework for backend, AI, and data projects
|
|
5
5
|
Author: AmirHossein Advari
|
|
6
6
|
Author-email: amiradvari@gmail.com
|
|
@@ -10,9 +10,10 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
14
13
|
Provides-Extra: ai
|
|
15
14
|
Provides-Extra: clickhouse
|
|
15
|
+
Provides-Extra: mysql
|
|
16
|
+
Provides-Extra: postgresql
|
|
16
17
|
Provides-Extra: vdb
|
|
17
18
|
Requires-Dist: aiokafka (>=0.12.0,<0.13.0)
|
|
18
19
|
Requires-Dist: authlib (>=1.3,<2.0)
|
|
@@ -28,8 +29,9 @@ Requires-Dist: loguru (>=0.7) ; extra == "ai"
|
|
|
28
29
|
Requires-Dist: mlflow (>=2.0) ; extra == "ai"
|
|
29
30
|
Requires-Dist: numpy (>=1.24) ; extra == "ai"
|
|
30
31
|
Requires-Dist: numpy (>=1.24) ; extra == "vdb"
|
|
32
|
+
Requires-Dist: psycopg[binary] (>=3.1) ; extra == "postgresql"
|
|
31
33
|
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
|
32
|
-
Requires-Dist: pymysql (>=1.1.1
|
|
34
|
+
Requires-Dist: pymysql (>=1.1.1) ; extra == "mysql"
|
|
33
35
|
Requires-Dist: qdrant-client (>=1.0) ; extra == "vdb"
|
|
34
36
|
Requires-Dist: redis (>=4.6.0,<5.0.0)
|
|
35
37
|
Requires-Dist: sqlalchemy (>=2.0.41,<3.0.0)
|
|
@@ -44,38 +46,76 @@ Description-Content-Type: text/markdown
|
|
|
44
46
|
**Minix** is a modular Python framework for building backend, AI, and data-driven applications. It provides a clean, layered architecture with built-in support for REST APIs, task scheduling, message queues, and machine learning workflows.
|
|
45
47
|
|
|
46
48
|

|
|
47
|
-

|
|
48
50
|

|
|
49
51
|
|
|
50
52
|
---
|
|
51
53
|
|
|
52
54
|
## Table of Contents
|
|
53
55
|
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
56
|
+
- [Minix](#minix)
|
|
57
|
+
- [Table of Contents](#table-of-contents)
|
|
58
|
+
- [Key Features](#key-features)
|
|
59
|
+
- [Architecture Overview](#architecture-overview)
|
|
60
|
+
- [Installation](#installation)
|
|
61
|
+
- [Requirements](#requirements)
|
|
62
|
+
- [Install via pip](#install-via-pip)
|
|
63
|
+
- [Install from source (development)](#install-from-source-development)
|
|
64
|
+
- [Core Concepts](#core-concepts)
|
|
65
|
+
- [Bootstrap](#bootstrap)
|
|
66
|
+
- [Modules](#modules)
|
|
67
|
+
- [Entities](#entities)
|
|
68
|
+
- [SQL Entity](#sql-entity)
|
|
69
|
+
- [Qdrant Entity (Vector DB)](#qdrant-entity-vector-db)
|
|
70
|
+
- [Redis Entity](#redis-entity)
|
|
71
|
+
- [Repositories](#repositories)
|
|
72
|
+
- [SQL Repository](#sql-repository)
|
|
73
|
+
- [Qdrant Repository](#qdrant-repository)
|
|
74
|
+
- [Services](#services)
|
|
75
|
+
- [Controllers](#controllers)
|
|
76
|
+
- [Connectors](#connectors)
|
|
77
|
+
- [SQL Connector (PostgreSQL/MySQL/ClickHouse)](#sql-connector-postgresqlmysqlclickhouse)
|
|
78
|
+
- [Qdrant Connector](#qdrant-connector)
|
|
79
|
+
- [Object Storage Connector (S3-compatible)](#object-storage-connector-s3-compatible)
|
|
80
|
+
- [Tasks \& Scheduling](#tasks--scheduling)
|
|
81
|
+
- [Async Task](#async-task)
|
|
82
|
+
- [Periodic Task](#periodic-task)
|
|
83
|
+
- [Running Tasks Manually](#running-tasks-manually)
|
|
84
|
+
- [Workflows (DAG Scheduling)](#workflows-dag-scheduling)
|
|
85
|
+
- [Creating a Workflow](#creating-a-workflow)
|
|
86
|
+
- [Dependency Result Passing](#dependency-result-passing)
|
|
87
|
+
- [Running the Entire Workflow](#running-the-entire-workflow)
|
|
88
|
+
- [Running a Specific Target Node](#running-a-specific-target-node)
|
|
89
|
+
- [Workflow Execution Guarantees](#workflow-execution-guarantees)
|
|
90
|
+
- [Kafka Consumers](#kafka-consumers)
|
|
91
|
+
- [ML Models](#ml-models)
|
|
92
|
+
- [Base Model](#base-model)
|
|
93
|
+
- [Embedding Model](#embedding-model)
|
|
94
|
+
- [MLflow Model (requires `ai` extra)](#mlflow-model-requires-ai-extra)
|
|
95
|
+
- [Configuration](#configuration)
|
|
96
|
+
- [Project config](#project-config)
|
|
97
|
+
- [Connectors from config](#connectors-from-config)
|
|
98
|
+
- [Environment overrides](#environment-overrides)
|
|
99
|
+
- [Extras](#extras)
|
|
100
|
+
- [SQL drivers](#sql-drivers)
|
|
101
|
+
- [AI Capabilities](#ai-capabilities)
|
|
102
|
+
- [Vector DB (Qdrant)](#vector-db-qdrant)
|
|
103
|
+
- [ClickHouse Support](#clickhouse-support)
|
|
104
|
+
- [Install All Extras](#install-all-extras)
|
|
105
|
+
- [Registry Usage](#registry-usage)
|
|
106
|
+
- [CLI Commands](#cli-commands)
|
|
107
|
+
- [Quick map](#quick-map)
|
|
108
|
+
- [Global options](#global-options)
|
|
109
|
+
- [`minix init`](#minix-init)
|
|
110
|
+
- [`minix add module`](#minix-add-module)
|
|
111
|
+
- [SQL binding (all or none)](#sql-binding-all-or-none)
|
|
112
|
+
- [Flags](#flags)
|
|
113
|
+
- [Naming rules](#naming-rules)
|
|
114
|
+
- [Module layout](#module-layout)
|
|
115
|
+
- [After scaffolding](#after-scaffolding)
|
|
116
|
+
- [License](#license)
|
|
117
|
+
- [Contributing](#contributing)
|
|
118
|
+
- [Author](#author)
|
|
79
119
|
|
|
80
120
|
---
|
|
81
121
|
|
|
@@ -83,7 +123,7 @@ Description-Content-Type: text/markdown
|
|
|
83
123
|
|
|
84
124
|
- **FastAPI Integration**: Build high-performance REST APIs with automatic OpenAPI documentation
|
|
85
125
|
- **Modular Architecture**: Organize code into self-contained modules with entities, repositories, services, and controllers
|
|
86
|
-
- **Multi-Database Support**: Built-in connectors for MySQL, ClickHouse, Redis, and Qdrant (vector DB)
|
|
126
|
+
- **Multi-Database Support**: Built-in connectors for PostgreSQL (default), MySQL, ClickHouse, Redis, and Qdrant (vector DB)
|
|
87
127
|
- **Task Scheduling**: Celery-powered background tasks with RedBeat scheduler for periodic jobs
|
|
88
128
|
- **Kafka Consumers**: Async Kafka message processing with `aiokafka`
|
|
89
129
|
- **Object Storage**: S3-compatible storage support via `boto3`
|
|
@@ -110,7 +150,7 @@ Description-Content-Type: text/markdown
|
|
|
110
150
|
│ Tasks (Celery) │ Consumers (Kafka) │ Models (MLflow) │
|
|
111
151
|
├─────────────────────────────────────────────────────────────────┤
|
|
112
152
|
│ Connectors │
|
|
113
|
-
│ SQL (MySQL/ClickHouse) │ Redis │ Qdrant │ Object Storage (S3) │
|
|
153
|
+
│ SQL (PostgreSQL/MySQL/ClickHouse) │ Redis │ Qdrant │ Object Storage (S3) │
|
|
114
154
|
└─────────────────────────────────────────────────────────────────┘
|
|
115
155
|
```
|
|
116
156
|
|
|
@@ -177,11 +217,10 @@ class ProductModule(BusinessModule):
|
|
|
177
217
|
```
|
|
178
218
|
|
|
179
219
|
**Module Methods:**
|
|
180
|
-
- `add_binding(entity, repository, service, connection=None)` - Register
|
|
181
|
-
- `add_entity
|
|
182
|
-
- `add_repository(repository, connector_salt)` - Register a repository with optional connector (**deprecated**, use `add_binding`)
|
|
183
|
-
- `add_service(service)` - Register a service (**deprecated**, use `add_binding`)
|
|
220
|
+
- `add_binding(entity, repository, service, connection=None)` - Register entity + repository + service together (required unit; do not split them)
|
|
221
|
+
- `add_entity` / `add_repository` / `add_service` - **Deprecated**; use `add_binding` instead
|
|
184
222
|
- `add_controller(controller)` - Register an API controller
|
|
223
|
+
- `add_helper_service(helper)` - Register a helper service
|
|
185
224
|
- `add_task(task)` - Register an async task
|
|
186
225
|
- `add_periodic_task(periodic_task)` - Register a scheduled task
|
|
187
226
|
- `add_consumer(consumer)` - Register a Kafka consumer
|
|
@@ -252,6 +291,30 @@ class UserRepository(SqlRepository[UserEntity]):
|
|
|
252
291
|
- `update(entity)` - Update an entity
|
|
253
292
|
- `delete(entity)` - Delete an entity
|
|
254
293
|
|
|
294
|
+
**Cross-module transactions** (one session, one commit):
|
|
295
|
+
|
|
296
|
+
By default each repository call opens its own session and commits. Wrap related
|
|
297
|
+
writes in `sql_transaction()` so every repository on that connector shares one
|
|
298
|
+
session until the block exits:
|
|
299
|
+
|
|
300
|
+
```python
|
|
301
|
+
from minix.core.connectors import sql_transaction
|
|
302
|
+
from minix.core.registry import Registry
|
|
303
|
+
|
|
304
|
+
with sql_transaction():
|
|
305
|
+
Registry().get(OrderSqlRepository).save(order)
|
|
306
|
+
Registry().get(PaymentSqlRepository).save(payment)
|
|
307
|
+
# committed once here; any exception rolls back all work in the block
|
|
308
|
+
|
|
309
|
+
with sql_transaction("mysql"): # named DATABASES entry
|
|
310
|
+
...
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Equivalent long form: `Registry().get(SqlConnector).transaction()`.
|
|
314
|
+
Nested calls on the same connector use SAVEPOINTs. Custom repository methods
|
|
315
|
+
that call `session.commit()` still join the outer unit (`commit` becomes
|
|
316
|
+
`flush` while the transaction is active).
|
|
317
|
+
|
|
255
318
|
#### Qdrant Repository
|
|
256
319
|
|
|
257
320
|
```python
|
|
@@ -308,17 +371,23 @@ class UserController(Controller):
|
|
|
308
371
|
|
|
309
372
|
### Connectors
|
|
310
373
|
|
|
311
|
-
#### SQL Connector (MySQL/ClickHouse)
|
|
374
|
+
#### SQL Connector (PostgreSQL/MySQL/ClickHouse)
|
|
375
|
+
|
|
376
|
+
PostgreSQL is the recommended default (`DB_DRIVER=postgresql`). Install the matching
|
|
377
|
+
extra (`minix[postgresql]` and/or `minix[mysql]`). ClickHouse remains
|
|
378
|
+
`minix[clickhouse]`.
|
|
312
379
|
|
|
313
380
|
```python
|
|
314
381
|
from minix.core.connectors import SqlConnector
|
|
315
382
|
|
|
316
|
-
# Reads
|
|
383
|
+
# Reads DATABASES["default"] from settings / env
|
|
317
384
|
connector = SqlConnector()
|
|
385
|
+
# Secondary engine when both were selected at init:
|
|
386
|
+
# connector = SqlConnector(connection="mysql")
|
|
318
387
|
|
|
319
388
|
# Deprecated — still supported for backward compatibility:
|
|
320
389
|
# from minix.core.connectors import SqlConnector, SqlConnectorConfig
|
|
321
|
-
# connector = SqlConnector(SqlConnectorConfig(username="
|
|
390
|
+
# connector = SqlConnector(SqlConnectorConfig(username="minix", driver="postgresql", ...))
|
|
322
391
|
```
|
|
323
392
|
|
|
324
393
|
#### Qdrant Connector
|
|
@@ -596,9 +665,9 @@ DATABASES = {
|
|
|
596
665
|
"user": "...",
|
|
597
666
|
"password": "...",
|
|
598
667
|
"host": "...",
|
|
599
|
-
"port":
|
|
668
|
+
"port": 5432,
|
|
600
669
|
"name": "analytics",
|
|
601
|
-
"driver": "
|
|
670
|
+
"driver": "postgresql",
|
|
602
671
|
},
|
|
603
672
|
}
|
|
604
673
|
|
|
@@ -646,17 +715,29 @@ MLFLOW_TRACKING_URL=http://localhost:5000
|
|
|
646
715
|
|
|
647
716
|
## Extras
|
|
648
717
|
|
|
718
|
+
### SQL drivers
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
pip install "minix[postgresql]" # recommended default
|
|
722
|
+
pip install "minix[mysql]"
|
|
723
|
+
pip install "minix[postgresql,mysql]"
|
|
724
|
+
```
|
|
725
|
+
|
|
649
726
|
### AI Capabilities
|
|
650
727
|
|
|
651
|
-
Install with AI tools (PyTorch, MLflow
|
|
728
|
+
Install with AI tools (PyTorch, MLflow):
|
|
652
729
|
|
|
653
730
|
```bash
|
|
654
731
|
pip install "minix[ai]"
|
|
655
732
|
```
|
|
656
733
|
|
|
657
|
-
###
|
|
734
|
+
### Vector DB (Qdrant)
|
|
658
735
|
|
|
659
|
-
|
|
736
|
+
```bash
|
|
737
|
+
pip install "minix[vdb]"
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### ClickHouse Support
|
|
660
741
|
|
|
661
742
|
```bash
|
|
662
743
|
pip install "minix[clickhouse]"
|
|
@@ -665,7 +746,7 @@ pip install "minix[clickhouse]"
|
|
|
665
746
|
### Install All Extras
|
|
666
747
|
|
|
667
748
|
```bash
|
|
668
|
-
pip install "minix[ai,vdb,clickhouse]"
|
|
749
|
+
pip install "minix[postgresql,mysql,ai,vdb,clickhouse]"
|
|
669
750
|
```
|
|
670
751
|
|
|
671
752
|
---
|
|
@@ -694,13 +775,23 @@ connector = Registry().get(SqlConnector, salt="analytics")
|
|
|
694
775
|
|
|
695
776
|
## CLI Commands
|
|
696
777
|
|
|
697
|
-
Install Minix, then use the `minix` entry point
|
|
778
|
+
Install Minix, then use the `minix` entry point. Prefer these commands over
|
|
779
|
+
hand-writing project or module boilerplate.
|
|
698
780
|
|
|
699
781
|
```bash
|
|
700
782
|
minix --help
|
|
701
|
-
minix
|
|
783
|
+
minix init --help
|
|
784
|
+
minix add module --help
|
|
702
785
|
```
|
|
703
786
|
|
|
787
|
+
### Quick map
|
|
788
|
+
|
|
789
|
+
| Goal | Command |
|
|
790
|
+
|------|---------|
|
|
791
|
+
| New project in cwd | `minix init APP_NAME` |
|
|
792
|
+
| New feature module | `minix add module MODULE_NAME` |
|
|
793
|
+
| Version | `minix -v` / `minix --version` |
|
|
794
|
+
|
|
704
795
|
### Global options
|
|
705
796
|
|
|
706
797
|
| Option | Short | Description |
|
|
@@ -721,18 +812,35 @@ Scaffold a project in the **current directory**.
|
|
|
721
812
|
minix init APP_NAME [OPTIONS]
|
|
722
813
|
```
|
|
723
814
|
|
|
815
|
+
**Interactive prompt (first question, multi-select):**
|
|
816
|
+
|
|
817
|
+
```text
|
|
818
|
+
Which SQL database(s) do you want? (comma-separated for multiple)
|
|
819
|
+
1) postgresql (recommended) [default]
|
|
820
|
+
2) mysql
|
|
821
|
+
Examples: 1 | 2 | 1,2
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
Press Enter for PostgreSQL only. Select `1,2` when you need both.
|
|
825
|
+
Pass `--db-driver postgresql`, `--db-driver mysql`, or
|
|
826
|
+
`--db-driver postgresql,mysql` to skip the prompt (also used when stdin is not a TTY).
|
|
827
|
+
|
|
828
|
+
SQL drivers are **optional extras** (`minix[postgresql]`, `minix[mysql]`). Docker only
|
|
829
|
+
installs the engines you selected.
|
|
830
|
+
|
|
724
831
|
| Argument / option | Default | Description |
|
|
725
832
|
|-------------------|---------|-------------|
|
|
726
833
|
| `APP_NAME` | *(required)* | Written to `app_name` in `config.py`, `.env`, and `.env.example` |
|
|
834
|
+
| `--db-driver` | prompted (`postgresql`) | One or more: `postgresql` (recommended), `mysql` |
|
|
727
835
|
| `--app-port` | `8000` | API port (Dockerfile `EXPOSE` / compose `app` mapping) |
|
|
728
|
-
| `--db-port` | `3306` | Host port for
|
|
836
|
+
| `--db-port` | `5432` / `3306` | Host port for the **primary** SQL DB (PostgreSQL preferred when both are selected) |
|
|
729
837
|
| `--redis-port` | `6379` | Host port for Redis |
|
|
730
838
|
| `--qdrant-port` | `6333` | Host port for Qdrant HTTP |
|
|
731
839
|
| `--qdrant-grpc-port` | `6334` | Host port for Qdrant gRPC |
|
|
732
840
|
| `--object-storage-port` | `9000` | Host port for MinIO API |
|
|
733
841
|
| `--object-storage-console-port` | `9001` | Host port for MinIO console |
|
|
734
|
-
| `--extras` | *(auto)* | Comma-separated PyPI extras: `vdb`, `clickhouse`, `ai` |
|
|
735
|
-
| `--no-extras` | off |
|
|
842
|
+
| `--extras` | *(auto)* | Comma-separated PyPI extras: `postgresql`, `mysql`, `vdb`, `clickhouse`, `ai` (SQL also set from `--db-driver`) |
|
|
843
|
+
| `--no-extras` | off | Skip auto-detected non-SQL extras |
|
|
736
844
|
|
|
737
845
|
**Creates:**
|
|
738
846
|
|
|
@@ -742,30 +850,163 @@ minix init APP_NAME [OPTIONS]
|
|
|
742
850
|
| `.env.example` | Documented env keys with copy instructions (commit this) |
|
|
743
851
|
| `.env` | Local overrides without the copy header (gitignored) |
|
|
744
852
|
| `.gitignore` | Python / IDE / dotenv ignores |
|
|
745
|
-
| `Dockerfile` | App image (`pip install minix`
|
|
746
|
-
| `docker-compose.yml` | MySQL, Redis, MinIO, API, Celery; optional Qdrant / ClickHouse / MLflow |
|
|
853
|
+
| `Dockerfile` | App image (`pip install "minix~=X.Y.Z"` / extras from PyPI) |
|
|
854
|
+
| `docker-compose.yml` | PostgreSQL or MySQL, Redis, MinIO, API, Celery; optional Qdrant / ClickHouse / MLflow |
|
|
747
855
|
| `.dockerignore` | Build context excludes |
|
|
856
|
+
| `AGENTS.md` | CLI guide for AI coding agents (prefer `minix` over hand-scaffolding) |
|
|
748
857
|
| `entries/` | `api.py`, `worker.py`, `beat.py` process entrypoints |
|
|
749
858
|
|
|
859
|
+
**App wiring after init** (settings, not legacy `app_connectors.py` / `app_modules.py`):
|
|
860
|
+
|
|
861
|
+
- Connectors: `DATABASES`, `OBJECT_STORAGES`, `QDRANT_CONNECTIONS`, … in `config.py`
|
|
862
|
+
- Modules: `INSTALLED_MODULES` list of dotted paths
|
|
863
|
+
- Boot: `bootstrap_from_settings()` in `entries/api.py`
|
|
864
|
+
|
|
750
865
|
**Behavior:**
|
|
751
866
|
|
|
752
867
|
- Fails with exit code `1` if `config.py` or `settings.py` already exists.
|
|
753
868
|
- Existing optional files (`.env`, `.gitignore`, Docker files, `entries/`) are kept
|
|
754
869
|
(`.env` only gains `MINIX_SETTINGS_MODULE` when missing).
|
|
755
870
|
- Port flags bake defaults into `Dockerfile`, `docker-compose.yml`, `.env`, and `config.py`.
|
|
756
|
-
- **
|
|
757
|
-
(
|
|
758
|
-
|
|
759
|
-
|
|
871
|
+
- **SQL choice** (one or more) selects compose services, pip extras
|
|
872
|
+
(`minix[postgresql]` / `minix[mysql]`), Dockerfile client libs, and
|
|
873
|
+
`DATABASES` entries. If both are selected, PostgreSQL is the primary
|
|
874
|
+
`default` connection and MySQL is registered as `DATABASES["mysql"]`.
|
|
875
|
+
- **Optional extras:** Non-SQL extras can still be inferred from the current
|
|
876
|
+
environment (e.g. `minix[vdb]`). Override with `--extras …` or `--no-extras`.
|
|
877
|
+
- **Version pin:** The Dockerfile uses a compatible release on the installed minor
|
|
878
|
+
(e.g. ``minix~=0.2.3`` → latest ``0.2.x`` ≥ ``0.2.3``, not ``0.3``), capped to
|
|
879
|
+
the newest version **published on PyPI** so a local unreleased build cannot
|
|
880
|
+
break `docker compose build`. Prefer letting `minix init` manage the pin.
|
|
760
881
|
|
|
761
882
|
```bash
|
|
762
883
|
minix init my_app
|
|
763
|
-
minix init my_app --
|
|
884
|
+
minix init my_app --db-driver postgresql
|
|
885
|
+
minix init my_app --db-driver mysql --db-port 3307
|
|
886
|
+
minix init my_app --db-driver postgresql,mysql
|
|
887
|
+
minix init my_app --app-port 8001 --redis-port 6380
|
|
764
888
|
pip install "minix[vdb]"
|
|
765
889
|
minix init my_app --extras vdb
|
|
766
890
|
minix init my_app --no-extras
|
|
767
891
|
```
|
|
768
892
|
|
|
893
|
+
Install SQL drivers in an existing environment with:
|
|
894
|
+
|
|
895
|
+
```bash
|
|
896
|
+
pip install "minix[postgresql]"
|
|
897
|
+
pip install "minix[mysql]"
|
|
898
|
+
pip install "minix[postgresql,mysql]"
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### `minix add module`
|
|
902
|
+
|
|
903
|
+
Scaffold a feature module under `src/modules/<name>/`.
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
minix add module MODULE_NAME [OPTIONS]
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
**Default stack:** entity + repository + service + controller.
|
|
910
|
+
The SQL trio is wired with a single `add_binding(...)` in `module.py`.
|
|
911
|
+
Tasks / helpers / consumers / periodic tasks are **opt-in**.
|
|
912
|
+
|
|
913
|
+
| Piece | Example for `orders` |
|
|
914
|
+
|-------|----------------------|
|
|
915
|
+
| Entity | `Order` → `entities/order_entity.py` |
|
|
916
|
+
| Repository | `OrderSqlRepository` |
|
|
917
|
+
| Service | `OrderSqlService` |
|
|
918
|
+
| Controller | `OrderController` |
|
|
919
|
+
| Wiring | `module.py` → `.add_binding(...)` + `.add_controller(...)` |
|
|
920
|
+
| Package export | `OrdersModule` from `__init__.py` |
|
|
921
|
+
|
|
922
|
+
#### SQL binding (all or none)
|
|
923
|
+
|
|
924
|
+
Entity, repository, and service are **one unit**. The CLI never generates a
|
|
925
|
+
partial binding:
|
|
926
|
+
|
|
927
|
+
- Default: all three are created.
|
|
928
|
+
- `--no-binding`: skip all three.
|
|
929
|
+
- `--entity=` / `--repository=` / `--service=` (or `-e` / `-r` / `-s`) only
|
|
930
|
+
rename; missing pieces are still filled so the binding stays complete.
|
|
931
|
+
- Combining `--no-binding` with any of those flags is an error.
|
|
932
|
+
- There are no `--no-entity` / `--no-repository` / `--no-service` flags.
|
|
933
|
+
|
|
934
|
+
#### Flags
|
|
935
|
+
|
|
936
|
+
| Flag | Short | Default | Description |
|
|
937
|
+
|------|-------|---------|-------------|
|
|
938
|
+
| `--entity[=Name]` | `-e` | on (with binding) | Rename the binding entity (`Order` for `orders`) |
|
|
939
|
+
| `--repository[=Name]` | `-r` | on (with binding) | Rename the binding repository |
|
|
940
|
+
| `--service[=Name]` | `-s` | on (with binding) | Rename the binding service |
|
|
941
|
+
| `--controller[=Name]` | `-c` | on | HTTP controller |
|
|
942
|
+
| `--task[=Name]` | `-t` | off | Async Celery `Task` |
|
|
943
|
+
| `--helper[=Name]` | `-H` | off | `HelperService` |
|
|
944
|
+
| `--consumer[=Name]` | | off | Kafka `AsyncConsumer` |
|
|
945
|
+
| `--periodic[=Name]` | `-p` | off | `PeriodicTask` |
|
|
946
|
+
| `--all` | `-a` | off | Default stack + task, helper, consumer, periodic |
|
|
947
|
+
| `--no-binding` | | off | Skip entity + repository + service together |
|
|
948
|
+
| `--no-controller` | | off | Skip controller only |
|
|
949
|
+
| `--path DIR` | | `src/modules/<name>` | Package directory |
|
|
950
|
+
| `--force` | `-f` | off | Overwrite existing files |
|
|
951
|
+
| `--register` / `--no-register` | | register | Append to `config.py` `INSTALLED_MODULES` |
|
|
952
|
+
|
|
953
|
+
#### Naming rules
|
|
954
|
+
|
|
955
|
+
- Long flags accept an optional value with `=`: `--controller=ShopController`, `--task=ShipOrder`.
|
|
956
|
+
- Short flags (`-c`, `-t`, …) are **presence-only** — do not pass a separate value after them.
|
|
957
|
+
- Safe: `minix add module orders -t --no-register`
|
|
958
|
+
- Avoid: `minix add module orders -t ShipOrder` (use `--task=ShipOrder`)
|
|
959
|
+
|
|
960
|
+
```bash
|
|
961
|
+
# Default CRUD/API stack + auto-register in config.py
|
|
962
|
+
minix add module orders
|
|
963
|
+
|
|
964
|
+
# Custom class names (binding still complete)
|
|
965
|
+
minix add module orders --entity=ShopOrder --controller=ShopController
|
|
966
|
+
|
|
967
|
+
# Background task add-on
|
|
968
|
+
minix add module orders -t
|
|
969
|
+
minix add module orders --task=FulfillOrder -H
|
|
970
|
+
|
|
971
|
+
# Everything
|
|
972
|
+
minix add module orders -a
|
|
973
|
+
|
|
974
|
+
# Worker-oriented: no HTTP controller
|
|
975
|
+
minix add module orders --no-controller -t
|
|
976
|
+
|
|
977
|
+
# No SQL binding (e.g. helper/consumer-only style module)
|
|
978
|
+
minix add module orders --no-binding -H --consumer=OrderEventsConsumer
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
#### Module layout
|
|
982
|
+
|
|
983
|
+
```
|
|
984
|
+
src/modules/<name>/
|
|
985
|
+
__init__.py # exports <Name>Module
|
|
986
|
+
module.py # BusinessModule + add_binding / add_*
|
|
987
|
+
entities/ # present when binding is on
|
|
988
|
+
repositories/
|
|
989
|
+
services/
|
|
990
|
+
controllers/ # optional
|
|
991
|
+
tasks/ # optional (Task + PeriodicTask)
|
|
992
|
+
consumers/ # optional
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
#### After scaffolding
|
|
996
|
+
|
|
997
|
+
1. Confirm `INSTALLED_MODULES` contains e.g. `"src.modules.orders.OrdersModule"`.
|
|
998
|
+
2. Implement fields on the entity; add an Alembic migration if the app uses one.
|
|
999
|
+
3. Expand service / controller as needed.
|
|
1000
|
+
4. Restart API / worker.
|
|
1001
|
+
|
|
1002
|
+
```python
|
|
1003
|
+
from src.modules.orders import OrdersModule
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
Cross-module links: put the FK on the owning entity and resolve the other side with
|
|
1007
|
+
`Registry().get(OtherService)` in services (do not merge unrelated entities into one
|
|
1008
|
+
module only because they relate).
|
|
1009
|
+
|
|
769
1010
|
---
|
|
770
1011
|
|
|
771
1012
|
## License
|
|
@@ -785,4 +1026,4 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
785
1026
|
**AmirHossein Advari** - [amiradvari@gmail.com](mailto:amiradvari@gmail.com) \
|
|
786
1027
|
**Shirin Dehghani** - [shirin.dehghani1996@gmail.com](mailto:shirin.dehghani1996@gmail.com) \
|
|
787
1028
|
**Parsa Mohammadpour** - [parsa.mohammadpour01@gmail.com](mailto:parsa.mohammadpour01@gmail.com)
|
|
788
|
-
|
|
1029
|
+
**Emad Sudani** - [sudani.emad@gmail.com](mailto:sudani.emad@gmail.com)
|