Skip to content

Commit 3858ad1

Browse files
committed
Merge branch 'release/4.0.0'
2 parents 5d8d38e + 419d6f7 commit 3858ad1

14 files changed

Lines changed: 1019 additions & 522 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Testing fastapi-template
22

33
on:
44
pull_request:
5-
branches:
6-
- 'release/**'
75

86
jobs:
97
pre_job:

README.md

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Poetry version must be greater or equal than 1.1.8. Otherwise it won't be able to install SQLAlchemy.
1313

1414
<div align="center">
15-
<img src="https://user-images.githubusercontent.com/18153319/137182689-ce714440-7576-46a0-8f96-862a8469a28c.gif"/>
15+
<a href="https://asciinema.org/a/ig0oi0fOq1hxqnW5X49XaaHIT" target="_blank"><img src="https://asciinema.org/a/ig0oi0fOq1hxqnW5X49XaaHIT.svg" /></a>
1616
<p>Templator in action</p>
1717
</div>
1818

@@ -73,43 +73,31 @@ This project can handle arguments passed through command line.
7373
```shell
7474
$ python -m fastapi_template --help
7575

76-
usage: FastAPI template [-h] [--version] [--name PROJECT_NAME]
77-
[--description PROJECT_DESCRIPTION]
78-
[--api-type {rest,graphql}]
79-
[--db {none,sqlite,mysql,postgresql}]
80-
[--orm {ormar,sqlalchemy,tortoise,psycopg,piccolo}]
81-
[--ci {none,gitlab_ci,github}] [--redis] [--rabbit]
82-
[--migrations] [--kube] [--dummy] [--routers]
83-
[--swagger] [--prometheus] [--sentry] [--loguru]
84-
[--opentelemetry] [--traefik] [--force] [--quite]
85-
86-
optional arguments:
87-
-h, --help show this help message and exit
88-
--version, -V Prints current version
89-
--name PROJECT_NAME Name of your awesome project
90-
--description PROJECT_DESCRIPTION
91-
Project description
92-
--api-type {rest,graphql}
93-
API type
94-
--db {none,sqlite,mysql,postgresql}
95-
Database
96-
--orm {ormar,sqlalchemy,tortoise,psycopg,piccolo}
97-
ORM
98-
--ci {none,gitlab_ci,github}
99-
Choose CI support
100-
--redis Add Redis support
101-
--rabbit Add RabbitMQ support
102-
--migrations Add migrations support
103-
--kube Add Kubernetes configs
104-
--dummy, --dummy-model
105-
Add dummy model
106-
--routers Add example routers
107-
--swagger Enable self-hosted Swagger
108-
--prometheus Add prometheus integration
109-
--sentry Add sentry integration
110-
--loguru Add loguru logger
111-
--opentelemetry Add opentelemetry integration
112-
--traefik Adds traefik labels to docker container
113-
--force Owerrite directory if it exists
114-
--quite Do not ask for features during generation
76+
Usage: fastapi_template [OPTIONS]
77+
78+
Options:
79+
-n, --name TEXT Name of your awesome project
80+
-V, --version Prints current version
81+
--force Owerrite directory if it exists
82+
--quite Do not ask for features during generation
83+
--api-type [rest|graphql] Select API type for your application
84+
--db [none|sqlite|mysql|postgresql]
85+
Select a database for your app
86+
--orm [none|ormar|sqlalchemy|tortoise|psycopg|piccolo]
87+
Choose Object–Relational Mapper lib
88+
--ci [none|gitlab_ci|github] Select a CI for your app
89+
--redis Add redis support
90+
--rabbit Add RabbitMQ support
91+
--migrations Add Migrations
92+
--kube Add kubernetes configs
93+
--dummy Add dummy model
94+
--routers Add example routers
95+
--swagger Add self hosted swagger
96+
--prometheus Add prometheus compatible metrics
97+
--sentry Add sentry integration
98+
--loguru Add loguru logger
99+
--opentelemetry Add opentelemetry integration
100+
--traefik Adds traefik labels to docker container
101+
--kafka Add Kafka support
102+
--help Show this message and exit.
115103
```

fastapi_template/__main__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from cookiecutter.main import cookiecutter
66
from termcolor import cprint
77

8-
from fastapi_template.cli import get_context
8+
from fastapi_template.cli import run_command
99
from fastapi_template.input_model import BuilderContext
1010

1111
script_dir = Path(__file__).parent
@@ -20,7 +20,7 @@ def generate_project(context: BuilderContext) -> None:
2020
try:
2121
cookiecutter(
2222
template=f"{script_dir}/template",
23-
extra_context=json.loads(context.json()),
23+
extra_context=context.dict(),
2424
default_config=BuilderContext().dict(),
2525
no_input=True,
2626
overwrite_if_exists=context.force,
@@ -36,12 +36,7 @@ def generate_project(context: BuilderContext) -> None:
3636

3737
def main() -> None:
3838
"""Starting point."""
39-
try:
40-
context = get_context()
41-
except KeyboardInterrupt:
42-
print("Goodbye!")
43-
return
44-
generate_project(context)
39+
run_command(generate_project)
4540

4641

4742
if __name__ == "__main__":

0 commit comments

Comments
 (0)