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

🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch #5240

Merged
merged 9 commits into from Sep 14, 2022
7 changes: 2 additions & 5 deletions .github/workflows/build-docs.yml
Expand Up @@ -23,17 +23,14 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m pip install flit
- name: Install docs extras
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m flit install --deps production --extras doc
run: pip install .[doc]
- 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
- name: Build Docs
run: python3.7 ./scripts/docs.py build-all
run: python ./scripts/docs.py build-all
- name: Zip docs
run: bash ./scripts/zip-docs.sh
- uses: actions/upload-artifact@v3
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/publish.yml
Expand Up @@ -17,23 +17,21 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.6"
python-version: "3.7"
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
- name: Install Flit
- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
run: pip install build
- name: Build distribution
run: python -m build
- name: Publish
env:
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: bash scripts/publish.sh
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with:
with:
user: __token__

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed? Then maybe the docs in the GitHub Action need an update too?

https://github.com/pypa/gh-action-pypi-publish#usage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, guess not!

password: ${{ secrets.PYPI_API_TOKEN }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
fail-fast: false

steps:
Expand All @@ -26,14 +26,10 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v02
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
run: pip install -e .[all,dev,doc,test]
- name: Lint
if: ${{ matrix.python-version != '3.6' }}
run: bash scripts/lint.sh
- name: Test
run: bash scripts/test.sh
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -27,7 +27,7 @@

---

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.

The key features are:

Expand Down Expand Up @@ -112,7 +112,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down Expand Up @@ -328,7 +328,7 @@ You do that with standard modern Python types.

You don't have to learn a new syntax, the methods or classes of a specific library, etc.

Just standard **Python 3.6+**.
Just standard **Python 3.7+**.

For example, for an `int`:

Expand Down
2 changes: 1 addition & 1 deletion docs/de/docs/index.md
Expand Up @@ -111,7 +111,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down
44 changes: 6 additions & 38 deletions docs/en/docs/contributing.md
Expand Up @@ -99,61 +99,29 @@ $ python -m pip install --upgrade pip
!!! tip
Every time you install a new package with `pip` under that environment, activate the environment again.

This makes sure that if you use a terminal program installed by that package (like `flit`), you use the one from your local environment and not any other that could be installed globally.
This makes sure that if you use a terminal program installed by that package, you use the one from your local environment and not any other that could be installed globally.

### Flit
### pip

**FastAPI** uses <a href="https://flit.readthedocs.io/en/latest/index.html" class="external-link" target="_blank">Flit</a> to build, package and publish the project.

After activating the environment as described above, install `flit`:
After activating the environment as described above:

<div class="termy">

```console
$ pip install flit
$ pip install -e .[dev,doc,test]

---> 100%
```

</div>

Now re-activate the environment to make sure you are using the `flit` you just installed (and not a global one).

And now use `flit` to install the development dependencies:

=== "Linux, macOS"

<div class="termy">

```console
$ flit install --deps develop --symlink

---> 100%
```

</div>

=== "Windows"

If you are on Windows, use `--pth-file` instead of `--symlink`:

<div class="termy">

```console
$ flit install --deps develop --pth-file

---> 100%
```

</div>

It will install all the dependencies and your local FastAPI in your local environment.

#### Using your local FastAPI

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 `--symlink` (or `--pth-file` on Windows), 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, as it is installed with `-e`, 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.

Expand All @@ -171,7 +139,7 @@ $ bash scripts/format.sh

It will also auto-sort all your imports.

For it to sort them correctly, you need to have FastAPI installed locally in your environment, with the command in the section above using `--symlink` (or `--pth-file` on Windows).
For it to sort them correctly, you need to have FastAPI installed locally in your environment, with the command in the section above using `-e`.

## Docs

Expand Down
6 changes: 3 additions & 3 deletions docs/en/docs/index.md
Expand Up @@ -27,7 +27,7 @@

---

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.

The key features are:

Expand Down Expand Up @@ -109,7 +109,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down Expand Up @@ -325,7 +325,7 @@ You do that with standard modern Python types.

You don't have to learn a new syntax, the methods or classes of a specific library, etc.

Just standard **Python 3.6+**.
Just standard **Python 3.7+**.

For example, for an `int`:

Expand Down
2 changes: 1 addition & 1 deletion docs/es/docs/index.md
Expand Up @@ -106,7 +106,7 @@ Si estás construyendo un app de <abbr title="Interfaz de línea de comandos en

## Requisitos

Python 3.6+
Python 3.7+

FastAPI está sobre los hombros de gigantes:

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/docs/index.md
Expand Up @@ -111,7 +111,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down
2 changes: 1 addition & 1 deletion docs/id/docs/index.md
Expand Up @@ -111,7 +111,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down
2 changes: 1 addition & 1 deletion docs/it/docs/index.md
Expand Up @@ -111,7 +111,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down
45 changes: 6 additions & 39 deletions docs/ja/docs/contributing.md
Expand Up @@ -88,62 +88,29 @@ $ python -m venv env
!!! tip "豆知識"
この環境で`pip`を使って新しいパッケージをインストールするたびに、仮想環境を再度有効化します。

これにより、そのパッケージによってインストールされたターミナルのプログラム (`flit`など) を使用する場合、ローカル環境のものを使用し、グローバルにインストールされたものは使用されなくなります。
これにより、そのパッケージによってインストールされたターミナルのプログラム を使用する場合、ローカル環境のものを使用し、グローバルにインストールされたものは使用されなくなります。

### Flit
### pip

**FastAPI**は<a href="https://flit.readthedocs.io/en/latest/index.html" class="external-link" target="_blank">Flit</a> を使って、ビルド、パッケージ化、公開します。

上記のように環境を有効化した後、`flit`をインストールします:
上記のように環境を有効化した後:

<div class="termy">

```console
$ pip install flit
$ pip install -e .[dev,doc,test]

---> 100%
```

</div>


次に、環境を再び有効化して、インストールしたばかりの`flit` (グローバルではない) を使用していることを確認します。

そして、`flit`を使用して開発のための依存関係をインストールします:

=== "Linux, macOS"

<div class="termy">

```console
$ flit install --deps develop --symlink

---> 100%
```

</div>

=== "Windows"

Windowsユーザーは、`--symlink`のかわりに`--pth-file`を使用します:

<div class="termy">

```console
$ flit install --deps develop --pth-file

---> 100%
```

</div>

これで、すべての依存関係とFastAPIを、ローカル環境にインストールします。

#### ローカル環境でFastAPIを使う

FastAPIをインポートして使用するPythonファイルを作成し、ローカル環境で実行すると、ローカルのFastAPIソースコードが使用されます。

そして、`--symlink` (Windowsでは` --pth-file`) でインストールされているローカルのFastAPIソースコードを更新した場合、そのPythonファイルを再度実行すると、更新したばかりの新しいバージョンのFastAPIが使用されます。
そして、`-e` でインストールされているローカルのFastAPIソースコードを更新した場合、そのPythonファイルを再度実行すると、更新したばかりの新しいバージョンのFastAPIが使用されます。

これにより、ローカルバージョンを「インストール」しなくても、すべての変更をテストできます。

Expand All @@ -161,7 +128,7 @@ $ bash scripts/format.sh

また、すべてのインポートを自動でソートします。

正しく並べ替えるには、上記セクションのコマンドで `--symlink` (Windowsの場合は` --pth-file`) を使い、FastAPIをローカル環境にインストールしている必要があります。
正しく並べ替えるには、上記セクションのコマンドで `-e` を使い、FastAPIをローカル環境にインストールしている必要があります。

### インポートの整形

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/docs/index.md
Expand Up @@ -107,7 +107,7 @@ FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.6 以

## 必要条件

Python 3.6+
Python 3.7+

FastAPI は巨人の肩の上に立っています。

Expand Down
2 changes: 1 addition & 1 deletion docs/ko/docs/index.md
Expand Up @@ -107,7 +107,7 @@ FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트

## 요구사항

Python 3.6+
Python 3.7+

FastAPI는 거인들의 어깨 위에 서 있습니다:

Expand Down
2 changes: 1 addition & 1 deletion docs/nl/docs/index.md
Expand Up @@ -114,7 +114,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be

## Requirements

Python 3.6+
Python 3.7+

FastAPI stands on the shoulders of giants:

Expand Down
2 changes: 1 addition & 1 deletion docs/pl/docs/index.md
Expand Up @@ -106,7 +106,7 @@ Jeżeli tworzysz aplikacje <abbr title="aplikacja z interfejsem konsolowym">CLI<

## Wymagania

Python 3.6+
Python 3.7+

FastAPI oparty jest na:

Expand Down