8000 ✨ Add FastAPI CLI, the new `fastapi` command by tiangolo · Pull Request #11522 · fastapi/fastapi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add FastAPI CLI, the new fastapi command #11522

Merged
merged 9 commits into from
May 2, 2024
Merged

✨ Add FastAPI CLI, the new fastapi command #11522

merged 9 commits into from
May 2, 2024

Conversation

tiangolo
Copy link
Member
@tiangolo tiangolo commented May 2, 2024

✨ Add FastAPI CLI, the new fastapi command

@tiangolo tiangolo added the feature New feature or request label May 2, 2024
@tiangolo
Copy link
Member Author
tiangolo commented May 2, 2024

📝 Docs preview for commit c98c151 at: https://a98e0cab.fastapitiangolo.pages.dev

@tiangolo tiangolo changed the title ✨ Add FastAPI CLI support, with the new fastapi command ✨ Add FastAPI CLI, the new fastapi command May 2, 2024
@tiangolo tiangolo merged commit d71be59 into master May 2, 2024
44 checks passed
@tiangolo tiangolo deleted the fastapi-cli branch May 2, 2024 22:37
@rafalkrupinski
Copy link

So now my servers will depend on some CLI packages? 🤔

@Olegt0rr
Copy link
Olegt0rr commented May 3, 2024

Thanks for this great feature.

It also would be nice to support module's __main__.py as well as main.py

@zoola969
Copy link
zoola969 commented May 3, 2024

Why do we need it for production? Could you make it optional dependency?

@JuanPerdomo00
Copy link
Contributor

Thanks for this functionality, it really is great. fastapi fan. @tiangolo 🏆

n8sty added a commit to n8sty/titiler that referenced this pull request May 6, 2024
vincentsarago pushed a commit to developmentseed/titiler that referenced this pull request May 7, 2024
@metakot
Copy link
metakot commented May 7, 2024

Really, why, of all the things...

@parfeniukink
Copy link

So now my servers will depend on some CLI packages? 🤔

I think you still available to run pip install fastapi --no-deps if this is an issue for you.
Probably, it depends on the package manager that you use, but anyway, I guess that piptools, poetry or pipenv allow you to achieve that, aren't they?

@rafalkrupinski
Copy link
rafalkrupinski commented May 21, 2024

@parfeniukink poetry doesn't, besides, I don't want to manage dependencies myself.

I'm migrating over to Litestar, it has more than one maintainer.

hsuanchi pushed a commit to hsuanchi/fastapi that referenced this pull request May 26, 2024
@parfeniukink
Copy link

@parfeniukink poetry doesn't, besides, I don't want to manage dependencies myself.

I'm migrating over to Litestar, it has more than one maintainer.

Good choice I guess :)
I've heart that it is quite stable.

@rafalkrupinski
Copy link

Good choice I guess :)
I've heart that it is quite stable.

We'll see ;)

@limosin
Copy link
limosin commented Jul 6, 2024

@tiangolo I understand fastapi cli is running uvicorn under the hood.
How can I modify the uvicorn configurations like --loop type and --http?

@Jaza
Copy link
Jaza commented Jul 7, 2024

@tiangolo a few comments:

  • I'm a FastAPI fan, I've been using it for the main codebases that I work on at my full-time job for about 2 years, no plans for that to change anytime soon
  • I know there has been criticism of the way the FastAPI project is run, but personally I don't have a problem as such with your ongoing BDFL role, it's your baby, you can keep holding all the keys to the castle if you want, the quality of FastAPI has in my opinion benefitted greatly from your oversight
  • You can of course give priority to whatever you want, you can build whatever features you want, that's what open source is all about, if you have an itch to scratch then go for it

However:

  • FastAPI is now quite a mature project with hundreds of contributors
  • This is a fairly significant new feature
  • You merged this PR less than an hour after you opened it
  • Nobody had time to review it or to give any feedback whatsoever
  • AFAICT there was no issue thread to discuss this, nor was there prior discussion anywhere else
  • No mention of a CLI in the roadmap, or anywhere else that I'm aware of, AFAICT nobody had any heads-up about this
  • Many of the comments, since this PR was merged, have been critical - some are critical of the feature itself, others are critical of the rationale and the process (or lack thereof) behind it

Personally I think it's a decent feature (and, on par with FastAPI's high standards, it appears to be thoroughly tested and clearly documented). It will probably help out FastAPI newcomers the most, with a friendlier getting-started experience. I don't need it urgently, not sure if I'll use it, I might give it a try. Anyway, what the feature is that you built, isn't the point here.

In future, could you at least leave a PR (for a non-critical new feature) open for a reasonable time, before merging it? I would suggest one week, to give people some time to review and comment.

And ideally, could you advise the community in advance, in a separate issue thread, and/or in the roadmap, of features that you plan to work on?

I'm not suggesting a radical overhaul of how the project is managed. I just think that a little bit more transparency, and a little bit more engagement, are not unreasonable expectations of the community, for a project that thousands of people now rely on. And I don't want to see people abandon FastAPI on account of these concerns (as some of the comments in this PR have suggested, and as I've seen suggested in a number of discussions elsewhere), I think it's a great project, and I'm saying all this in the hope that it helps rather than harms the project's future.

@tiangolo
Copy link
Member Author
tiangolo commented Aug 2, 2024

Thanks for the feedback @Jaza and everyone!

As having fastapi include by default the standard dependencies has been inconvenient to several people, I decided to make those standard dependencies an optional extra group standard.

So, to get the standard optional dependencies people now have to install it with:

pip install "fastapi[standard]"

Note: remember to use the quotes, depending on your terminal that might be required.

Having the optional extra, square brackets, quotes, is not as nice as just fastapi, it's extra things to have in mind, and extra things for newcomers to learn from the beginning. But anyway, it seems that having the default standard dependencies installed by default, and having to change the installed package to be fastapi-slim when people didn't want those standard dependencies instead was being too inconvenient for some people so I decided to switch back to have fastapi as the minimal/slim version and the standard extra dependencies in the group standard.

This is available in FastAPI version 0.112.0. 🎉

smoke added a commit to smoke/opentelemetry-python-contrib that referenced this pull request Aug 7, 2024
smoke added a commit to smoke/opentelemetry-python-contrib that referenced this pull request Aug 7, 2024
smoke added a commit to smoke/opentelemetry-python-contrib that referenced this pull request Aug 7, 2024
smoke added a commit to smoke/opentelemetry-python-contrib that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants
0