racerapi 0.0.3__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.
- racerapi-0.0.3/LICENSE.md +25 -0
- racerapi-0.0.3/MANIFEST.in +3 -0
- racerapi-0.0.3/PKG-INFO +69 -0
- racerapi-0.0.3/README.md +37 -0
- racerapi-0.0.3/pyproject.toml +72 -0
- racerapi-0.0.3/setup.cfg +35 -0
- racerapi-0.0.3/src/racerapi/__init__.py +0 -0
- racerapi-0.0.3/src/racerapi/version.py +1 -0
- racerapi-0.0.3/src/racerapi.egg-info/PKG-INFO +69 -0
- racerapi-0.0.3/src/racerapi.egg-info/SOURCES.txt +33 -0
- racerapi-0.0.3/src/racerapi.egg-info/dependency_links.txt +1 -0
- racerapi-0.0.3/src/racerapi.egg-info/entry_points.txt +2 -0
- racerapi-0.0.3/src/racerapi.egg-info/requires.txt +12 -0
- racerapi-0.0.3/src/racerapi.egg-info/top_level.txt +2 -0
- racerapi-0.0.3/src/racerapi_cli/__init__.py +1 -0
- racerapi-0.0.3/src/racerapi_cli/__main__.py +101 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/__init__.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/common/exceptions.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/common/response.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/core/app_factory.py +10 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/core/config.py +16 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/core/logging.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/modules/__init__.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/modules/system/api/http.py +13 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/modules/system/data/system_repository.py +7 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/modules/system/domain/app_info.py +4 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/app/modules/system/services/system_service.py +9 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/main.py +4 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/tests/system/test_health.py +3 -0
- racerapi-0.0.3/src/racerapi_cli/templates/project/tests/test_e2e.py +0 -0
- racerapi-0.0.3/src/racerapi_cli/templates/resource/controllers.py +14 -0
- racerapi-0.0.3/src/racerapi_cli/templates/resource/routes.py +16 -0
- racerapi-0.0.3/src/racerapi_cli/templates/resource/schemas.py +13 -0
- racerapi-0.0.3/src/racerapi_cli/templates/resource/services.py +6 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Prathamesh More
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
1. The above copyright notice and this permission notice shall be included
|
|
13
|
+
in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
2. **This package is provided "as is", without warranty of any kind, express or
|
|
16
|
+
implied, including but not limited to the warranties of merchantability,
|
|
17
|
+
fitness for a particular purpose, and noninfringement. In no event shall the
|
|
18
|
+
authors or copyright holders be liable for any claim, damages, or other
|
|
19
|
+
liability, whether in an action of contract, tort, or otherwise, arising
|
|
20
|
+
from, out of, or in connection with the Software or the use or other dealings
|
|
21
|
+
in the Software.**
|
|
22
|
+
|
|
23
|
+
3. **This software is open-source and developed in India by Prathamesh More. It is highly useful for building stable backend systems with FastAPI, but please use at your own discretion.**
|
|
24
|
+
|
|
25
|
+
4. **If you use this package, please mention it in your project or application as a courtesy to acknowledge the contribution.**
|
racerapi-0.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: racerapi
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: RacerAPI - Opinionated Backend Framework on Top of FastAPI
|
|
5
|
+
Home-page: https://github.com/23bg/racerapi
|
|
6
|
+
Author: Prathamesh More
|
|
7
|
+
Author-email: "Mr. Prathamesh More" <iamprathamshmore07@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Framework :: FastAPI
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE.md
|
|
20
|
+
Requires-Dist: fastapi>=0.115
|
|
21
|
+
Requires-Dist: uvicorn[standard]>=0.30
|
|
22
|
+
Requires-Dist: typer[all]>=0.9
|
|
23
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.9.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pre-commit>=3.7.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# ⚡ RacerAPI
|
|
34
|
+
|
|
35
|
+
A modern, opinionated, and production-ready **Python-based backend framework** built on top of [FastAPI](https://fastapi.tiangolo.com/). RacerAPI provides a clean architecture, essential folder structure, and a CLI tool to bootstrap and scale backend services with ease.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🚀 Why RacerAPI?
|
|
40
|
+
|
|
41
|
+
RacerAPI is created for developers and teams who need:
|
|
42
|
+
|
|
43
|
+
- ✅ **Stability** – Built on proven Python standards and FastAPI.
|
|
44
|
+
- ✅ **Maintainability** – Enforced structure keeps large codebases organized.
|
|
45
|
+
- ✅ **CLI Productivity** – Scaffold projects quickly with the built-in CLI.
|
|
46
|
+
- ✅ **Scalability** – Easily extend to microservices and modular architecture.
|
|
47
|
+
- ✅ **Speed** – FastAPI is one of the fastest Python web frameworks.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🧰 Features
|
|
52
|
+
|
|
53
|
+
- 📁 Predefined scalable project folder structure
|
|
54
|
+
- ⚙️ Built-in CLI for generating projects
|
|
55
|
+
- 🧪 Testing support with `pytest`
|
|
56
|
+
- 🪶 Lightweight and flexible by default
|
|
57
|
+
- 🔐 Ready for integrations (JWT, OAuth, DB, etc.)
|
|
58
|
+
- 📦 Easily extendable with plugins and code generators
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 📦 Install (Local Development)
|
|
63
|
+
|
|
64
|
+
Clone the repo and install in editable mode:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/23bg/RacerAPI.git
|
|
68
|
+
cd RacerAPI
|
|
69
|
+
pip install -e .
|
racerapi-0.0.3/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ⚡ RacerAPI
|
|
2
|
+
|
|
3
|
+
A modern, opinionated, and production-ready **Python-based backend framework** built on top of [FastAPI](https://fastapi.tiangolo.com/). RacerAPI provides a clean architecture, essential folder structure, and a CLI tool to bootstrap and scale backend services with ease.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Why RacerAPI?
|
|
8
|
+
|
|
9
|
+
RacerAPI is created for developers and teams who need:
|
|
10
|
+
|
|
11
|
+
- ✅ **Stability** – Built on proven Python standards and FastAPI.
|
|
12
|
+
- ✅ **Maintainability** – Enforced structure keeps large codebases organized.
|
|
13
|
+
- ✅ **CLI Productivity** – Scaffold projects quickly with the built-in CLI.
|
|
14
|
+
- ✅ **Scalability** – Easily extend to microservices and modular architecture.
|
|
15
|
+
- ✅ **Speed** – FastAPI is one of the fastest Python web frameworks.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🧰 Features
|
|
20
|
+
|
|
21
|
+
- 📁 Predefined scalable project folder structure
|
|
22
|
+
- ⚙️ Built-in CLI for generating projects
|
|
23
|
+
- 🧪 Testing support with `pytest`
|
|
24
|
+
- 🪶 Lightweight and flexible by default
|
|
25
|
+
- 🔐 Ready for integrations (JWT, OAuth, DB, etc.)
|
|
26
|
+
- 📦 Easily extendable with plugins and code generators
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📦 Install (Local Development)
|
|
31
|
+
|
|
32
|
+
Clone the repo and install in editable mode:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/23bg/RacerAPI.git
|
|
36
|
+
cd RacerAPI
|
|
37
|
+
pip install -e .
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "racerapi"
|
|
7
|
+
version = "0.0.3"
|
|
8
|
+
description = "RacerAPI - Opinionated Backend Framework on Top of FastAPI"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Mr. Prathamesh More", email = "iamprathamshmore07@gmail.com" },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Framework :: FastAPI",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
# ====== RUNTIME DEPENDENCIES ======
|
|
29
|
+
dependencies = [
|
|
30
|
+
"fastapi>=0.115",
|
|
31
|
+
"uvicorn[standard]>=0.30",
|
|
32
|
+
"typer[all]>=0.9",
|
|
33
|
+
"python-dotenv>=1.0.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
# ====== OPTIONAL DEV DEPENDENCIES ======
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=8.0",
|
|
40
|
+
"pytest-cov>=4.0",
|
|
41
|
+
"black>=24.0",
|
|
42
|
+
"ruff>=0.4.0",
|
|
43
|
+
"mypy>=1.9.0",
|
|
44
|
+
"pre-commit>=3.7.0",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
# ====== CLI ENTRYPOINT ======
|
|
48
|
+
[project.scripts]
|
|
49
|
+
RacerAPI = "racerapi_cli.__main__:main"
|
|
50
|
+
|
|
51
|
+
# ====== PACKAGE DISCOVERY ======
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
# ====== INCLUDE TEMPLATE FILES IN WHEELS ======
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
RacerAPI_cli = ["templates/**/*"]
|
|
58
|
+
|
|
59
|
+
# ====== FORMATTERS AND LINTING (OPTIONAL BUT RECOMMENDED) ======
|
|
60
|
+
[tool.black]
|
|
61
|
+
line-length = 88
|
|
62
|
+
target-version = ["py38"]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 88
|
|
66
|
+
select = ["E", "F", "I"]
|
|
67
|
+
ignore = ["E501"]
|
|
68
|
+
|
|
69
|
+
[tool.mypy]
|
|
70
|
+
python_version = "3.8"
|
|
71
|
+
ignore_missing_imports = true
|
|
72
|
+
strict = false
|
racerapi-0.0.3/setup.cfg
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = RacerAPI
|
|
3
|
+
version = 0.0.3
|
|
4
|
+
description = A Python-based backend framework built on FastAPI.
|
|
5
|
+
long_description = file: README.md
|
|
6
|
+
long_description_content_type = text/markdown
|
|
7
|
+
author = Prathamesh More
|
|
8
|
+
author_email = iamprathameshmore07@gmail.com
|
|
9
|
+
url = https://github.com/23bg/racerapi
|
|
10
|
+
license = MIT
|
|
11
|
+
classifiers =
|
|
12
|
+
Programming Language :: Python :: 3
|
|
13
|
+
Programming Language :: Python :: 3.8
|
|
14
|
+
License :: OSI Approved :: MIT License
|
|
15
|
+
Operating System :: OS Independent
|
|
16
|
+
Intended Audience :: Developers
|
|
17
|
+
Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Framework :: FastAPI
|
|
19
|
+
|
|
20
|
+
[options]
|
|
21
|
+
packages = find:
|
|
22
|
+
python_requires = >=3.8
|
|
23
|
+
install_requires =
|
|
24
|
+
typer[all]
|
|
25
|
+
fastapi
|
|
26
|
+
pytest
|
|
27
|
+
|
|
28
|
+
[options.entry_points]
|
|
29
|
+
console_scripts =
|
|
30
|
+
myfastapi = racerapi.cli:app
|
|
31
|
+
|
|
32
|
+
[egg_info]
|
|
33
|
+
tag_build =
|
|
34
|
+
tag_date = 0
|
|
35
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.3"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: racerapi
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: RacerAPI - Opinionated Backend Framework on Top of FastAPI
|
|
5
|
+
Home-page: https://github.com/23bg/racerapi
|
|
6
|
+
Author: Prathamesh More
|
|
7
|
+
Author-email: "Mr. Prathamesh More" <iamprathamshmore07@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Framework :: FastAPI
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE.md
|
|
20
|
+
Requires-Dist: fastapi>=0.115
|
|
21
|
+
Requires-Dist: uvicorn[standard]>=0.30
|
|
22
|
+
Requires-Dist: typer[all]>=0.9
|
|
23
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.9.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pre-commit>=3.7.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# ⚡ RacerAPI
|
|
34
|
+
|
|
35
|
+
A modern, opinionated, and production-ready **Python-based backend framework** built on top of [FastAPI](https://fastapi.tiangolo.com/). RacerAPI provides a clean architecture, essential folder structure, and a CLI tool to bootstrap and scale backend services with ease.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🚀 Why RacerAPI?
|
|
40
|
+
|
|
41
|
+
RacerAPI is created for developers and teams who need:
|
|
42
|
+
|
|
43
|
+
- ✅ **Stability** – Built on proven Python standards and FastAPI.
|
|
44
|
+
- ✅ **Maintainability** – Enforced structure keeps large codebases organized.
|
|
45
|
+
- ✅ **CLI Productivity** – Scaffold projects quickly with the built-in CLI.
|
|
46
|
+
- ✅ **Scalability** – Easily extend to microservices and modular architecture.
|
|
47
|
+
- ✅ **Speed** – FastAPI is one of the fastest Python web frameworks.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🧰 Features
|
|
52
|
+
|
|
53
|
+
- 📁 Predefined scalable project folder structure
|
|
54
|
+
- ⚙️ Built-in CLI for generating projects
|
|
55
|
+
- 🧪 Testing support with `pytest`
|
|
56
|
+
- 🪶 Lightweight and flexible by default
|
|
57
|
+
- 🔐 Ready for integrations (JWT, OAuth, DB, etc.)
|
|
58
|
+
- 📦 Easily extendable with plugins and code generators
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 📦 Install (Local Development)
|
|
63
|
+
|
|
64
|
+
Clone the repo and install in editable mode:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/23bg/RacerAPI.git
|
|
68
|
+
cd RacerAPI
|
|
69
|
+
pip install -e .
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
LICENSE.md
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.cfg
|
|
6
|
+
src/racerapi/__init__.py
|
|
7
|
+
src/racerapi/version.py
|
|
8
|
+
src/racerapi.egg-info/PKG-INFO
|
|
9
|
+
src/racerapi.egg-info/SOURCES.txt
|
|
10
|
+
src/racerapi.egg-info/dependency_links.txt
|
|
11
|
+
src/racerapi.egg-info/entry_points.txt
|
|
12
|
+
src/racerapi.egg-info/requires.txt
|
|
13
|
+
src/racerapi.egg-info/top_level.txt
|
|
14
|
+
src/racerapi_cli/__init__.py
|
|
15
|
+
src/racerapi_cli/__main__.py
|
|
16
|
+
src/racerapi_cli/templates/project/main.py
|
|
17
|
+
src/racerapi_cli/templates/project/app/__init__.py
|
|
18
|
+
src/racerapi_cli/templates/project/app/common/exceptions.py
|
|
19
|
+
src/racerapi_cli/templates/project/app/common/response.py
|
|
20
|
+
src/racerapi_cli/templates/project/app/core/app_factory.py
|
|
21
|
+
src/racerapi_cli/templates/project/app/core/config.py
|
|
22
|
+
src/racerapi_cli/templates/project/app/core/logging.py
|
|
23
|
+
src/racerapi_cli/templates/project/app/modules/__init__.py
|
|
24
|
+
src/racerapi_cli/templates/project/app/modules/system/api/http.py
|
|
25
|
+
src/racerapi_cli/templates/project/app/modules/system/data/system_repository.py
|
|
26
|
+
src/racerapi_cli/templates/project/app/modules/system/domain/app_info.py
|
|
27
|
+
src/racerapi_cli/templates/project/app/modules/system/services/system_service.py
|
|
28
|
+
src/racerapi_cli/templates/project/tests/test_e2e.py
|
|
29
|
+
src/racerapi_cli/templates/project/tests/system/test_health.py
|
|
30
|
+
src/racerapi_cli/templates/resource/controllers.py
|
|
31
|
+
src/racerapi_cli/templates/resource/routes.py
|
|
32
|
+
src/racerapi_cli/templates/resource/schemas.py
|
|
33
|
+
src/racerapi_cli/templates/resource/services.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.3"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import subprocess
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(help="RacerAPI CLI - FastAPI project generator")
|
|
6
|
+
|
|
7
|
+
BASE_DIR = Path(__file__).parent
|
|
8
|
+
TEMPLATES_DIR = BASE_DIR / "templates"
|
|
9
|
+
PROJECT_TEMPLATE_DIR = TEMPLATES_DIR / "project"
|
|
10
|
+
RESOURCE_TEMPLATE_DIR = TEMPLATES_DIR / "resource"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def copy_tree(src: Path, dest: Path, context: dict):
|
|
14
|
+
for path in src.rglob("*"):
|
|
15
|
+
rel = path.relative_to(src)
|
|
16
|
+
target = dest / rel
|
|
17
|
+
|
|
18
|
+
if path.is_dir():
|
|
19
|
+
target.mkdir(parents=True, exist_ok=True)
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
content = path.read_text()
|
|
23
|
+
for key, value in context.items():
|
|
24
|
+
content = content.replace(f"{{{{ {key} }}}}", value)
|
|
25
|
+
|
|
26
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
target.write_text(content)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@app.command()
|
|
31
|
+
def new(name: str):
|
|
32
|
+
project_root = Path(name)
|
|
33
|
+
|
|
34
|
+
if project_root.exists():
|
|
35
|
+
typer.echo(f"Directory '{name}' already exists.")
|
|
36
|
+
raise typer.Exit(1)
|
|
37
|
+
|
|
38
|
+
if not PROJECT_TEMPLATE_DIR.exists():
|
|
39
|
+
typer.echo(
|
|
40
|
+
f"[ERROR] Project template directory not found: {PROJECT_TEMPLATE_DIR}"
|
|
41
|
+
)
|
|
42
|
+
raise typer.Exit(1)
|
|
43
|
+
|
|
44
|
+
typer.echo(f"Creating RacerAPI project in '{name}'...")
|
|
45
|
+
copy_tree(
|
|
46
|
+
PROJECT_TEMPLATE_DIR,
|
|
47
|
+
project_root,
|
|
48
|
+
{
|
|
49
|
+
"project_name": name,
|
|
50
|
+
"project_slug": name.replace("-", "_"),
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
typer.echo("✅ RacerAPI project created")
|
|
54
|
+
typer.echo(f"👉 cd {name}")
|
|
55
|
+
typer.echo("👉 RacerAPI dev")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@app.command()
|
|
59
|
+
def generate(kind: str, name: str):
|
|
60
|
+
kind = kind.lower()
|
|
61
|
+
name = name.lower()
|
|
62
|
+
|
|
63
|
+
if kind != "resource":
|
|
64
|
+
typer.echo("Only 'resource' generator is supported for now.")
|
|
65
|
+
raise typer.Exit(1)
|
|
66
|
+
|
|
67
|
+
if not RESOURCE_TEMPLATE_DIR.exists():
|
|
68
|
+
typer.echo(
|
|
69
|
+
f"[ERROR] Resource template directory not found: {RESOURCE_TEMPLATE_DIR}"
|
|
70
|
+
)
|
|
71
|
+
raise typer.Exit(1)
|
|
72
|
+
|
|
73
|
+
module_path = Path("app/modules") / name
|
|
74
|
+
|
|
75
|
+
if module_path.exists():
|
|
76
|
+
typer.echo(f"Module '{name}' already exists.")
|
|
77
|
+
raise typer.Exit(1)
|
|
78
|
+
|
|
79
|
+
typer.echo(f"Generating resource '{name}'...")
|
|
80
|
+
copy_tree(
|
|
81
|
+
RESOURCE_TEMPLATE_DIR,
|
|
82
|
+
module_path,
|
|
83
|
+
{
|
|
84
|
+
"resource_name": name,
|
|
85
|
+
"class_name": name.capitalize(),
|
|
86
|
+
},
|
|
87
|
+
)
|
|
88
|
+
typer.echo("✅ Resource generated")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@app.command()
|
|
92
|
+
def dev():
|
|
93
|
+
subprocess.run(["uvicorn", "main:app", "--reload"])
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def main():
|
|
97
|
+
app()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from dotenv import load_dotenv
|
|
3
|
+
|
|
4
|
+
load_dotenv()
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Settings:
|
|
8
|
+
APP_NAME: str = os.getenv("APP_NAME", "RacerAPI")
|
|
9
|
+
APP_ENV: str = os.getenv("APP_ENV", "development")
|
|
10
|
+
APP_DEBUG: bool = os.getenv("APP_DEBUG", "true") == "true"
|
|
11
|
+
|
|
12
|
+
DATABASE_URL: str = os.getenv("DATABASE_URL", "sqlite:///./dev.db")
|
|
13
|
+
SECRET_KEY: str = os.getenv("SECRET_KEY", "secret")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
settings = Settings()
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from fastapi import APIRouter
|
|
2
|
+
from app.modules.system.services.system_service import SystemService
|
|
3
|
+
|
|
4
|
+
router = APIRouter(tags=["System"])
|
|
5
|
+
service = SystemService()
|
|
6
|
+
|
|
7
|
+
@router.get("/health")
|
|
8
|
+
def health():
|
|
9
|
+
return service.health()
|
|
10
|
+
|
|
11
|
+
@router.get("/version")
|
|
12
|
+
def version():
|
|
13
|
+
return service.version()
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
from .services import {{ class_name }}Service
|
|
3
|
+
from .schemas import {{ class_name }}Create, {{ class_name }}Out
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class {{ class_name }}Controller:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.service = {{ class_name }}Service()
|
|
9
|
+
|
|
10
|
+
async def list(self) -> list[{{ class_name }}Out]:
|
|
11
|
+
return await self.service.list()
|
|
12
|
+
|
|
13
|
+
async def create(self, payload: {{ class_name }}Create):
|
|
14
|
+
return await self.service.create(payload)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from fastapi import APIRouter
|
|
2
|
+
from .controllers import {{ class_name }}Controller
|
|
3
|
+
|
|
4
|
+
router = APIRouter(prefix="/{{ resource_name }}", tags=["{{ class_name }}"])
|
|
5
|
+
|
|
6
|
+
controller = {{ class_name }}Controller()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@router.get("/")
|
|
10
|
+
async def list_items():
|
|
11
|
+
return await controller.list()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@router.post("/")
|
|
15
|
+
async def create_item(payload: dict):
|
|
16
|
+
return await controller.create(payload)
|