Giter Site home page Giter Site logo

ycd / manage-fastapi Goto Github PK

View Code? Open in Web Editor NEW
1.6K 20.0 107.0 4.56 MB

:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.

Home Page: https://github.com/ycd/manage-fastapi

License: MIT License

Python 94.56% Shell 0.41% Dockerfile 5.03%
fastapi boilerplate cli project-generator mongodb postgresql sqlite mysql tortoise-orm databases

manage-fastapi's People

Contributors

aliereno avatar dependabot[bot] avatar jsenecal avatar kludex avatar nijat avatar ycd avatar zdrawia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manage-fastapi's Issues

[Help] I would like to ask for terminal and terminalizer settings

Hi dear all,
I would like to use your README style in one of the projects.
The needed thing for me is the terminal template name(I guess it is oh-my-bash but which template/font?)
Also if it is possible to share the terminalizer configs - for creating the gif file. I am struggling with getting proper resolution and style.
Thanks :)

Error during startproject [ ModuleNotFoundError: No module named 'termios' ]

Hi all.

So I'm trying to generate a project by using
fastapi startproject core --interactive

But this error below pops out of my terminal
Traceback (most recent call last):
File "c:\users\x\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\x\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\x\Documents\Development\Playground\test-fastapi\env\Scripts\fastapi.exe\__main__.py", line 4, in <module>
File "c:\users\x\documents\development\playground\test-fastapi\env\lib\site-packages\manage_fastapi\main.py", line 11, in <module>
from manage_fastapi.helpers import bullet, launch_cli, yes_no
File "c:\users\x\documents\development\playground\test-fastapi\env\lib\site-packages\manage_fastapi\helpers.py", line 4, in <module>
from bullet import Bullet, SlidePrompt, colors
File "c:\users\x\documents\development\playground\test-fastapi\env\lib\site-packages\bullet\__init__.py", line 1, in <module>
from .client import Bullet
File "c:\users\x\documents\development\playground\test-fastapi\env\lib\site-packages\bullet\client.py", line 4, in <module>
from . import utils
File "c:\users\x\documents\development\playground\test-fastapi\env\lib\site-packages\bullet\utils.py", line 3, in <module>
import tty, termios
File "c:\users\x\appdata\local\programs\python\python39\lib\tty.py", line 5, in <module>
from termios import *
ModuleNotFoundError: No module named 'termios'

And I'm running this on Windows 10 machine. I've read somewhere that termios is only unix and not windows. Is this true?

Debug

How to do debug in the Pycharm?

fastapi.run should be able to take arguments from cli

right now i should add some parameters directly in code:

@app.command(help="Run a FastAPI application.")
def run(prod: bool = typer.Option(False)):
    ....
    if not prod:
        # args.append("--reload")
        args.append("--log-level debug")
        args.append("--host 0.0.0.0")
        args.append("--port 8000")
        args.append("--access-log") 
    ....

But it is really standard and user-friendly to do, for example:

fastapi run --host 0.0.0.0 --port 7070

Error when startproject: value is not a valid email address (type=value_error.email)

version==1.1.1
(caas_app) C:\E\proj>fastapi startproject test_fastapi
Traceback (most recent call last):
File "C:\D\miniconda3\envs\caas_app\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\D\miniconda3\envs\caas_app\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\D\miniconda3\envs\caas_app\Scripts\fastapi.exe_main
.py", line 7, in
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\typer\main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\typer\main.py", line 532, in wrapper
return callback(**use_params) # type: ignore
File "C:\D\miniconda3\envs\caas_app\lib\site-packages\manage_fastapi\main.py", line 43, in startproject
context = ProjectContext(
File "pydantic\main.py", line 342, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for ProjectContext
email
value is not a valid email address (type=value_error.email)

Debug

How to start debug in Pycharm?

ModuleNotFoundError: No module named 'app'

Steps performed:

  1. fastapi startproject [project_name]
  2. cd [project_name]
  3. fastapi startapp [app_name]
  4. fastapi run (from the project folder)

It is throwing an error ModuleNotFoundError: No module named 'app'

Screenshot 2023-04-06 at 9 11 58 AM

Can someone please help me in getting the server up and running

Remove support of python 3.6

As long as the FastAPI version has been bumped to 0.85.0 and it also drops the support to the python version 3.6 as mentionned here : https://fastapi.tiangolo.com/release-notes/ , shouldn't we drop the support within the package (This will make it also possible to make some updates on the packages such as Black, pydantic, ...

fastapi startproject not works if git is not installed.

new windows system. I want work local. i dont need git for my goals.

falls on context.py

# row 43
    def validate_project(cls, values: dict):
        try:
            values["username"] = subprocess.check_output(["git", "config", "--get", "user.name"])
            values["email"] = subprocess.check_output(["git", "config", "--get", "user.email"])
        except subprocess.CalledProcessError:  #(Exception file not found error and not only )
            ... 

my opinion it should be possible to takeinfo from cli:

fastapi startproject myproject --user username --email [email protected]

in this case it can be:

def validate_project(cls, values: dict):
    try:
        values["username"] = subprocess.check_output(["git", "config", "--get", "user.name"])
        values["email"] = subprocess.check_output(["git", "config", "--get", "user.email"])
    except Exception as error: (Exception file not found error and not only subprocess.CalledProcessError)
        values["email"] = get something from args in cli on start
        values["username"] = get something from args in cli on start
        ... 

ImportError: python-dotenv is not installed, run `pip install pydantic[dotenv]`

Hey.

I'm having an weird issue with manage-fastapi. I installed all the needed packages using poetry:

pyprocject.toml file

[tool.poetry]
name = "ossah"
version = "0.1.0"
description = ""

[tool.poetry.dependencies]
python = "^3.7"
fastapi = "^0.68.1"
pydantic = {extras = ["dotenv"], version = "^1.8.2"}

[tool.poetry.dev-dependencies]
pytest = "^5.2"
pytest-cov = "^2.10.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

After the command fastapi run I got this error message:

  module = importlib.import_module(module_str)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "./app/main.py", line 4, in <module>
    from app.core.config import settings
  File "./app/core/config.py", line 43, in <module>
    settings = Settings()
  File "pydantic/env_settings.py", line 37, in pydantic.env_settings.BaseSettings.__init__
  File "pydantic/env_settings.py", line 63, in pydantic.env_settings.BaseSettings._build_values
  File "pydantic/env_settings.py", line 154, in pydantic.env_settings.EnvSettingsSource.__call__
  File "pydantic/env_settings.py", line 227, in pydantic.env_settings.read_env_file
ImportError: python-dotenv is not installed, run `pip install pydantic[dotenv]`

Adding the option to choose an output directory

Now, when creating a project using the FastAPI project generation tool, there is no option to choose the target directory where the project will be created. By default, the tool uses the current working directory.

We propose adding the functionality that allows users to specify the desired directory in which the project should be created. This perfection will improve the tool's usability, especially when users want to generate the project in a specific folder or location.

The following changes are planned for implementation:

-Add an option that enables users to specify an output directory when using the project generation tool.
-When this option is used, the project will be created in the specified directory instead of the current working directory.
-Provide documentation about the new option in the tool's documentation.
This enhancement will make the process of creating FastAPI projects more flexible and user-friendly.

Manage FastAPI August-September 2020 Roadmap

🔨 Roadmap August-September 2020 🔨

Goals

  • Adding more templates for databases and object relatioınal mappers.
  • Instead of creating database with async sql, now the database will be up to user

Example:

manage-fastapi startproject myproject

The command we ran above will ask the user something like this to select a database.

Select a database:
[0] Postgresql, sqlite3, mysql
[1] Tortoise ORM
[2] Peewee
[3] MongoDB, Couchbase

Each selection will have unique database template.

New Features

runserver

Also thinking about showmodels to show all models also this command will came with option for request method like

showmodels --get
showmodels --post

Fastapi & Python 3.9

Hi!
Are there any discrepancies in the support for Python versions?

image

Interested in support v3.9
Do I understand correctly that the help text about Python versions is just incomplete?

image

Thankx

Examples section

Hello,

Could you link to a couple of projects built with this template?
I think it would help if beginners like me could see how all the parts of the project work together

Thanks!

Missing requirement: pydantic[dotenv]

I recently used the manage-fast API CLI tool to create a FastAPI project. However, when I tried to install the project's dependencies using the requirements.txt file, I noticed that the pydantic[dotenv] package was not included in the list of requirements. This resulted in an error when I tried to run the project.

Choice template

I want to use my own templates for project and application generation.

uvicorn port/host

I don't see an option to run uvicorn on a non-default port and host.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.