mirror of https://github.com/tiangolo/fastapi.git
⬇️ Separate requirements for development into their own requirements.txt files, they shouldn't be extras (#9655)
This commit is contained in:
parent
c8b729aea7
commit
6595658324
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
|
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
|
||||||
- name: Install docs extras
|
- name: Install docs extras
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: pip install .[doc]
|
run: pip install -r requirements-docs.txt
|
||||||
- name: Install Material for MkDocs Insiders
|
- 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'
|
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
|
run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
|
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: pip install -e .[all,dev,doc,test]
|
run: pip install -r requirements-tests.txt
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: bash scripts/lint.sh
|
run: bash scripts/lint.sh
|
||||||
- run: mkdir coverage
|
- run: mkdir coverage
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ $ python -m pip install --upgrade pip
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ."[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 100%
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ After activating the environment as described above:
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ".[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 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.
|
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.
|
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
|
### Format
|
||||||
|
|
||||||
There is a script that you can run that will format and clean all your code:
|
There is a script that you can run that will format and clean all your code:
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ $ python -m venv env
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ."[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 100%
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ Após ativar o ambiente como descrito acima:
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ."[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 100%
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ $ python -m pip install --upgrade pip
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ."[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 100%
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ $ python -m venv env
|
||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pip install -e ."[dev,doc,test]"
|
$ pip install -r requirements.txt
|
||||||
|
|
||||||
---> 100%
|
---> 100%
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -51,47 +51,6 @@ Homepage = "https://github.com/tiangolo/fastapi"
|
||||||
Documentation = "https://fastapi.tiangolo.com/"
|
Documentation = "https://fastapi.tiangolo.com/"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[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 = [
|
all = [
|
||||||
"httpx >=0.23.0",
|
"httpx >=0.23.0",
|
||||||
"jinja2 >=2.11.2",
|
"jinja2 >=2.11.2",
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -3,4 +3,6 @@
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
# Check README.md is up to date
|
||||||
|
python ./scripts/docs.py verify-readme
|
||||||
python ./scripts/docs.py build-all
|
python ./scripts/docs.py build-all
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,5 @@
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# Check README.md is up to date
|
|
||||||
python ./scripts/docs.py verify-readme
|
|
||||||
export PYTHONPATH=./docs_src
|
export PYTHONPATH=./docs_src
|
||||||
coverage run -m pytest tests ${@}
|
coverage run -m pytest tests ${@}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue