Blame python-fastapi.spec

44d6223
%global srcname fastapi
9449886
352bf21
%bcond_without html_docs
44d6223
44d6223
%global sum_en  FastAPI framework
44d6223
%global sum_es  FastAPI framework
44d6223
# Missing translation (localized docs present, but untranslated)
43085cb
# Summary(de):    FastAPI framework
43085cb
# Missing translation (localized docs present, but untranslated)
44d6223
# Summary(fr):    FastAPI framework
44d6223
# Missing translation (localized docs present, but untranslated)
5b0d9b9
# Summary(id):    FastAPI framework
5b0d9b9
# Missing translation (localized docs present, but untranslated)
44d6223
# Summary(it):    FastAPI framework
44d6223
# Translation present, but the title was not translated
44d6223
%global sum_ja  FastAPI framework
03855a4
%global sum_ko  FastAPI 프레임워크
e2ce323
# Missing translation (localized docs present, but untranslated)
e2ce323
# %%global sum_pl  FastAPI framework
44d6223
%global sum_pt  Framework FastAPI
44d6223
# Missing translation (localized docs present, but untranslated)
44d6223
# %%global sum_ru  FastAPI framework
44d6223
# Missing translation (localized docs present, but untranslated)
44d6223
# %%global sum_sq  FastAPI framework
44d6223
# Missing translation (localized docs present, but untranslated)
44d6223
# %%global sum_tr  FastAPI framework
44d6223
# Missing translation (localized docs present, but untranslated)
44d6223
# %%global sum_uk  FastAPI framework
44d6223
%global sum_zh  FastAPI 框架
44d6223
44d6223
Name:           python-%{srcname}
c2c5ccb
Version:        0.67.0
1d4f7c9
Release:        %autorelease
44d6223
Summary:        %{sum_en}
9449886
9449886
License:        MIT
44d6223
URL:            https://github.com/tiangolo/%{srcname}
81e0188
Source0:        %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
9449886
BuildArch:      noarch
9449886
9449886
BuildRequires:  python3-devel
44d6223
BuildRequires:  pyproject-rpm-macros
44d6223
4a4e0b8
# Documentation
4a4e0b8
BuildRequires:  js-termynal
4a4e0b8
BuildRequires:  web-assets-devel
4a4e0b8
# For converting absolute symlinks in the buildroot to relative ones
4a4e0b8
BuildRequires:  symlinks
352bf21
# Would have been pulled in indirectly via mkdocs-material, but we have patched
352bf21
# that out:
352bf21
BuildRequires:  python3dist(pymdown-extensions)
4a4e0b8
44d6223
Summary(en):    %{sum_en}
fdbe48f
Summary(es):    %{sum_es}
43085cb
# Summary(de):    %%{sum_de}
44d6223
# Summary(fr):    %%{sum_fr}
5b0d9b9
# Summary(id):    %%{sum_id}
44d6223
# Summary(it):    %%{sum_it}
44d6223
Summary(ja):    %{sum_ja}
44d6223
Summary(ko):    %{sum_ko}
e2ce323
# Summary(pl):    %{sum_pl}
44d6223
Summary(pt):    %{sum_pt}
44d6223
# Summary(ru):    %%{sum_ru}
44d6223
# Summary(sq):    %%{sum_sq}
44d6223
# Summary(tr):    %%{sum_tr}
44d6223
# Summary(uk):    %%{sum_uk}
44d6223
Summary(zh):    %{sum_zh}
44d6223
44d6223
%global common_description_en %{expand:
44d6223
FastAPI is a modern, fast (high-performance), web framework for building APIs
44d6223
with Python 3.6+ based on standard Python type hints.
44d6223
44d6223
The key features are:
44d6223
44d6223
  • Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette
44d6223
    and Pydantic). One of the fastest Python frameworks available.
44d6223
44d6223
  • Fast to code: Increase the speed to develop features by about 200% to 300%.*
44d6223
  • Fewer bugs: Reduce about 40% of human (developer) induced errors.*
44d6223
  • Intuitive: Great editor support. Completion everywhere. Less time
44d6223
    debugging.
44d6223
  • Easy: Designed to be easy to use and learn. Less time reading docs.
44d6223
  • Short: Minimize code duplication. Multiple features from each parameter
44d6223
    declaration. Fewer bugs.
44d6223
  • Robust: Get production-ready code. With automatic interactive
44d6223
    documentation.
44d6223
  • Standards-based: Based on (and fully compatible with) the open standards
44d6223
    for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
44d6223
44d6223
* estimation based on tests on an internal development team, building production
44d6223
  applications.}
44d6223
%global common_description_es %{expand:
44d6223
FastAPI es un web framework moderno y rápido (de alto rendimiento) para
44d6223
construir APIs con Python 3.6+ basado en las anotaciones de tipos estándar de
44d6223
Python.
44d6223
44d6223
Sus características principales son:
44d6223
44d6223
  • Rapidez: Alto rendimiento, a la par con NodeJS y Go (gracias a
44d6223
    Starlette y Pydantic). Uno de los frameworks de Python más rápidos.
44d6223
44d6223
  • Rápido de programar: Incrementa la velocidad de desarrollo entre 200% y
44d6223
    300%.*
44d6223
  • Menos errores: Reduce los errores humanos (de programador) aproximadamente
44d6223
    un 40%.*
44d6223
  • Intuitivo: Gran soporte en los editores con auto completado en todas
44d6223
    partes. Gasta menos tiempo debugging.
44d6223
  • Fácil: Está diseñado para ser fácil de usar y aprender. Gastando menos
44d6223
    tiempo leyendo documentación.
44d6223
  • Corto: Minimiza la duplicación de código. Múltiples funcionalidades con
44d6223
    cada declaración de parámetros. Menos errores.
44d6223
  • Robusto: Crea código listo para producción con documentación automática
44d6223
    interactiva.
44d6223
  • Basado en estándares: Basado y totalmente compatible con los estándares
44d6223
    abiertos para APIs: OpenAPI (conocido previamente como Swagger) y JSON
44d6223
    Schema.
44d6223
44d6223
* Esta estimación está basada en pruebas con un equipo de desarrollo interno
44d6223
  contruyendo aplicaciones listas para producción.}
43085cb
#%%global common_description_de %%{expand:…}
44d6223
#%%global common_description_fr %%{expand:…}
5b0d9b9
#%%global common_description_id %%{expand:…}
44d6223
#%%global common_description_it %%{expand:…}
44d6223
%global common_description_ja %{expand:
44d6223
FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.6 以降でAPI
44d6223
を構築するための、モダンで、高速(高パフォーマンス)な、Web フレームワークです。
44d6223
44d6223
主な特徴:
44d6223
44d6223
  - 高速: NodeJS や Go 並みのとても高いパフォーマンス (Starlette と Pydantic
44d6223
    のおかげです)。最も高速な Python フレームワークの一つです。
44d6223
44d6223
  - 高速なコーディング: 開発速度を約 200%~300%向上させます。 *
44d6223
  - 少ないバグ: 開発者起因のヒューマンエラーを約 40%削減します。 *
44d6223
  - 直感的: 素晴らしいエディタのサポートや オートコンプリート。
44d6223
    デバッグ時間を削減します。
44d6223
  - 簡単: 簡単に利用、習得できるようにデザインされています。
44d6223
    ドキュメントを読む時間を削減します。
44d6223
  - 短い: コードの重複を最小限にしています。
44d6223
    各パラメータからの複数の機能。少ないバグ。
44d6223
  - 堅牢性:
44d6223
    自動対話ドキュメントを使用して、本番環境で使用できるコードを取得します。
44d6223
  - Standards-based: API
44d6223
    のオープンスタンダードに基づいており、完全に互換性があります: OpenAPI
44d6223
    (以前は Swagger として知られていました) や JSON スキーマ.
44d6223
44d6223
* 本番アプリケーションを構築している開発チームのテストによる見積もり。}
44d6223
%global common_description_ko %{expand:
44d6223
FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트에 기초한
44d6223
Python3.6+의 API를 빌드하기 위한 웹 프레임워크입니다.
44d6223
44d6223
주요 특징으로:
44d6223
44d6223
  • 빠름: (Starlette과 Pydantic 덕분에) NodeJS 및 Go와 대등할 정도로 매우 높은
44d6223
    성능. 사용 가능한 가장 빠른 파이썬 프레임워크 중 하나.
44d6223
44d6223
  • 빠른 코드 작성: 약 200%에서 300%까지 기능 개발 속도 증가.*
44d6223
  • 적은 버그: 사람(개발자)에 의한 에러 약 40% 감소.*
44d6223
  • 직관적: 훌륭한 편집기 지원. 모든 곳에서 자동완성. 적은 디버깅 시간.
44d6223
  • 쉬움: 쉽게 사용하고 배우도록 설계. 적은 문서 읽기 시간.
44d6223
  • 짧음: 코드 중복 최소화. 각 매개변수 선언의 여러 기능. 적은 버그.
44d6223
  • 견고함: 준비된 프로덕션 용 코드를 얻으세요. 자동 대화형 문서와 함께.
44d6223
  • 표준 기반: API에 대한 (완전히 호환되는) 개방형 표준 기반: OpenAPI (이전에
44d6223
    Swagger로 알려졌던) 및 JSON 스키마.
44d6223
44d6223
* 내부 개발팀의 프로덕션 애플리케이션을 빌드한 테스트에 근거한 측정}
e2ce323
#%%global common_description_pl %%{expand:…}
44d6223
%global common_description_pt %{expand:
44d6223
FastAPI é um moderno e rápido (alta performance) framework web para construção
44d6223
de APIs com Python 3.6 ou superior, baseado nos type hints padrões do Python.
44d6223
44d6223
Os recursos chave são:
44d6223
44d6223
  • Rápido: alta performance, equivalente a NodeJS e Go (graças ao Starlette e
44d6223
    Pydantic). Um dos frameworks mais rápidos disponíveis.
44d6223
  • Rápido para codar: Aumenta a velocidade para desenvolver recursos entre
44d6223
    200% a 300%.*
44d6223
  • Poucos bugs: Reduz cerca de 40% de erros induzidos por humanos
44d6223
    (desenvolvedores).*
44d6223
  • Intuitivo: Grande suporte a IDEs. Auto-Complete em todos os lugares. Menos
44d6223
    tempo debugando.
44d6223
  • Fácil: Projetado para ser fácil de aprender e usar. Menos tempo lendo
44d6223
    documentação.
44d6223
  • Enxuto: Minimize duplicação de código. Múltiplos recursos para cada
44d6223
    declaração de parâmetro. Menos bugs.
44d6223
  • Robusto: Tenha código pronto para produção. E com documentação interativa
44d6223
    automática.
44d6223
  • Baseado em padrões: Baseado em (e totalmente compatível com) os padrões
44d6223
    abertos para APIs: OpenAPI (anteriormente conhecido como Swagger) e JSON
44d6223
    Schema.
44d6223
44d6223
* estimativas baseadas em testes realizados com equipe interna de
44d6223
  desenvolvimento, construindo aplicações em produção.}
44d6223
#%%global common_description_ru %%{expand:…}
44d6223
#%%global common_description_sq %%{expand:…}
44d6223
#%%global common_description_tr %%{expand:…}
44d6223
#%%global common_description_uk %%{expand:…}
44d6223
%global common_description_zh %{expand:
44d6223
FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+
44d6223
并基于标准的 Python 类型提示。
44d6223
44d6223
关键特性:
44d6223
44d6223
  • 快速:可与 NodeJS 和 Go 比肩的极高性能(归功于 Starlette 和 Pydantic)。
44d6223
    最快的 Python web 框架之一。
44d6223
  • 高效编码:提高功能开发速度约 200% 至 300%。*
44d6223
  • 更少 bug:减少约 40% 的人为(开发者)导致错误。*
44d6223
  • 智能:极佳的编辑器支持。处处皆可自动补全,减少调试时间。
44d6223
  • 简单:设计的易于使用和学习,阅读文档的时间更短。
44d6223
  • 简短:使代码重复最小化。通过不同的参数声明实现丰富功能。bug 更少。
44d6223
  • 健壮:生产可用级别的代码。还有自动生成的交互式文档。
44d6223
  • 标准化:基于(并完全兼容)API 的相关开放标准:OpenAPI (以前被称为 Swagger)
44d6223
    和 JSON Schema。
44d6223
44d6223
* 根据对某个构建线上应用的内部开发团队所进行的测试估算得出。}
44d6223
44d6223
%description %{common_description_en}
44d6223
44d6223
%description -l en %{common_description_en}
44d6223
%description -l es %{common_description_es}
43085cb
#%%description -l de %%{common_description_de}
44d6223
#%%description -l fr %%{common_description_fr}
5b0d9b9
#%%description -l id %%{common_description_id}
44d6223
#%%description -l it %%{common_description_it}
44d6223
%description -l ja %{common_description_ja}
44d6223
%description -l ko %{common_description_ko}
e2ce323
#%%description -l pl %%{common_description_pl}
44d6223
%description -l pt %{common_description_pt}
44d6223
#%%description -l ru %%{common_description_ru}
44d6223
#%%description -l sq %%{common_description_sq}
44d6223
#%%description -l tr %%{common_description_tr}
44d6223
#%%description -l uk %%{common_description_uk}
44d6223
%description -l zh %{common_description_zh}
44d6223
44d6223
44d6223
%generate_buildrequires
44d6223
# Tests under tests/test_tutorial may require dependencies that are only in the
44d6223
# dev extra.
44d6223
%pyproject_buildrequires -x all,test,dev%{?with_html_docs:,doc}
44d6223
44d6223
44d6223
%pyproject_extras_subpkg -n python3-%{srcname} all
44d6223
44d6223
44d6223
%package -n     python3-%{srcname}
44d6223
Summary:        %{sum_en}
44d6223
44d6223
Summary(en):    %{sum_en}
44d6223
Summary(es):    %%{sum_es}
43085cb
# Summary(de):    %%{sum_de}
44d6223
# Summary(fr):    %%{sum_fr}
5b0d9b9
# Summary(id):    %%{sum_id}
44d6223
# Summary(it):    %%{sum_it}
44d6223
Summary(ja):    %{sum_ja}
44d6223
Summary(ko):    %{sum_ko}
e2ce323
# Summary(pl):    %%{sum_pl}
44d6223
Summary(pt):    %{sum_pt}
44d6223
# Summary(ru):    %%{sum_ru}
44d6223
# Summary(sq):    %%{sum_sq}
44d6223
# Summary(tr):    %%{sum_tr}
44d6223
# Summary(uk):    %%{sum_uk}
44d6223
Summary(zh):    %{sum_zh}
44d6223
44d6223
%description -n python3-%{srcname} %{common_description_en}
44d6223
44d6223
%description -n python3-%{srcname} -l en %{common_description_en}
44d6223
%description -n python3-%{srcname} -l es %{common_description_es}
43085cb
#%%description -n python3-%%{srcname} -l de %%{common_description_de}
44d6223
#%%description -n python3-%%{srcname} -l fr %%{common_description_fr}
5b0d9b9
#%%description -n python3-%%{srcname} -l id %%{common_description_id}
44d6223
#%%description -n python3-%%{srcname} -l it %%{common_description_it}
44d6223
%description -n python3-%{srcname} -l ja %{common_description_ja}
44d6223
%description -n python3-%{srcname} -l ko %{common_description_ko}
e2ce323
#%%description -n python3-%%{srcname} -l pl %%{common_description_pl}
44d6223
%description -n python3-%{srcname} -l pt %{common_description_pt}
44d6223
#%%description -n python3-%%{srcname} -l ru %%{common_description_ru}
44d6223
#%%description -n python3-%%{srcname} -l sq %%{common_description_sq}
44d6223
#%%description -n python3-%%{srcname} -l tr %%{common_description_tr}
44d6223
#%%description -n python3-%%{srcname} -l uk %%{common_description_uk}
44d6223
%description -n python3-%{srcname} -l zh %{common_description_zh}
44d6223
44d6223
44d6223
%package doc
44d6223
Summary:        Documentation for %{name}
44d6223
4a4e0b8
Requires:       js-termynal
4a4e0b8
44d6223
%description doc %{common_description_en}
44d6223
44d6223
%description doc -l en %{common_description_en}
44d6223
%description doc -l es %{common_description_es}
43085cb
#%%description doc -l de %%{common_description_de}
44d6223
#%%description doc -l fr %%{common_description_fr}
5b0d9b9
#%%description doc -l id %%{common_description_id}
44d6223
#%%description doc -l it %%{common_description_it}
44d6223
%description doc -l ja %{common_description_ja}
44d6223
%description doc -l ko %{common_description_ko}
e2ce323
#%%description doc -l pl %%{common_description_pl}
44d6223
%description doc -l pt %{common_description_pt}
44d6223
#%%description doc -l ru %%{common_description_ru}
44d6223
#%%description doc -l sq %%{common_description_sq}
44d6223
#%%description doc -l tr %%{common_description_tr}
44d6223
#%%description doc -l uk %%{common_description_uk}
44d6223
%description doc -l zh %{common_description_zh}
44d6223
9449886
9449886
%prep
44d6223
%autosetup -n %{srcname}-%{version} -p1
44d6223
44d6223
# Comment out all dependencies on orjson (for ORJSONResponse); it cannot be
44d6223
# packaged in Fedora until it builds with the stable Rust toolchain instead of
44d6223
# the nightly one. Note that this removes it from the “all” extra metapackage.
44d6223
#
44d6223
# Loosen all dependencies that are pinned to exact versions. We have to try to
44d6223
# work with what is packaged.
44d6223
#
44d6223
# Comment out test dependencies that are only for linting/formatting/analysis,
44d6223
# and will not be used.
44d6223
#
352bf21
# Comment out mkdocs-material, a theme we are patching out due to the
352bf21
# impracticality of bringing its packaging into compliance with Fedora
352bf21
# guidelines, and typer-cli, which is not really required to simply build the
352bf21
# documentation.
352bf21
#
44d6223
# Do not require async backport libraries where they are not needed
c2c5ccb
# (https://github.com/tiangolo/fastapi/pull/2613).
44d6223
#
44d6223
# Selectively loosen dependencies that are perhaps arbitrarily pinned to
44d6223
# certain version ranges: first, those for which we choose to allow newer
44d6223
# versions, and second, those for which we choose to allow older and newer
44d6223
# versions. This could have unwanted consequences, but such is the nature of
44d6223
# packaging.
44d6223
#
7011be5
# Allow aiofiles 0.7.x: https://github.com/tiangolo/fastapi/pull/2899
d06bef0
#
44d6223
# Replace passlib[bcrypt] with passlib and bcrypt separately, until
b7a1b51
# https://bugzilla.redhat.com/show_bug.cgi?id=1936021 is fixed (F35 and later).
44d6223
sed -r -i \
44d6223
    -e 's/("orjson\b.*",)/# \1/' \
44d6223
    -e 's/==/>=/g' \
44d6223
    -e 's/("(mypy|black|flake8|isort|autoflake)\b.*",)/# \1/' \
352bf21
    -e '/\b(mkdocs-material|typer-cli)\b/d' \
44d6223
    -e 's/("async_(exit_stack|generator)[^"]*)/\1; '"python_version < '3.7'/" \
43085cb
    -e 's/("(httpx\b|sqlalchemy\b|databases\[sqlite\]|mkdocs-markdownextradata-plugin|pytest(-cov)?)[^<"]*),[[:blank:]]*<[^"]*/\1/' \
352bf21
    -e 's/("(ujson))\b[^"]*/\1/' \
7011be5
    -e 's/("(aiofiles|)\b[^<"]*,[[:blank:]]*<0\.)6\.0/\18.0/' \
44d6223
    pyproject.toml
44d6223
44d6223
# Remove bundled js-termynal 0.0.1:
44d6223
find docs -type f -name 'termynal.*' |
44d6223
  while read -r fn
44d6223
  do
44d6223
    echo '' > "${fn}"  # make it an empty file
44d6223
  done
4a4e0b8
# In %%install, we will restore this functionality by symlinking the system
4a4e0b8
# copy.
9449886
352bf21
# Drop dependency on mkdocs-material. See
352bf21
# https://bugzilla.redhat.com/show_bug.cgi?id=1960274#c3. The result doesn’t
352bf21
# look as nice but is still usable.
352bf21
sed -r -i 's/\bmaterial\b/mkdocs/' docs/*/mkdocs.yml
352bf21
9449886
9449886
%build
44d6223
%pyproject_wheel
44d6223
%if %{with html_docs}
352bf21
for cfg in docs/*/mkdocs.yml
352bf21
do
352bf21
  pushd "$(dirname "${cfg}")"
352bf21
  mkdocs build
352bf21
  popd
352bf21
done
44d6223
%endif
44d6223
9449886
9449886
%install
44d6223
%pyproject_install
44d6223
%pyproject_save_files %{srcname}
44d6223
44d6223
install -t '%{buildroot}%{_pkgdocdir}' -D -m 0644 -p \
44d6223
    CONTRIBUTING.md README.md
44d6223
%if %{with html_docs}
352bf21
for cfg in docs/*/mkdocs.yml
352bf21
do
352bf21
  orig="$(dirname "${cfg}")"
352bf21
  dest="%{buildroot}%{_pkgdocdir}/$(basename "${orig}")"
0f098cd
  install -d "${dest}"
352bf21
  cp -rvp "${orig}/site" "${dest}/html"
352bf21
done
44d6223
%else
44d6223
cp -rp docs '%{buildroot}%{_pkgdocdir}/markdown'
44d6223
%endif
44d6223
4a4e0b8
# We do not own these files; we temporarily install them in the buildroot so we
4a4e0b8
# do not have dangling symlinks.
4a4e0b8
install -d "$(dirname '%{buildroot}%{_jsdir}')"
4a4e0b8
cp -rp %{_jsdir} %{buildroot}%{_jsdir}
4a4e0b8
4a4e0b8
# Replace truncated js-termynal files with relative symbolic links
4a4e0b8
find docs -type f -name 'termynal.*' |
4a4e0b8
  while read -r fn
4a4e0b8
  do
6b34e27
    ln -s -f "%{buildroot}%{_jsdir}/$(basename "${fn}")" "${fn}"
4a4e0b8
    symlinks -c -o "${fn}"
4a4e0b8
  done
4a4e0b8
12b5f93
rm -rf '%{buildroot}%{_jsdir}'
12b5f93
9449886
9449886
%check
44d6223
# Requires orjson:
24e0de6
#   tests/test_tutorial/test_custom_response/test_tutorial001b.py
44d6223
#   tests/test_default_response_class.py
44d6223
%pytest \
bb28785
    --ignore=tests/test_tutorial/test_custom_response/test_tutorial001b.py \
44d6223
    --ignore=tests/test_default_response_class.py
9449886
44d6223
44d6223
%files -n python3-%{srcname} -f %{pyproject_files}
9449886
%license LICENSE
9449886
%doc README.md
44d6223
44d6223
44d6223
%files doc
44d6223
%license LICENSE
44d6223
%{_pkgdocdir}
44d6223
9449886
9449886
%changelog
1d4f7c9
%autochangelog