pyvel-fastapi 0.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.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.3
2
+ Name: pyvel-fastapi
3
+ Version: 0.1.0
4
+ Summary: Laravel-shaped DX for Python API backends on FastAPI — Artisan-like CLI and runtime bases
5
+ Keywords: fastapi,laravel,artisan,cli,scaffold,backend,api,pyvel
6
+ Author: Al-Amin Islam Nerob
7
+ Author-email: Al-Amin Islam Nerob <alamin@aincoder.com>
8
+ License: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Framework :: FastAPI
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
19
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: fastapi>=0.115.0
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: pydantic-settings>=2.0
24
+ Requires-Dist: typer>=0.12.0
25
+ Requires-Dist: uvicorn>=0.30.0
26
+ Requires-Python: >=3.11
27
+ Project-URL: Homepage, https://github.com/aincoder/pyvel
28
+ Project-URL: Repository, https://github.com/aincoder/pyvel
29
+ Project-URL: Documentation, https://github.com/aincoder/pyvel#readme
30
+ Description-Content-Type: text/markdown
31
+
32
+ # pyvel
33
+
34
+ Batteries-included **Laravel-shaped** DX for **Python API backends** on FastAPI.
35
+
36
+ Pyvel gives you an Artisan-like CLI (`pyvel` / `artisan`), convention-based project layout, and small runtime bases (`AppError`, `register`, events). It is **backend/API only** — no Blade, Vite, or frontend stack.
37
+
38
+ > Long-term plans: see the workspace [`roadmap/`](../../roadmap/).
39
+
40
+ ---
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ uv add pyvel-fastapi
46
+ # or
47
+ pip install pyvel-fastapi
48
+ ```
49
+
50
+ The import and CLI stay **`pyvel`**:
51
+
52
+ ```python
53
+ from pyvel import AppError, register
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Quick start
59
+
60
+ ```bash
61
+ uvx --from pyvel-fastapi pyvel init myapp
62
+ cd myapp
63
+ uv sync
64
+ uv run dev
65
+ ```
66
+
67
+ Scaffold into the current directory:
68
+
69
+ ```bash
70
+ mkdir myapp && cd myapp
71
+ uvx --from pyvel-fastapi pyvel init
72
+ ```
73
+
74
+ Monorepo / unpublished local checkout:
75
+
76
+ ```bash
77
+ uv run pyvel init myapp --pyvel-path /path/to/packages/pyvel
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Stable CLI (0.1)
83
+
84
+ Entry points: `pyvel`, `artisan` (alias), and `dev`.
85
+
86
+ | Command | Purpose |
87
+ | --- | --- |
88
+ | `pyvel init [name]` | Scaffold a new API app (`--force`, `--pyvel-path`) |
89
+ | `pyvel make:exc` | Exception + HTTP handler |
90
+ | `pyvel make:req` / `make:res` | Request / response models |
91
+ | `pyvel make:middleware` | Middleware class |
92
+ | `pyvel make:router` | APIRouter module |
93
+ | `pyvel make:service` | Service class |
94
+ | `pyvel make:dependency` | FastAPI dependency |
95
+ | `pyvel make:schema` / `make:enum` / `make:config` | Schema, enum, settings |
96
+ | `pyvel make:event` / `make:listener` / `make:job` | Events, listeners, jobs |
97
+ | `pyvel make:test` | Pytest stub |
98
+ | `pyvel make:resource` | Router + requests + response + service |
99
+ | `pyvel list:routes` | List registered FastAPI routes |
100
+ | `dev` | Run uvicorn using `pyvel.toml` `[dev]` |
101
+
102
+ ---
103
+
104
+ ## Stable public API (0.1)
105
+
106
+ Supported imports for application code:
107
+
108
+ ```python
109
+ from pyvel import AppError, EventDispatcher, dispatcher, register
110
+
111
+ # optional
112
+ import pyvel
113
+ print(pyvel.__version__)
114
+ ```
115
+
116
+ | Symbol | Role |
117
+ | --- | --- |
118
+ | `AppError` | Base application error (override via `[bases].error`) |
119
+ | `register(app)` | Auto-register handlers, middleware, routers, listeners |
120
+ | `dispatcher` / `EventDispatcher` | In-process events |
121
+
122
+ Everything else under `pyvel.*` (`templates`, `generate`, `make`, `config` internals, …) is **private** and may change without notice.
123
+
124
+ See also [`API.md`](API.md).
125
+
126
+ ---
127
+
128
+ ## Config (`pyvel.toml`, optional)
129
+
130
+ All keys optional. Defaults:
131
+
132
+ ```toml
133
+ app = "myapp" # required in practice — set by `init`
134
+ src = "src"
135
+
136
+ [dev]
137
+ module = "myapp.main:app" # default: "{app}.main:app"
138
+ host = "0.0.0.0"
139
+ port = 8000
140
+ reload = true
141
+
142
+ [paths]
143
+ errors = "http/exception/errors"
144
+ handlers = "http/exception/handlers"
145
+ requests = "http/requests"
146
+ responses = "http/responses"
147
+ middleware = "http/middleware"
148
+ routers = "http/routers"
149
+ dependencies = "http/dependencies"
150
+ services = "services"
151
+ schemas = "schemas"
152
+ enums = "domain/enums"
153
+ config = "config"
154
+ events = "events"
155
+ listeners = "listeners"
156
+ jobs = "jobs"
157
+ tests = "tests" # relative to project root
158
+
159
+ [bases]
160
+ error = "pyvel.errors:AppError"
161
+ ```
162
+
163
+ Fallback: `[tool.pyvel] app = "..."` in `pyproject.toml`.
164
+
165
+ ---
166
+
167
+ ## Out of scope (for now)
168
+
169
+ - Laravel-like `routes.py` + `Route` DSL / controllers — **Phase 1**
170
+ - Database / migrations — **Phase 2** (`pyvel-db`)
171
+ - Auth / policies — **Phase 3** (`pyvel-auth`)
172
+ - Queues, cache, mail — **Phase 4+**
173
+ - Frontend scaffolding — never (API-only)
174
+
175
+ ---
176
+
177
+ ## Publish (maintainers)
178
+
179
+ From the package directory, build into a local `dist/` then publish (workspace root builds go to the repo `dist/` by default):
180
+
181
+ ```bash
182
+ cd packages/pyvel
183
+ uv build --out-dir dist
184
+ uv publish
185
+ # Uploads as distribution name: pyvel-fastapi
186
+ # or TestPyPI:
187
+ # uv publish --publish-url https://test.pypi.org/legacy/
188
+ ```
189
+
190
+ From the workspace root (if artifacts are already in `./dist`):
191
+
192
+ ```bash
193
+ uv publish dist/pyvel_fastapi-* dist/pyvel-fastapi-*
194
+ ```
195
+
196
+ Until published, verify locally from a wheel:
197
+
198
+ ```bash
199
+ uvx --from ./dist/pyvel_fastapi-0.1.0-py3-none-any.whl pyvel init /tmp/demoapp
200
+ # (wheel filename uses underscores; project name uses hyphens)
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Roadmap
206
+
207
+ Workspace plans: [`roadmap/README.md`](../../roadmap/README.md). **Phase 0 complete**; next is **Phase 1** (Artisan routing).
@@ -0,0 +1,176 @@
1
+ # pyvel
2
+
3
+ Batteries-included **Laravel-shaped** DX for **Python API backends** on FastAPI.
4
+
5
+ Pyvel gives you an Artisan-like CLI (`pyvel` / `artisan`), convention-based project layout, and small runtime bases (`AppError`, `register`, events). It is **backend/API only** — no Blade, Vite, or frontend stack.
6
+
7
+ > Long-term plans: see the workspace [`roadmap/`](../../roadmap/).
8
+
9
+ ---
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ uv add pyvel-fastapi
15
+ # or
16
+ pip install pyvel-fastapi
17
+ ```
18
+
19
+ The import and CLI stay **`pyvel`**:
20
+
21
+ ```python
22
+ from pyvel import AppError, register
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Quick start
28
+
29
+ ```bash
30
+ uvx --from pyvel-fastapi pyvel init myapp
31
+ cd myapp
32
+ uv sync
33
+ uv run dev
34
+ ```
35
+
36
+ Scaffold into the current directory:
37
+
38
+ ```bash
39
+ mkdir myapp && cd myapp
40
+ uvx --from pyvel-fastapi pyvel init
41
+ ```
42
+
43
+ Monorepo / unpublished local checkout:
44
+
45
+ ```bash
46
+ uv run pyvel init myapp --pyvel-path /path/to/packages/pyvel
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Stable CLI (0.1)
52
+
53
+ Entry points: `pyvel`, `artisan` (alias), and `dev`.
54
+
55
+ | Command | Purpose |
56
+ | --- | --- |
57
+ | `pyvel init [name]` | Scaffold a new API app (`--force`, `--pyvel-path`) |
58
+ | `pyvel make:exc` | Exception + HTTP handler |
59
+ | `pyvel make:req` / `make:res` | Request / response models |
60
+ | `pyvel make:middleware` | Middleware class |
61
+ | `pyvel make:router` | APIRouter module |
62
+ | `pyvel make:service` | Service class |
63
+ | `pyvel make:dependency` | FastAPI dependency |
64
+ | `pyvel make:schema` / `make:enum` / `make:config` | Schema, enum, settings |
65
+ | `pyvel make:event` / `make:listener` / `make:job` | Events, listeners, jobs |
66
+ | `pyvel make:test` | Pytest stub |
67
+ | `pyvel make:resource` | Router + requests + response + service |
68
+ | `pyvel list:routes` | List registered FastAPI routes |
69
+ | `dev` | Run uvicorn using `pyvel.toml` `[dev]` |
70
+
71
+ ---
72
+
73
+ ## Stable public API (0.1)
74
+
75
+ Supported imports for application code:
76
+
77
+ ```python
78
+ from pyvel import AppError, EventDispatcher, dispatcher, register
79
+
80
+ # optional
81
+ import pyvel
82
+ print(pyvel.__version__)
83
+ ```
84
+
85
+ | Symbol | Role |
86
+ | --- | --- |
87
+ | `AppError` | Base application error (override via `[bases].error`) |
88
+ | `register(app)` | Auto-register handlers, middleware, routers, listeners |
89
+ | `dispatcher` / `EventDispatcher` | In-process events |
90
+
91
+ Everything else under `pyvel.*` (`templates`, `generate`, `make`, `config` internals, …) is **private** and may change without notice.
92
+
93
+ See also [`API.md`](API.md).
94
+
95
+ ---
96
+
97
+ ## Config (`pyvel.toml`, optional)
98
+
99
+ All keys optional. Defaults:
100
+
101
+ ```toml
102
+ app = "myapp" # required in practice — set by `init`
103
+ src = "src"
104
+
105
+ [dev]
106
+ module = "myapp.main:app" # default: "{app}.main:app"
107
+ host = "0.0.0.0"
108
+ port = 8000
109
+ reload = true
110
+
111
+ [paths]
112
+ errors = "http/exception/errors"
113
+ handlers = "http/exception/handlers"
114
+ requests = "http/requests"
115
+ responses = "http/responses"
116
+ middleware = "http/middleware"
117
+ routers = "http/routers"
118
+ dependencies = "http/dependencies"
119
+ services = "services"
120
+ schemas = "schemas"
121
+ enums = "domain/enums"
122
+ config = "config"
123
+ events = "events"
124
+ listeners = "listeners"
125
+ jobs = "jobs"
126
+ tests = "tests" # relative to project root
127
+
128
+ [bases]
129
+ error = "pyvel.errors:AppError"
130
+ ```
131
+
132
+ Fallback: `[tool.pyvel] app = "..."` in `pyproject.toml`.
133
+
134
+ ---
135
+
136
+ ## Out of scope (for now)
137
+
138
+ - Laravel-like `routes.py` + `Route` DSL / controllers — **Phase 1**
139
+ - Database / migrations — **Phase 2** (`pyvel-db`)
140
+ - Auth / policies — **Phase 3** (`pyvel-auth`)
141
+ - Queues, cache, mail — **Phase 4+**
142
+ - Frontend scaffolding — never (API-only)
143
+
144
+ ---
145
+
146
+ ## Publish (maintainers)
147
+
148
+ From the package directory, build into a local `dist/` then publish (workspace root builds go to the repo `dist/` by default):
149
+
150
+ ```bash
151
+ cd packages/pyvel
152
+ uv build --out-dir dist
153
+ uv publish
154
+ # Uploads as distribution name: pyvel-fastapi
155
+ # or TestPyPI:
156
+ # uv publish --publish-url https://test.pypi.org/legacy/
157
+ ```
158
+
159
+ From the workspace root (if artifacts are already in `./dist`):
160
+
161
+ ```bash
162
+ uv publish dist/pyvel_fastapi-* dist/pyvel-fastapi-*
163
+ ```
164
+
165
+ Until published, verify locally from a wheel:
166
+
167
+ ```bash
168
+ uvx --from ./dist/pyvel_fastapi-0.1.0-py3-none-any.whl pyvel init /tmp/demoapp
169
+ # (wheel filename uses underscores; project name uses hyphens)
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Roadmap
175
+
176
+ Workspace plans: [`roadmap/README.md`](../../roadmap/README.md). **Phase 0 complete**; next is **Phase 1** (Artisan routing).
@@ -0,0 +1,61 @@
1
+ [project]
2
+ name = "pyvel-fastapi"
3
+ version = "0.1.0"
4
+ description = "Laravel-shaped DX for Python API backends on FastAPI — Artisan-like CLI and runtime bases"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ keywords = [
8
+ "fastapi",
9
+ "laravel",
10
+ "artisan",
11
+ "cli",
12
+ "scaffold",
13
+ "backend",
14
+ "api",
15
+ "pyvel",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Console",
20
+ "Framework :: FastAPI",
21
+ "Intended Audience :: Developers",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
28
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
29
+ "Typing :: Typed",
30
+ ]
31
+ dependencies = [
32
+ "fastapi>=0.115.0",
33
+ "pydantic>=2.0",
34
+ "pydantic-settings>=2.0",
35
+ "typer>=0.12.0",
36
+ "uvicorn>=0.30.0",
37
+ ]
38
+
39
+ [project.license]
40
+ text = "MIT"
41
+
42
+ [[project.authors]]
43
+ name = "Al-Amin Islam Nerob"
44
+ email = "alamin@aincoder.com"
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/aincoder/pyvel"
48
+ Repository = "https://github.com/aincoder/pyvel"
49
+ Documentation = "https://github.com/aincoder/pyvel#readme"
50
+
51
+ [project.scripts]
52
+ pyvel = "pyvel.app:app"
53
+ artisan = "pyvel.app:app"
54
+ dev = "pyvel.app:dev"
55
+
56
+ [build-system]
57
+ requires = ["uv_build>=0.12.18,<0.13.0"]
58
+ build-backend = "uv_build"
59
+
60
+ [tool.uv.build-backend]
61
+ module-name = "pyvel"
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "pyvel-fastapi"
3
+ version = "0.1.0"
4
+ description = "Laravel-shaped DX for Python API backends on FastAPI — Artisan-like CLI and runtime bases"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { text = "MIT" }
8
+ authors = [
9
+ { name = "Al-Amin Islam Nerob", email = "alamin@aincoder.com" }
10
+ ]
11
+ keywords = [
12
+ "fastapi",
13
+ "laravel",
14
+ "artisan",
15
+ "cli",
16
+ "scaffold",
17
+ "backend",
18
+ "api",
19
+ "pyvel",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Environment :: Console",
24
+ "Framework :: FastAPI",
25
+ "Intended Audience :: Developers",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Programming Language :: Python :: 3.14",
31
+ "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
32
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
33
+ "Typing :: Typed",
34
+ ]
35
+ dependencies = [
36
+ "fastapi>=0.115.0",
37
+ "pydantic>=2.0",
38
+ "pydantic-settings>=2.0",
39
+ "typer>=0.12.0",
40
+ "uvicorn>=0.30.0",
41
+ ]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/aincoder/pyvel"
45
+ Repository = "https://github.com/aincoder/pyvel"
46
+ Documentation = "https://github.com/aincoder/pyvel#readme"
47
+
48
+ [project.scripts]
49
+ pyvel = "pyvel.app:app"
50
+ artisan = "pyvel.app:app"
51
+ dev = "pyvel.app:dev"
52
+
53
+ [build-system]
54
+ requires = ["uv_build>=0.12.18,<0.13.0"]
55
+ build-backend = "uv_build"
56
+
57
+ [tool.uv.build-backend]
58
+ module-name = "pyvel"
@@ -0,0 +1,8 @@
1
+ """pyvel — FastAPI scaffolding CLI and shared runtime bases."""
2
+
3
+ from pyvel.errors import AppError
4
+ from pyvel.events import EventDispatcher, dispatcher
5
+ from pyvel.registry import register
6
+
7
+ __all__ = ["AppError", "EventDispatcher", "dispatcher", "register"]
8
+ __version__ = "0.1.0"
@@ -0,0 +1,46 @@
1
+ """pyvel CLI entrypoints (`pyvel`, `artisan`, and `dev`)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ import typer
8
+ import uvicorn
9
+
10
+ from pyvel import init_cmd, list_cmd, make
11
+ from pyvel.config import clear_settings_cache, load_settings
12
+
13
+ app = typer.Typer(
14
+ name="pyvel",
15
+ help="Laravel-shaped scaffolding CLI for Python API backends on FastAPI.",
16
+ no_args_is_help=True,
17
+ add_completion=False,
18
+ )
19
+
20
+ init_cmd.register(app)
21
+ make.register(app)
22
+ list_cmd.register(app)
23
+
24
+
25
+ def _clear_terminal() -> None:
26
+ """Clear the screen and scrollback buffer."""
27
+ sys.stdout.write("\033[2J\033[3J\033[H")
28
+ sys.stdout.flush()
29
+
30
+
31
+ def dev() -> None:
32
+ """Run the API with settings from optional `pyvel.toml`."""
33
+ clear_settings_cache()
34
+ settings = load_settings()
35
+ dev_cfg = settings.resolved_dev()
36
+ _clear_terminal()
37
+ uvicorn.run(
38
+ dev_cfg.module,
39
+ host=dev_cfg.host,
40
+ port=dev_cfg.port,
41
+ reload=dev_cfg.reload,
42
+ )
43
+
44
+
45
+ if __name__ == "__main__":
46
+ app()