Skip to content

Commit

Permalink
馃敡 Migrate from Hatch to PDM for the internal build (#11498)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Apr 29, 2024
1 parent bec2ec7 commit 41fcbc7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 21 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- fastapi
permissions:
id-token: write
steps:
- name: Dump GitHub context
env:
Expand All @@ -21,19 +27,14 @@ jobs:
# Issue ref: https://github.com/actions/setup-python/issues/436
# cache: "pip"
# cache-dependency-path: pyproject.toml
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
- name: Install build dependencies
run: pip install build
- name: Build distribution
env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
Expand Down
2 changes: 1 addition & 1 deletion fastapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""

__version__ = "0.110.2"
__version__ = "0.110.3.dev2"

from starlette import status as status

Expand Down
56 changes: 50 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[build-system]
requires = ["hatchling >= 1.13.0"]
build-backend = "hatchling.build"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[project]
name = "fastapi"
dynamic = ["version"]
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
authors = [
{ name = "Sebasti谩n Ram铆rez", email = "tiangolo@gmail.com" },
]
Expand Down Expand Up @@ -45,30 +45,74 @@ dependencies = [
"pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0",
"typing-extensions>=4.8.0",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/tiangolo/fastapi"
Documentation = "https://fastapi.tiangolo.com/"
Repository = "https://github.com/tiangolo/fastapi"

[project.optional-dependencies]

# standard = [
# # For the test client
# "httpx >=0.23.0",
# # For templates
# "jinja2 >=2.11.2",
# # For forms and file uploads
# "python-multipart >=0.0.7",
# # For UJSONResponse
# "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0",
# # For ORJSONResponse
# "orjson >=3.2.1",
# # To validate email fields
# "email_validator >=2.0.0",
# # Uvicorn with uvloop
# "uvicorn[standard] >=0.12.0",
# # Settings management
# "pydantic-settings >=2.0.0",
# # Extra Pydantic data types
# "pydantic-extra-types >=2.0.0",
# ]

all = [
# # For the test client
"httpx >=0.23.0",
# For templates
"jinja2 >=2.11.2",
# For forms and file uploads
"python-multipart >=0.0.7",
# For Starlette's SessionMiddleware, not commonly used with FastAPI
"itsdangerous >=1.1.0",
# For Starlette's schema generation, would not be used with FastAPI
"pyyaml >=5.3.1",
# For UJSONResponse
"ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0",
# For ORJSONResponse
"orjson >=3.2.1",
# To validate email fields
"email_validator >=2.0.0",
# Uvicorn with uvloop
"uvicorn[standard] >=0.12.0",
# Settings management
"pydantic-settings >=2.0.0",
# Extra Pydantic data types
"pydantic-extra-types >=2.0.0",
]

[tool.hatch.version]
path = "fastapi/__init__.py"
[tool.pdm]
version = { source = "file", path = "fastapi/__init__.py" }
distribution = true

[tool.pdm.build]
source-includes = [
"tests/",
"docs_src/",
"requirements*.txt",
"scripts/",
# For a test
"docs/en/docs/img/favicon.png",
]


[tool.mypy]
strict = true
Expand Down
7 changes: 1 addition & 6 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
-e .
-e .[all]
-r requirements-docs-tests.txt
pydantic-settings >=2.0.0
pytest >=7.1.3,<8.0.0
coverage[toml] >= 6.5.0,< 8.0
mypy ==1.8.0
ruff ==0.2.0
email_validator >=1.1.1,<3.0.0
dirty-equals ==0.6.0
# TODO: once removing databases from tutorial, upgrade SQLAlchemy
# probably when including SQLModel
sqlalchemy >=1.3.18,<1.4.43
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.7,<0.1.0
flask >=1.1.2,<3.0.0
anyio[trio] >=3.2.1,<4.0.0
python-jose[cryptography] >=3.3.0,<4.0.0
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-e .[all]
-r requirements-tests.txt
-r requirements-docs.txt
uvicorn[standard] >=0.12.0,<0.23.0
pre-commit >=2.17.0,<4.0.0
# For generating screenshots
playwright

0 comments on commit 41fcbc7

Please sign in to comment.