You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

138 lines
6.2 KiB

  1. Metadata-Version: 2.1
  2. Name: fastapi-cli
  3. Version: 0.0.8
  4. Summary: Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
  5. Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
  6. License: MIT
  7. Classifier: Intended Audience :: Information Technology
  8. Classifier: Intended Audience :: System Administrators
  9. Classifier: Operating System :: OS Independent
  10. Classifier: Programming Language :: Python :: 3
  11. Classifier: Programming Language :: Python
  12. Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
  13. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  14. Classifier: Topic :: Software Development :: Libraries
  15. Classifier: Topic :: Software Development
  16. Classifier: Typing :: Typed
  17. Classifier: Development Status :: 4 - Beta
  18. Classifier: Framework :: FastAPI
  19. Classifier: Intended Audience :: Developers
  20. Classifier: License :: OSI Approved :: MIT License
  21. Classifier: Programming Language :: Python :: 3 :: Only
  22. Classifier: Programming Language :: Python :: 3.8
  23. Classifier: Programming Language :: Python :: 3.9
  24. Classifier: Programming Language :: Python :: 3.10
  25. Classifier: Programming Language :: Python :: 3.11
  26. Classifier: Programming Language :: Python :: 3.12
  27. Classifier: License :: OSI Approved :: MIT License
  28. Project-URL: Homepage, https://github.com/fastapi/fastapi-cli
  29. Project-URL: Documentation, https://fastapi.tiangolo.com/fastapi-cli/
  30. Project-URL: Repository, https://github.com/fastapi/fastapi-cli
  31. Project-URL: Issues, https://github.com/fastapi/fastapi-cli/issues
  32. Project-URL: Changelog, https://github.com/fastapi/fastapi-cli/blob/main/release-notes.md
  33. Requires-Python: >=3.8
  34. Requires-Dist: typer>=0.15.1
  35. Requires-Dist: uvicorn[standard]>=0.15.0
  36. Requires-Dist: rich-toolkit>=0.14.8
  37. Provides-Extra: standard
  38. Requires-Dist: uvicorn[standard]>=0.15.0; extra == "standard"
  39. Requires-Dist: fastapi-cloud-cli>=0.1.1; extra == "standard"
  40. Provides-Extra: standard-no-fastapi-cloud-cli
  41. Requires-Dist: uvicorn[standard]>=0.15.0; extra == "standard-no-fastapi-cloud-cli"
  42. Description-Content-Type: text/markdown
  43. # FastAPI CLI
  44. <a href="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml" target="_blank">
  45. <img src="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg" alt="Test">
  46. </a>
  47. <a href="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml" target="_blank">
  48. <img src="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg" alt="Publish">
  49. </a>
  50. <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli" target="_blank">
  51. <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg" alt="Coverage">
  52. <a href="https://pypi.org/project/fastapi-cli" target="_blank">
  53. <img src="https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package" alt="Package version">
  54. </a>
  55. ---
  56. **Source Code**: <a href="https://github.com/fastapi/fastapi-cli" target="_blank">https://github.com/fastapi/fastapi-cli</a>
  57. ---
  58. Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
  59. ## Description
  60. **FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more.
  61. When you install FastAPI (e.g. with `pip install "fastapi[standard]"`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal.
  62. To run your FastAPI app for development, you can use the `fastapi dev` command:
  63. <div class="termy">
  64. ```console
  65. $ fastapi dev main.py
  66. FastAPI Starting development server 🚀
  67. Searching for package file structure from directories with __init__.py files
  68. Importing from /home/user/code/awesomeapp
  69. module 🐍 main.py
  70. code Importing the FastAPI app object from the module with the following code:
  71. from main import app
  72. app Using import string: main:app
  73. server Server started at http://127.0.0.1:8000
  74. server Documentation at http://127.0.0.1:8000/docs
  75. tip Running in development mode, for production use: fastapi run
  76. Logs:
  77. INFO Will watch for changes in these directories: ['/home/user/code/awesomeapp']
  78. INFO Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
  79. INFO Started reloader process [4106097] using WatchFiles
  80. INFO Started server process [4106120]
  81. INFO Waiting for application startup.
  82. INFO Application startup complete.
  83. ```
  84. </div>
  85. That command line program called `fastapi` is **FastAPI CLI**.
  86. FastAPI CLI takes the path to your Python program and automatically detects the variable with the FastAPI (commonly named `app`) and how to import it, and then serves it.
  87. For production you would use `fastapi run` instead. 🚀
  88. Internally, **FastAPI CLI** uses <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a>, a high-performance, production-ready, ASGI server. 😎
  89. ## `fastapi dev`
  90. When you run `fastapi dev`, it will run on development mode.
  91. By default, it will have **auto-reload** enabled, so it will automatically reload the server when you make changes to your code. This is resource intensive and could be less stable than without it, you should only use it for development.
  92. By default it will listen on the IP address `127.0.0.1`, which is the IP for your machine to communicate with itself alone (`localhost`).
  93. ## `fastapi run`
  94. When you run `fastapi run`, it will run on production mode by default.
  95. It will have **auto-reload disabled** by default.
  96. It will listen on the IP address `0.0.0.0`, which means all the available IP addresses, this way it will be publicly accessible to anyone that can communicate with the machine. This is how you would normally run it in production, for example, in a container.
  97. In most cases you would (and should) have a "termination proxy" handling HTTPS for you on top, this will depend on how you deploy your application, your provider might do this for you, or you might need to set it up yourself. You can learn more about it in the <a href="https://fastapi.tiangolo.com/deployment/" class="external-link" target="_blank">FastAPI Deployment documentation</a>.
  98. ## License
  99. This project is licensed under the terms of the MIT license.