sirius-cli 0.1.0__py3-none-any.whl

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.
Files changed (32) hide show
  1. sirius_cli/__init__.py +1 -0
  2. sirius_cli/cli.py +335 -0
  3. sirius_cli/generator.py +125 -0
  4. sirius_cli/parser.py +322 -0
  5. sirius_cli/templates/backend/Dockerfile.jinja2 +17 -0
  6. sirius_cli/templates/backend/alembic/env.py.jinja2 +70 -0
  7. sirius_cli/templates/backend/alembic/script.py.mako.jinja2 +26 -0
  8. sirius_cli/templates/backend/database.py.jinja2 +39 -0
  9. sirius_cli/templates/backend/main.py.jinja2 +178 -0
  10. sirius_cli/templates/backend/models.py.jinja2 +31 -0
  11. sirius_cli/templates/backend/requirements.txt.jinja2 +13 -0
  12. sirius_cli/templates/backend/schemas.py.jinja2 +80 -0
  13. sirius_cli/templates/docker-compose.yml.jinja2 +27 -0
  14. sirius_cli/templates/frontend/.env.jinja2 +3 -0
  15. sirius_cli/templates/frontend/Dockerfile.jinja2 +12 -0
  16. sirius_cli/templates/frontend/index.html.jinja2 +16 -0
  17. sirius_cli/templates/frontend/package.json.jinja2 +28 -0
  18. sirius_cli/templates/frontend/postcss.config.js.jinja2 +6 -0
  19. sirius_cli/templates/frontend/src/App.tsx.jinja2 +89 -0
  20. sirius_cli/templates/frontend/src/Dashboard.tsx.jinja2 +210 -0
  21. sirius_cli/templates/frontend/src/TableCrud.tsx.jinja2 +567 -0
  22. sirius_cli/templates/frontend/src/index.css.jinja2 +25 -0
  23. sirius_cli/templates/frontend/src/main.tsx.jinja2 +10 -0
  24. sirius_cli/templates/frontend/tailwind.config.js.jinja2 +21 -0
  25. sirius_cli/templates/frontend/tsconfig.json.jinja2 +25 -0
  26. sirius_cli/templates/frontend/vite.config.ts.jinja2 +10 -0
  27. sirius_cli-0.1.0.dist-info/METADATA +165 -0
  28. sirius_cli-0.1.0.dist-info/RECORD +32 -0
  29. sirius_cli-0.1.0.dist-info/WHEEL +5 -0
  30. sirius_cli-0.1.0.dist-info/entry_points.txt +2 -0
  31. sirius_cli-0.1.0.dist-info/licenses/LICENSE +619 -0
  32. sirius_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: sirius-cli
3
+ Version: 0.1.0
4
+ Summary: A rapid prototyping tool for generating containerized backend + frontend CRUD stacks from CSV/SQLite files.
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: typer>=0.9.0
9
+ Requires-Dist: jinja2>=3.0.0
10
+ Requires-Dist: pandas>=1.5.0
11
+ Requires-Dist: sqlalchemy>=2.0.0
12
+ Requires-Dist: alembic>=1.11.0
13
+ Requires-Dist: pydantic>=2.0.0
14
+ Requires-Dist: openpyxl>=3.0.0
15
+ Dynamic: license-file
16
+
17
+ # Sirius-CLI
18
+
19
+ A rapid prototyping CLI tool designed to take multiple CSV files, Excel spreadsheets, a SQLite database, or a JSON configuration file as inputs, automatically infer their structural schemas and relationships, and generate:
20
+ - A production-grade, container-ready **FastAPI** backend (with SQLAlchemy models, Pydantic v2 validation schemas, and automated Alembic migrations).
21
+ - A modular, responsive, multi-page **React 18 (TypeScript, Vite, Tailwind CSS)** CRUD frontend with dynamic relational selectors and a beautiful Dashboard.
22
+
23
+ ---
24
+
25
+ ## Key Capabilities
26
+
27
+ - **Automatic Relationship Mapping**: Automatically extracts foreign keys from databases and resolves CSV/Excel associations using naming heuristics (linking `[table]_id` fields), navigating irregular English plurals effortlessly.
28
+ - **Auto-Seeding**: Automatically seeds the generated database with the entries inside the source CSV/Excel files during migration (if using SQLite).
29
+ - **Relational Integrity**: Generates dropdowns in the UI for foreign keys and displays badges that navigate to parent entities.
30
+ - **Enterprise Data Grid**: The generated tables feature server-side searching (`?search=`), server-side column sorting (`?order_by=`), and dual data export buttons (CSV and Excel `.xlsx`).
31
+ - **Dashboard Analytics**: A built-in Recharts dashboard showing live dataset distribution and entity insights.
32
+ - **Multiple Database Engines**: Target `SQLite` for rapid local prototyping, or generate `PostgreSQL` and `MySQL` ready projects out of the box using `--pg` and `--mysql`.
33
+ - **Iterative Updates**: Use `sirius-update` to safely inject new tables or columns into an existing scaffolded project.
34
+
35
+ ---
36
+
37
+ ## Installation
38
+
39
+ Install the package locally in editable mode:
40
+ ```bash
41
+ pip install -e .
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Usage: Creating a New Project (`sirius-init`)
47
+
48
+ ### 1. Generating from CSVs or Excel
49
+ ```bash
50
+ # From CSVs
51
+ sirius-init store_system --csv examples/users.csv --csv examples/orders.csv --theme violet
52
+
53
+ # From Excel
54
+ sirius-init store_system --excel examples/products.xlsx --theme amber
55
+ ```
56
+
57
+ ### 2. Target Production Databases
58
+ By default, the stack uses an embedded SQLite file (`app.db`). You can target Postgres or MySQL instead:
59
+ ```bash
60
+ sirius-init billing_system --config schema.json --pg
61
+ ```
62
+ *(The generated `docker-compose.yml` and `database.py` will expect a `DATABASE_URL` environment variable).*
63
+
64
+ ### 3. Generating from JSON Configuration
65
+ Specify database schemas, relationships, and colors in a JSON file:
66
+ ```json
67
+ {
68
+ "project_name": "billing_system",
69
+ "theme": "emerald",
70
+ "entities": {
71
+ "customers": {
72
+ "columns": [
73
+ { "name": "id", "type": "Integer", "is_pk": true },
74
+ { "name": "name", "type": "String" },
75
+ { "name": "email", "type": "String" },
76
+ { "name": "is_active", "type": "Boolean" }
77
+ ]
78
+ },
79
+ "invoices": {
80
+ "columns": [
81
+ { "name": "id", "type": "Integer", "is_pk": true },
82
+ { "name": "ref_no", "type": "String" },
83
+ { "name": "amount", "type": "Float" },
84
+ { "name": "customer_id", "type": "Integer", "foreign_key": "customers.id" },
85
+ { "name": "created_at", "type": "DateTime" }
86
+ ]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+ Then run:
92
+ ```bash
93
+ sirius-init --config examples/billing-config.json
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Usage: Updating an Existing Project (`sirius-update`)
99
+
100
+ If your data requirements change (e.g., adding a `reviews` table to your store), you don't need to start from scratch. Use `sirius-update` to merge new schemas into an existing project.
101
+
102
+ ```bash
103
+ sirius-update ./store_system --csv examples/new_reviews.csv
104
+ ```
105
+
106
+ Sirius-CLI will:
107
+ 1. Regenerate your SQLAlchemy models and Pydantic schemas.
108
+ 2. Regenerate your frontend routing and CRUD views.
109
+ 3. Automatically run `alembic revision --autogenerate` and `alembic upgrade head` to apply the database migrations seamlessly.
110
+
111
+ ---
112
+
113
+ ## All CLI Flags
114
+
115
+ ### `sirius-init` / `sirius-update`
116
+
117
+ | Flag | Short | Default | Description |
118
+ |---|---|---|---|
119
+ | `--csv` | | | Path to a CSV file (repeatable) |
120
+ | `--excel` | | | Path to an Excel .xlsx/.xls file (repeatable) |
121
+ | `--db` | | | Path to a SQLite .db file |
122
+ | `--config` | `-c` | | Path to a JSON config file |
123
+ | `--theme` | `-t` | `blue` | Frontend color theme (`blue`, `indigo`, `emerald`, `amber`, `rose`, `sky`, `violet`) |
124
+ | `--out` | `-o` | `.` | Output directory (only for `init`) |
125
+ | `--port` | `-p` | `8000` | Backend port (used in Dockerfile, docker-compose, .env) |
126
+ | `--api-url` | | `http://localhost:<port>` | Override the frontend VITE_API_URL |
127
+ | `--no-seed` | | `false` | Skip seeding the DB from source CSV/Excel files |
128
+ | `--pg` | | `false` | Generate Postgres connection pool and drivers |
129
+ | `--mysql` | | `false` | Generate MySQL connection pool and drivers |
130
+
131
+ ---
132
+
133
+ ## Running the Scaffolded Stack
134
+
135
+ ### Using Docker Compose
136
+ ```bash
137
+ cd <project_name>
138
+ docker compose up --build
139
+ ```
140
+
141
+ ### Running Locally
142
+ 1. **Start Backend**:
143
+ ```bash
144
+ cd <project_name>/backend
145
+ pip install -r requirements.txt
146
+ uvicorn backend.main:app --reload --port 8000
147
+ ```
148
+ 2. **Start Frontend**:
149
+ ```bash
150
+ cd <project_name>/frontend
151
+ npm install
152
+ npm run dev
153
+ ```
154
+ Open `http://localhost:5173/` in your browser.
155
+
156
+ ---
157
+
158
+ ## License & Commercial Use
159
+
160
+ Sirius-CLI is open-source and released under the **GNU AGPLv3 License**.
161
+
162
+ This is a strong copyleft license that ensures the project remains free and open. By using this software, you agree that any modifications or larger works incorporating this tool that are distributed or provided as a network service (SaaS) **must also be open-sourced** under the same AGPLv3 license.
163
+
164
+ **Dual Licensing for Enterprise**
165
+ If your organization wishes to use Sirius-CLI in proprietary, closed-source software without being subject to the open-source requirements of the AGPLv3, a **Commercial License** is available for purchase. Please contact the maintainer for more details on enterprise licensing.
@@ -0,0 +1,32 @@
1
+ sirius_cli/__init__.py,sha256=ZrAeJE1uMzlxg4X-idA3Ba4ftIfn1p7q4T_gcPEs8vk,21
2
+ sirius_cli/cli.py,sha256=P3D62g9f-XIkTbPaiqzQED000PsBDZ-OGgrdQy4wi5w,15081
3
+ sirius_cli/generator.py,sha256=rpBhdAbjxNMW1A45IWs0z78HqQyZ0TuJbj683p4IjaM,4384
4
+ sirius_cli/parser.py,sha256=HW_yu0SwGHqArmrAKbCdGmLRVRiRmCFlosAnfVMKUE0,11520
5
+ sirius_cli/templates/docker-compose.yml.jinja2,sha256=RHxKjolGt4zc6KIjWyG1ih1a3ccdLhE3GRrOEqdIaJk,479
6
+ sirius_cli/templates/backend/Dockerfile.jinja2,sha256=Ay6QgUMprdS4cNkB2_0x0Wje2wbnqSos-mz2GsfOn8M,413
7
+ sirius_cli/templates/backend/database.py.jinja2,sha256=GBc9AX5eUk1fnrHmrgKe7GRvfZe6nHbG_Nqf5Q8UT_0,1266
8
+ sirius_cli/templates/backend/main.py.jinja2,sha256=IATRVNf2MjxOy-GpCk3eL_n7Nob3ybiMb0LXOXSlCSo,6768
9
+ sirius_cli/templates/backend/models.py.jinja2,sha256=udO4_MIDnA1-nbMI5DhxeS0oXppi7-5F3Fzbu9W2vGM,1129
10
+ sirius_cli/templates/backend/requirements.txt.jinja2,sha256=eMR5hzB_AcAMLM0bRAcBUJhwqZa-tqWzIV56wU6WR3Q,241
11
+ sirius_cli/templates/backend/schemas.py.jinja2,sha256=pRSu8tbBtEQ-6Omlfn2MqzBGm0ce7T8ut2KiIv9ft5g,3056
12
+ sirius_cli/templates/backend/alembic/env.py.jinja2,sha256=EHQTjzRVHWVUsv0hl5IefelV6wf0VytI0F5pX20gmuE,1906
13
+ sirius_cli/templates/backend/alembic/script.py.mako.jinja2,sha256=J2d5Gyqs0ZumB_U7ABgN68gmGwqoSEn3rOG-vNduUuU,523
14
+ sirius_cli/templates/frontend/.env.jinja2,sha256=E9PxDgta-0zn35xJXIUsefZohm71Vq2fF9GzpP-EScs,130
15
+ sirius_cli/templates/frontend/Dockerfile.jinja2,sha256=f59huwwT7Rj4ijxtO-EAjkiq4z1Ewt28WJXO_DourRc,137
16
+ sirius_cli/templates/frontend/index.html.jinja2,sha256=d54geNKYKaokyRMC6mS-JmOajQyuA65LvkZ7ehg8T7s,708
17
+ sirius_cli/templates/frontend/package.json.jinja2,sha256=T2btMNkYgBvOmxc6tUdLvA6NzGyLMKA7gHqOZxNDJxo,635
18
+ sirius_cli/templates/frontend/postcss.config.js.jinja2,sha256=hZLG_OtBHyhlqZtN694nISAXcFRdQ6lPr9if4EPh4c8,78
19
+ sirius_cli/templates/frontend/tailwind.config.js.jinja2,sha256=U87elnT-nIaFNy2YJjJi5fR-xJSpEhfI2TgWkex1two,411
20
+ sirius_cli/templates/frontend/tsconfig.json.jinja2,sha256=_23QLYPxlX5mcrOLFliiwhD10qR2XxbtsxuuGXZTHoA,582
21
+ sirius_cli/templates/frontend/vite.config.ts.jinja2,sha256=ZQ0SWdCWNA5wG207pW2sgXxbUL3sbQ12qhRImHe58Ac,180
22
+ sirius_cli/templates/frontend/src/App.tsx.jinja2,sha256=t-MPc7G68eK5-hv2tB_Saexqm_ehJlOa8gea1mXAuD0,3971
23
+ sirius_cli/templates/frontend/src/Dashboard.tsx.jinja2,sha256=KZ7F6jS4sQ7zB3xa8H6T86TplVL39PUjz-dbW9nfuSQ,9455
24
+ sirius_cli/templates/frontend/src/TableCrud.tsx.jinja2,sha256=cBYVP7-gzuAf_jMRDXS9yT_1F9Ec2KGYZEk8xUTe-tk,24640
25
+ sirius_cli/templates/frontend/src/index.css.jinja2,sha256=OtOSVznfw-2kZL1diDsNw1Yj91j-eeOcb3IKJ0l9NYM,447
26
+ sirius_cli/templates/frontend/src/main.tsx.jinja2,sha256=1UAmXezxGB3uttbqWzAbZvDDqDLXK8LT1g3VZmQXmXA,235
27
+ sirius_cli-0.1.0.dist-info/licenses/LICENSE,sha256=chfQduHY7P_dqgE4rkaW0vurtvXpMlvD_6kjVNaL7NA,32385
28
+ sirius_cli-0.1.0.dist-info/METADATA,sha256=0jips20f-YWKH7HbOh1W2VzOWSiSelee5Snq7evlhPk,6434
29
+ sirius_cli-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
30
+ sirius_cli-0.1.0.dist-info/entry_points.txt,sha256=xFPJau6Z8Fdvz_Xjr6Q-bwJADmzAZodadbNsu8PU_s4,51
31
+ sirius_cli-0.1.0.dist-info/top_level.txt,sha256=MLvIdQaLzQlK3m7ERVqqCktdkYtGIO3KR2TnwF27vS8,11
32
+ sirius_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sirius-init = sirius_cli.cli:app