diff --git a/.gitignore b/.gitignore index 910e6c1..9070f2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /fastapi-0.61.1.tar.gz +/fastapi-0.63.0.tar.gz +/0.63.0.tar.gz diff --git a/fastapi-0.63.0-pr-2335.patch b/fastapi-0.63.0-pr-2335.patch new file mode 100644 index 0000000..b68cd67 --- /dev/null +++ b/fastapi-0.63.0-pr-2335.patch @@ -0,0 +1,98 @@ +diff -Naur fastapi-0.63.0-original/fastapi/responses.py fastapi-0.63.0/fastapi/responses.py +--- fastapi-0.63.0-original/fastapi/responses.py 2020-12-20 14:20:34.172180000 -0500 ++++ fastapi-0.63.0/fastapi/responses.py 2021-03-04 15:17:03.600186189 -0500 +@@ -7,7 +7,11 @@ + from starlette.responses import RedirectResponse as RedirectResponse # noqa + from starlette.responses import Response as Response # noqa + from starlette.responses import StreamingResponse as StreamingResponse # noqa +-from starlette.responses import UJSONResponse as UJSONResponse # noqa ++ ++try: ++ import ujson ++except ImportError: # pragma: nocover ++ ujson = None # type: ignore + + try: + import orjson +@@ -15,6 +19,12 @@ + orjson = None # type: ignore + + ++class UJSONResponse(JSONResponse): ++ def render(self, content: Any) -> bytes: ++ assert ujson is not None, "ujson must be installed to use UJSONResponse" ++ return ujson.dumps(content, ensure_ascii=False).encode("utf-8") ++ ++ + class ORJSONResponse(JSONResponse): + media_type = "application/json" + +diff -Naur fastapi-0.63.0-original/pyproject.toml fastapi-0.63.0/pyproject.toml +--- fastapi-0.63.0-original/pyproject.toml 2020-12-20 14:20:34.176180000 -0500 ++++ fastapi-0.63.0/pyproject.toml 2021-03-04 15:18:37.563775376 -0500 +@@ -32,7 +32,7 @@ + "Topic :: Internet :: WWW/HTTP", + ] + requires = [ +- "starlette ==0.13.6", ++ "starlette ==0.14.1", + "pydantic >=1.0.0,<2.0.0" + ] + description-file = "README.md" +@@ -57,6 +57,7 @@ + "peewee >=3.13.3,<4.0.0", + "databases[sqlite] >=0.3.2,<0.4.0", + "orjson >=3.2.1,<4.0.0", ++ "ujson >=4.0.1,<5.0.0", + "async_exit_stack >=1.0.1,<2.0.0", + "async_generator >=1.10,<2.0.0", + "python-multipart >=0.0.5,<0.0.6", +@@ -87,7 +88,7 @@ + "itsdangerous >=1.1.0,<2.0.0", + "pyyaml >=5.3.1,<6.0.0", + "graphene >=2.1.8,<3.0.0", +- "ujson >=3.0.0,<4.0.0", ++ "ujson >=4.0.1,<5.0.0", + "orjson >=3.2.1,<4.0.0", + "email_validator >=1.1.1,<2.0.0", + "uvicorn[standard] >=0.12.0,<0.14.0", +diff -Naur fastapi-0.63.0-original/tests/test_tutorial/test_custom_response/test_tutorial001.py fastapi-0.63.0/tests/test_tutorial/test_custom_response/test_tutorial001.py +--- fastapi-0.63.0-original/tests/test_tutorial/test_custom_response/test_tutorial001.py 1969-12-31 19:00:00.000000000 -0500 ++++ fastapi-0.63.0/tests/test_tutorial/test_custom_response/test_tutorial001.py 2021-03-04 15:18:51.213860966 -0500 +@@ -0,0 +1,36 @@ ++from fastapi.testclient import TestClient ++ ++from docs_src.custom_response.tutorial001 import app ++ ++client = TestClient(app) ++ ++openapi_schema = { ++ "openapi": "3.0.2", ++ "info": {"title": "FastAPI", "version": "0.1.0"}, ++ "paths": { ++ "/items/": { ++ "get": { ++ "responses": { ++ "200": { ++ "description": "Successful Response", ++ "content": {"application/json": {"schema": {}}}, ++ } ++ }, ++ "summary": "Read Items", ++ "operationId": "read_items_items__get", ++ } ++ } ++ }, ++} ++ ++ ++def test_openapi_schema(): ++ response = client.get("/openapi.json") ++ assert response.status_code == 200, response.text ++ assert response.json() == openapi_schema ++ ++ ++def test_get_custom_response(): ++ response = client.get("/items/") ++ assert response.status_code == 200, response.text ++ assert response.json() == [{"item_id": "Foo"}] diff --git a/python-fastapi.spec b/python-fastapi.spec index 6811613..e533b7d 100644 --- a/python-fastapi.spec +++ b/python-fastapi.spec @@ -1,74 +1,391 @@ -%global pypi_name fastapi +%global srcname fastapi -Name: python-%{pypi_name} -Version: 0.61.1 -Release: 3%{?dist} -Summary: FastAPI - High Performance, Easy to Learn, Fast to Code, Production Ready +# The following dependencies must be packaged to build the HTML documentation: +# - python3dist(markdown-include) +# - python3dist(mkdocs-markdown-extradata-plugin) +%bcond_with html_docs + +%global sum_en FastAPI framework +%global sum_es FastAPI framework +# Missing translation (localized docs present, but untranslated) +# Summary(fr): FastAPI framework +# Missing translation (localized docs present, but untranslated) +# Summary(it): FastAPI framework +# Translation present, but the title was not translated +%global sum_ja FastAPI framework +%global sum_ka FastAPI 프레임워크 +%global sum_pt Framework FastAPI +# Missing translation (localized docs present, but untranslated) +# %%global sum_ru FastAPI framework +# Missing translation (localized docs present, but untranslated) +# %%global sum_sq FastAPI framework +# Missing translation (localized docs present, but untranslated) +# %%global sum_tr FastAPI framework +# Missing translation (localized docs present, but untranslated) +# %%global sum_uk FastAPI framework +%global sum_zh FastAPI 框架 + +Name: python-%{srcname} +Version: 0.63.0 +Release: 1%{?dist} +Summary: %{sum_en} License: MIT -URL: https://github.com/tiangolo/fastapi -Source0: %{pypi_source} +URL: https://github.com/tiangolo/%{srcname} +Source0: %{url}/archive/%{version}.tar.gz BuildArch: noarch +# Fix compatibility with starlette 0.14.x +# (https://github.com/tiangolo/fastapi/issues/2342, +# https://github.com/tiangolo/fastapi/issues/2493): +# +# https://github.com/tiangolo/fastapi/pull/2335/ +Patch0: %{srcname}-0.63.0-pr-2335.patch + BuildRequires: python3-devel +BuildRequires: pyproject-rpm-macros BuildRequires: python3dist(setuptools) -BuildRequires: python3dist(pytest) -BuildRequires: python3dist(pytest-cov) -BuildRequires: python3dist(pytest-asyncio) -BuildRequires: python3dist(starlette) -BuildRequires: python3dist(pydantic) -BuildRequires: python3dist(httpx) -BuildRequires: python3dist(python-jose) -BuildRequires: python3dist(passlib) -BuildRequires: python3dist(bcrypt) -BuildRequires: python3dist(peewee) -BuildRequires: python3dist(sqlalchemy) -BuildRequires: python3dist(flask) -#BuildRequires: python3dist(orjson) - -%description -FastAPI framework, high performance, easy to learn, fast to code, -ready for production - -%package -n python3-%{pypi_name} -Summary: %{summary} - -Requires: python3dist(starlette) -Requires: python3dist(pydantic) -Requires: python3dist(uvicorn) - -%{?python_provide:%python_provide python3-%{pypi_name}} - -%description -n python3-%{pypi_name} -FastAPI framework, high performance, easy to learn, fast to code, -ready for production + +Summary(en): %{sum_en} +Summary(es): %%{sum_es} +# Summary(fr): %%{sum_fr} +# Summary(it): %%{sum_it} +Summary(ja): %{sum_ja} +Summary(ko): %{sum_ko} +Summary(pt): %{sum_pt} +# Summary(ru): %%{sum_ru} +# Summary(sq): %%{sum_sq} +# Summary(tr): %%{sum_tr} +# Summary(uk): %%{sum_uk} +Summary(zh): %{sum_zh} + +%global common_description_en %{expand: +FastAPI is a modern, fast (high-performance), web framework for building APIs +with Python 3.6+ based on standard Python type hints. + +The key features are: + + • Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette + and Pydantic). One of the fastest Python frameworks available. + + • Fast to code: Increase the speed to develop features by about 200% to 300%.* + • Fewer bugs: Reduce about 40% of human (developer) induced errors.* + • Intuitive: Great editor support. Completion everywhere. Less time + debugging. + • Easy: Designed to be easy to use and learn. Less time reading docs. + • Short: Minimize code duplication. Multiple features from each parameter + declaration. Fewer bugs. + • Robust: Get production-ready code. With automatic interactive + documentation. + • Standards-based: Based on (and fully compatible with) the open standards + for APIs: OpenAPI (previously known as Swagger) and JSON Schema. + +* estimation based on tests on an internal development team, building production + applications.} +%global common_description_es %{expand: +FastAPI es un web framework moderno y rápido (de alto rendimiento) para +construir APIs con Python 3.6+ basado en las anotaciones de tipos estándar de +Python. + +Sus características principales son: + + • Rapidez: Alto rendimiento, a la par con NodeJS y Go (gracias a + Starlette y Pydantic). Uno de los frameworks de Python más rápidos. + + • Rápido de programar: Incrementa la velocidad de desarrollo entre 200% y + 300%.* + • Menos errores: Reduce los errores humanos (de programador) aproximadamente + un 40%.* + • Intuitivo: Gran soporte en los editores con auto completado en todas + partes. Gasta menos tiempo debugging. + • Fácil: Está diseñado para ser fácil de usar y aprender. Gastando menos + tiempo leyendo documentación. + • Corto: Minimiza la duplicación de código. Múltiples funcionalidades con + cada declaración de parámetros. Menos errores. + • Robusto: Crea código listo para producción con documentación automática + interactiva. + • Basado en estándares: Basado y totalmente compatible con los estándares + abiertos para APIs: OpenAPI (conocido previamente como Swagger) y JSON + Schema. + +* Esta estimación está basada en pruebas con un equipo de desarrollo interno + contruyendo aplicaciones listas para producción.} +#%%global common_description_fr %%{expand:…} +#%%global common_description_it %%{expand:…} +%global common_description_ja %{expand: +FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.6 以降でAPI +を構築するための、モダンで、高速(高パフォーマンス)な、Web フレームワークです。 + +主な特徴: + + - 高速: NodeJS や Go 並みのとても高いパフォーマンス (Starlette と Pydantic + のおかげです)。最も高速な Python フレームワークの一つです。 + + - 高速なコーディング: 開発速度を約 200%~300%向上させます。 * + - 少ないバグ: 開発者起因のヒューマンエラーを約 40%削減します。 * + - 直感的: 素晴らしいエディタのサポートや オートコンプリート。 + デバッグ時間を削減します。 + - 簡単: 簡単に利用、習得できるようにデザインされています。 + ドキュメントを読む時間を削減します。 + - 短い: コードの重複を最小限にしています。 + 各パラメータからの複数の機能。少ないバグ。 + - 堅牢性: + 自動対話ドキュメントを使用して、本番環境で使用できるコードを取得します。 + - Standards-based: API + のオープンスタンダードに基づいており、完全に互換性があります: OpenAPI + (以前は Swagger として知られていました) や JSON スキーマ. + +* 本番アプリケーションを構築している開発チームのテストによる見積もり。} +%global common_description_ko %{expand: +FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트에 기초한 +Python3.6+의 API를 빌드하기 위한 웹 프레임워크입니다. + +주요 특징으로: + + • 빠름: (Starlette과 Pydantic 덕분에) NodeJS 및 Go와 대등할 정도로 매우 높은 + 성능. 사용 가능한 가장 빠른 파이썬 프레임워크 중 하나. + + • 빠른 코드 작성: 약 200%에서 300%까지 기능 개발 속도 증가.* + • 적은 버그: 사람(개발자)에 의한 에러 약 40% 감소.* + • 직관적: 훌륭한 편집기 지원. 모든 곳에서 자동완성. 적은 디버깅 시간. + • 쉬움: 쉽게 사용하고 배우도록 설계. 적은 문서 읽기 시간. + • 짧음: 코드 중복 최소화. 각 매개변수 선언의 여러 기능. 적은 버그. + • 견고함: 준비된 프로덕션 용 코드를 얻으세요. 자동 대화형 문서와 함께. + • 표준 기반: API에 대한 (완전히 호환되는) 개방형 표준 기반: OpenAPI (이전에 + Swagger로 알려졌던) 및 JSON 스키마. + +* 내부 개발팀의 프로덕션 애플리케이션을 빌드한 테스트에 근거한 측정} +%global common_description_pt %{expand: +FastAPI é um moderno e rápido (alta performance) framework web para construção +de APIs com Python 3.6 ou superior, baseado nos type hints padrões do Python. + +Os recursos chave são: + + • Rápido: alta performance, equivalente a NodeJS e Go (graças ao Starlette e + Pydantic). Um dos frameworks mais rápidos disponíveis. + • Rápido para codar: Aumenta a velocidade para desenvolver recursos entre + 200% a 300%.* + • Poucos bugs: Reduz cerca de 40% de erros induzidos por humanos + (desenvolvedores).* + • Intuitivo: Grande suporte a IDEs. Auto-Complete em todos os lugares. Menos + tempo debugando. + • Fácil: Projetado para ser fácil de aprender e usar. Menos tempo lendo + documentação. + • Enxuto: Minimize duplicação de código. Múltiplos recursos para cada + declaração de parâmetro. Menos bugs. + • Robusto: Tenha código pronto para produção. E com documentação interativa + automática. + • Baseado em padrões: Baseado em (e totalmente compatível com) os padrões + abertos para APIs: OpenAPI (anteriormente conhecido como Swagger) e JSON + Schema. + +* estimativas baseadas em testes realizados com equipe interna de + desenvolvimento, construindo aplicações em produção.} +#%%global common_description_ru %%{expand:…} +#%%global common_description_sq %%{expand:…} +#%%global common_description_tr %%{expand:…} +#%%global common_description_uk %%{expand:…} +%global common_description_zh %{expand: +FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ +并基于标准的 Python 类型提示。 + +关键特性: + + • 快速:可与 NodeJS 和 Go 比肩的极高性能(归功于 Starlette 和 Pydantic)。 + 最快的 Python web 框架之一。 + • 高效编码:提高功能开发速度约 200% 至 300%。* + • 更少 bug:减少约 40% 的人为(开发者)导致错误。* + • 智能:极佳的编辑器支持。处处皆可自动补全,减少调试时间。 + • 简单:设计的易于使用和学习,阅读文档的时间更短。 + • 简短:使代码重复最小化。通过不同的参数声明实现丰富功能。bug 更少。 + • 健壮:生产可用级别的代码。还有自动生成的交互式文档。 + • 标准化:基于(并完全兼容)API 的相关开放标准:OpenAPI (以前被称为 Swagger) + 和 JSON Schema。 + +* 根据对某个构建线上应用的内部开发团队所进行的测试估算得出。} + +%description %{common_description_en} + +%description -l en %{common_description_en} +%description -l es %{common_description_es} +#%%description -l fr %%{common_description_fr} +#%%description -l it %%{common_description_it} +%description -l ja %{common_description_ja} +%description -l ko %{common_description_ko} +%description -l pt %{common_description_pt} +#%%description -l ru %%{common_description_ru} +#%%description -l sq %%{common_description_sq} +#%%description -l tr %%{common_description_tr} +#%%description -l uk %%{common_description_uk} +%description -l zh %{common_description_zh} + + +%generate_buildrequires +# Tests under tests/test_tutorial may require dependencies that are only in the +# dev extra. +%pyproject_buildrequires -x all,test,dev%{?with_html_docs:,doc} + + +%pyproject_extras_subpkg -n python3-%{srcname} all + + +%package -n python3-%{srcname} +Summary: %{sum_en} + +Summary(en): %{sum_en} +Summary(es): %%{sum_es} +# Summary(fr): %%{sum_fr} +# Summary(it): %%{sum_it} +Summary(ja): %{sum_ja} +Summary(ko): %{sum_ko} +Summary(pt): %{sum_pt} +# Summary(ru): %%{sum_ru} +# Summary(sq): %%{sum_sq} +# Summary(tr): %%{sum_tr} +# Summary(uk): %%{sum_uk} +Summary(zh): %{sum_zh} + +%description -n python3-%{srcname} %{common_description_en} + +%description -n python3-%{srcname} -l en %{common_description_en} +%description -n python3-%{srcname} -l es %{common_description_es} +#%%description -n python3-%%{srcname} -l fr %%{common_description_fr} +#%%description -n python3-%%{srcname} -l it %%{common_description_it} +%description -n python3-%{srcname} -l ja %{common_description_ja} +%description -n python3-%{srcname} -l ko %{common_description_ko} +%description -n python3-%{srcname} -l pt %{common_description_pt} +#%%description -n python3-%%{srcname} -l ru %%{common_description_ru} +#%%description -n python3-%%{srcname} -l sq %%{common_description_sq} +#%%description -n python3-%%{srcname} -l tr %%{common_description_tr} +#%%description -n python3-%%{srcname} -l uk %%{common_description_uk} +%description -n python3-%{srcname} -l zh %{common_description_zh} + + +%package doc +Summary: Documentation for %{name} + +%description doc %{common_description_en} + +%description doc -l en %{common_description_en} +%description doc -l es %{common_description_es} +#%%description doc -l fr %%{common_description_fr} +#%%description doc -l it %%{common_description_it} +%description doc -l ja %{common_description_ja} +%description doc -l ko %{common_description_ko} +%description doc -l pt %{common_description_pt} +#%%description doc -l ru %%{common_description_ru} +#%%description doc -l sq %%{common_description_sq} +#%%description doc -l tr %%{common_description_tr} +#%%description doc -l uk %%{common_description_uk} +%description doc -l zh %{common_description_zh} + %prep -%autosetup -n %{pypi_name}-%{version} -#disable these tests for now -rm tests/test_tutorial/test_custom_response/test_tutorial001b.py -rm tests/test_tutorial/test_async_sql_databases/test_tutorial001.py -rm tests/test_default_response_class.py -rm tests/test_security_oauth2.py -rm tests/test_validate_response_recursive.py +%autosetup -n %{srcname}-%{version} -p1 + +# Comment out all dependencies on orjson (for ORJSONResponse); it cannot be +# packaged in Fedora until it builds with the stable Rust toolchain instead of +# the nightly one. Note that this removes it from the “all” extra metapackage. +# +# Loosen all dependencies that are pinned to exact versions. We have to try to +# work with what is packaged. +# +# Comment out test dependencies that are only for linting/formatting/analysis, +# and will not be used. +# +# Comment out the databases[sqlite] test dependency because it is not yet +# packaged for Fedora. +# +# Do not require async backport libraries where they are not needed +# (https://github.com/tiangolo/fastapi/pull/2902). +# +# Selectively loosen dependencies that are perhaps arbitrarily pinned to +# certain version ranges: first, those for which we choose to allow newer +# versions, and second, those for which we choose to allow older and newer +# versions. This could have unwanted consequences, but such is the nature of +# packaging. +# +# Replace passlib[bcrypt] with passlib and bcrypt separately, until +# https://bugzilla.redhat.com/show_bug.cgi?id=1936021 is fixed. +sed -r -i \ + -e 's/("orjson\b.*",)/# \1/' \ + -e 's/==/>=/g' \ + -e 's/("(mypy|black|flake8|isort|autoflake)\b.*",)/# \1/' \ + -e 's/("(databases\[sqlite\]).*",)/# \1/' \ + -e 's/("async_(exit_stack|generator)[^"]*)/\1; '"python_version < '3.7'/" \ + -e 's/("(httpx)\b[^<"]*),[[:blank:]]*<[^"]*/\1/' \ + -e 's/("(mkdocs-material|ujson))\b[^"]*/\1/' \ + -e 's/([[:blank:]]*)("passlib)\[bcrypt\](.*)/\1"bcrypt",\n\1\2\3/' \ + pyproject.toml + +# Remove bundled js-termynal 0.0.1: +find docs -type f -name 'termynal.*' | + while read -r fn + do + echo '' > "${fn}" # make it an empty file + done +# We can restore this functionality after it is packaged separately: +# https://bugzilla.redhat.com/show_bug.cgi?id=1935984 %build -%py3_build +%pyproject_wheel +%if %{with html_docs} +mkdocs build +%endif + %install -%py3_install +%pyproject_install +%pyproject_save_files %{srcname} + +install -t '%{buildroot}%{_pkgdocdir}' -D -m 0644 -p \ + CONTRIBUTING.md README.md +%if %{with html_docs} +cp -rp site '%{buildroot}%{_pkgdocdir}/' +%else +cp -rp docs '%{buildroot}%{_pkgdocdir}/markdown' +%endif + %check -%pytest +# Requires databases[sqlite]: +# tests/test_tutorial/test_async_sql_databases/test_tutorial001.py +# tests/test_tutorial/test_custom_response/test_tutorial001b.py +# Requires orjson: +# tests/test_default_response_class.py +%pytest \ + --ignore=tests/test_tutorial/test_async_sql_databases/test_tutorial001.py \ + --ignore=tests/test_tutorial/test_custom_response/test_tutorial001b.py \ + --ignore=tests/test_default_response_class.py -%files -n python3-%{pypi_name} + +%files -n python3-%{srcname} -f %{pyproject_files} %license LICENSE %doc README.md -%{python3_sitelib}/%{pypi_name} -%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info + + +%files doc +%license LICENSE +%{_pkgdocdir} + %changelog +* Sat Mar 06 2021 Benjamin A. Beasley - 0.63.0-1 +- New upstream version 0.63.0 +- Whitespace changes +- Drop obsolete %%python_provide macro +- Comment out orjson dependencies in package metadata +- Remove explicit/manual dependencies. This drops the hard dependency on uvicorn. +- Use pyproject-rpm-macros for generated BR’s +- Loosen all pinned dependencies +- Fix starlette 0.14.x compatibility +- Switch from PyPI tarball to GitHub tarball +- Add a metapackage for the “all” extra (which is really all-but-orjson) +- Add a separate -doc package; for now, we cannot build the HTML documentation, + so we install the Markdown sources instead +- Improved and localized summaries and descriptions from upstream + * Wed Jan 27 2021 Fedora Release Engineering - 0.61.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild @@ -77,4 +394,4 @@ rm tests/test_validate_response_recursive.py * Wed Sep 30 2020 Itamar Reis Peixoto - 0.61.1-1 - Initial package. -- Fix license TAG. \ No newline at end of file +- Fix license TAG. diff --git a/sources b/sources index 6dcf1b5..172ccb8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (fastapi-0.61.1.tar.gz) = 5c3e3204ed8dd4d058cf0b19660004ac3e868b54ad3b7fd81d7765f82a7f552b6d8ef1eef82f38bb6d648d8d51814ee27c47f90b9eef8da5a5c1ed68eba6ecf6 +SHA512 (0.63.0.tar.gz) = 9fa931f913daab19294f32cb2153c9355e93783cf5765beda6e5cdb15e3f2564867c100700ac33ba5daf9779b730952afc692f9460bd41a594e101d601b10210