]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬇️ Separate requirements for development into their own requirements.txt files, they...
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 11 Jun 2023 21:38:15 +0000 (23:38 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Jun 2023 21:38:15 +0000 (23:38 +0200)
14 files changed:
.github/workflows/build-docs.yml
.github/workflows/test.yml
docs/em/docs/contributing.md
docs/en/docs/contributing.md
docs/ja/docs/contributing.md
docs/pt/docs/contributing.md
docs/ru/docs/contributing.md
docs/zh/docs/contributing.md
pyproject.toml
requirements-docs.txt [new file with mode: 0644]
requirements-tests.txt [new file with mode: 0644]
requirements.txt [new file with mode: 0644]
scripts/build-docs.sh
scripts/test.sh

index 95cb8578ba03a8e4b3f398ab96ece8cd6f91f645..41eb55b859f3409da83e23784c8ebe91b8d551ff 100644 (file)
@@ -25,7 +25,7 @@ jobs:
           key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
       - name: Install docs extras
         if: steps.cache.outputs.cache-hit != 'true'
-        run: pip install .[doc]
+        run: pip install -r requirements-docs.txt
       - name: Install Material for MkDocs Insiders
         if: ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
         run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
index 65b29be204d734c362eef8f281df7aa913c1bbf5..e3abe4b2158fac735de22415082dd017e1905f7e 100644 (file)
@@ -31,7 +31,7 @@ jobs:
           key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
       - name: Install Dependencies
         if: steps.cache.outputs.cache-hit != 'true'
-        run: pip install -e .[all,dev,doc,test]
+        run: pip install -r requirements-tests.txt
       - name: Lint
         run: bash scripts/lint.sh
       - run: mkdir coverage
index 7749d27a17cc01efd4ce03024c4188704a07637f..748928f88fe38600feeb03918c6be153c0085a6e 100644 (file)
@@ -108,7 +108,7 @@ $ python -m pip install --upgrade pip
 <div class="termy">
 
 ```console
-$ pip install -e ."[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
index a1a32a1fe63fc2fcb88dd7945dc1c940bba507ee..660914a08864163eb59f796bd8496d3f7f2e8d77 100644 (file)
@@ -108,7 +108,7 @@ After activating the environment as described above:
 <div class="termy">
 
 ```console
-$ pip install -e ".[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
@@ -121,10 +121,15 @@ It will install all the dependencies and your local FastAPI in your local enviro
 
 If you create a Python file that imports and uses FastAPI, and run it with the Python from your local environment, it will use your local FastAPI source code.
 
-And if you update that local FastAPI source code, as it is installed with `-e`, when you run that Python file again, it will use the fresh version of FastAPI you just edited.
+And if you update that local FastAPI source code when you run that Python file again, it will use the fresh version of FastAPI you just edited.
 
 That way, you don't have to "install" your local version to be able to test every change.
 
+!!! note "Technical Details"
+    This only happens when you install using this included `requiements.txt` instead of installing `pip install fastapi` directly.
+
+    That is because inside of the `requirements.txt` file, the local version of FastAPI is marked to be installed in "editable" mode, with the `-e` option.
+
 ### Format
 
 There is a script that you can run that will format and clean all your code:
index 9affea443a27ce4b2d5b5f4695570898057c913d..31db51c52b0aecf41b4d1bea4625e4122dd63e0b 100644 (file)
@@ -97,7 +97,7 @@ $ python -m venv env
 <div class="termy">
 
 ```console
-$ pip install -e ."[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
index f95b6f4eccec8fc926d2cc6db153102b3e9bcd13..02895fcfc8b79bc4bb96cd5b48af9910ad5b3588 100644 (file)
@@ -98,7 +98,7 @@ Após ativar o ambiente como descrito acima:
 <div class="termy">
 
 ```console
-$ pip install -e ."[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
index f61ef1cb648a776c8326617e40e3ea7ae701b7b6..f9b8912e55361e03a3daaf4efe17d16c68a5c7b8 100644 (file)
@@ -108,7 +108,7 @@ $ python -m pip install --upgrade pip
 <div class="termy">
 
 ```console
-$ pip install -e ."[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
index 36c3631c44461a79f2ba03ca78fe9294ed340219..4ebd673150b253b80bb159b0429629489a9c8c4f 100644 (file)
@@ -97,7 +97,7 @@ $ python -m venv env
 <div class="termy">
 
 ```console
-$ pip install -e ."[dev,doc,test]"
+$ pip install -r requirements.txt
 
 ---> 100%
 ```
index 3bae6a3ef5f9bb321639b7f2ef072a3931913497..69c42b254be1882c8c2eed5964ff6ec009ecd96b 100644 (file)
@@ -51,47 +51,6 @@ Homepage = "https://github.com/tiangolo/fastapi"
 Documentation = "https://fastapi.tiangolo.com/"
 
 [project.optional-dependencies]
-test = [
-    "pytest >=7.1.3,<8.0.0",
-    "coverage[toml] >= 6.5.0,< 8.0",
-    "mypy ==0.982",
-    "ruff ==0.0.138",
-    "black == 23.1.0",
-    "isort >=5.0.6,<6.0.0",
-    "httpx >=0.23.0,<0.24.0",
-    "email_validator >=1.1.1,<2.0.0",
-    # TODO: once removing databases from tutorial, upgrade SQLAlchemy
-    # probably when including SQLModel
-    "sqlalchemy >=1.3.18,<1.4.43",
-    "peewee >=3.13.3,<4.0.0",
-    "databases[sqlite] >=0.3.2,<0.7.0",
-    "orjson >=3.2.1,<4.0.0",
-    "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0",
-    "python-multipart >=0.0.5,<0.0.7",
-    "flask >=1.1.2,<3.0.0",
-    "anyio[trio] >=3.2.1,<4.0.0",
-    "python-jose[cryptography] >=3.3.0,<4.0.0",
-    "pyyaml >=5.3.1,<7.0.0",
-    "passlib[bcrypt] >=1.7.2,<2.0.0",
-
-    # types
-    "types-ujson ==5.7.0.1",
-    "types-orjson ==3.6.2",
-]
-doc = [
-    "mkdocs >=1.1.2,<2.0.0",
-    "mkdocs-material >=8.1.4,<9.0.0",
-    "mdx-include >=1.4.1,<2.0.0",
-    "mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0",
-    "typer-cli >=0.0.13,<0.0.14",
-    "typer[all] >=0.6.1,<0.8.0",
-    "pyyaml >=5.3.1,<7.0.0",
-]
-dev = [
-    "ruff ==0.0.138",
-    "uvicorn[standard] >=0.12.0,<0.21.0",
-    "pre-commit >=2.17.0,<3.0.0",
-]
 all = [
     "httpx >=0.23.0",
     "jinja2 >=2.11.2",
diff --git a/requirements-docs.txt b/requirements-docs.txt
new file mode 100644 (file)
index 0000000..e9d0567
--- /dev/null
@@ -0,0 +1,8 @@
+-e .
+mkdocs >=1.1.2,<2.0.0
+mkdocs-material >=8.1.4,<9.0.0
+mdx-include >=1.4.1,<2.0.0
+mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0
+typer-cli >=0.0.13,<0.0.14
+typer[all] >=0.6.1,<0.8.0
+pyyaml >=5.3.1,<7.0.0
diff --git a/requirements-tests.txt b/requirements-tests.txt
new file mode 100644 (file)
index 0000000..52a44ce
--- /dev/null
@@ -0,0 +1,26 @@
+-e .
+pytest >=7.1.3,<8.0.0
+coverage[toml] >= 6.5.0,< 8.0
+mypy ==0.982
+ruff ==0.0.138
+black == 23.1.0
+isort >=5.0.6,<6.0.0
+httpx >=0.23.0,<0.24.0
+email_validator >=1.1.1,<2.0.0
+# TODO: once removing databases from tutorial, upgrade SQLAlchemy
+# probably when including SQLModel
+sqlalchemy >=1.3.18,<1.4.43
+peewee >=3.13.3,<4.0.0
+databases[sqlite] >=0.3.2,<0.7.0
+orjson >=3.2.1,<4.0.0
+ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0
+python-multipart >=0.0.5,<0.0.7
+flask >=1.1.2,<3.0.0
+anyio[trio] >=3.2.1,<4.0.0
+python-jose[cryptography] >=3.3.0,<4.0.0
+pyyaml >=5.3.1,<7.0.0
+passlib[bcrypt] >=1.7.2,<2.0.0
+
+# types
+types-ujson ==5.7.0.1
+types-orjson ==3.6.2
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..9d51e1c
--- /dev/null
@@ -0,0 +1,6 @@
+-e .[all]
+-r requirements-tests.txt
+-r requirements-docs.txt
+ruff ==0.0.138
+uvicorn[standard] >=0.12.0,<0.21.0
+pre-commit >=2.17.0,<3.0.0
index 383ad3f4465c7628b7c4327ffbe4330eba1cd237..ebf864afa3dac2eb1e0931cfed19d25c9bd83e3f 100755 (executable)
@@ -3,4 +3,6 @@
 set -e
 set -x
 
+# Check README.md is up to date
+python ./scripts/docs.py verify-readme
 python ./scripts/docs.py build-all
index 62449ea41549bbf2f77a39f4f2c3b8e745328297..7d17add8fa4b88fa1fa7c12142a2f384dfa9572e 100755 (executable)
@@ -3,7 +3,5 @@
 set -e
 set -x
 
-# Check README.md is up to date
-python ./scripts/docs.py verify-readme
 export PYTHONPATH=./docs_src
 coverage run -m pytest tests ${@}