[packages/python3-flasgger] - updated to 0.9.7.1 for python 3.6+; patched to support marshmallow 4
qboosh
qboosh at pld-linux.org
Mon Dec 29 18:39:16 CET 2025
commit b1d3ccb2970c51750d992a28d0136489c496315a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Dec 29 18:39:47 2025 +0100
- updated to 0.9.7.1 for python 3.6+; patched to support marshmallow 4
flasgger-marshmallow.patch | 54 ++++++++++++++
python-flasgger.spec | 170 ---------------------------------------------
python3-flasgger.spec | 86 +++++++++++++++++++++++
3 files changed, 140 insertions(+), 170 deletions(-)
---
diff --git a/python-flasgger.spec b/python-flasgger.spec
deleted file mode 100644
index 611a710..0000000
--- a/python-flasgger.spec
+++ /dev/null
@@ -1,170 +0,0 @@
-#
-# Conditional build:
-%bcond_without tests # unit tests
-%bcond_without python2 # CPython 2.x module
-%bcond_with python3 # CPython 3.x module (built from python3-flasgger.spec)
-
-Summary: Easy Swagger UI for your Flask API
-Summary(pl.UTF-8): Łatwe w użyciu UI Swagger dla API Flaska
-Name: python-flasgger
-# keep 0.9.5 here for python2 support
-Version: 0.9.5
-Release: 0.1
-License: MIT
-Group: Libraries/Python
-#Source0Download: https://pypi.org/simple/flasgger/
-Source0: https://files.pythonhosted.org/packages/source/f/flasgger/flasgger-%{version}.tar.gz
-# Source0-md5: 0b249888d2aa6732e8214a721f92b735
-URL: https://pypi.org/project/flasgger/
-%if %{with python2}
-BuildRequires: python-modules >= 1:2.7
-BuildRequires: python-setuptools
-%if %{with tests}
-BuildRequires: python-PyYAML >= 3.0
-BuildRequires: python-apispec
-BuildRequires: python-apispec-webframeworks
-BuildRequires: python-flask >= 0.10
-BuildRequires: python-flask-restful
-BuildRequires: python-flask_jwt
-BuildRequires: python-flex
-BuildRequires: python-jsonschema >= 3.0.1
-BuildRequires: python-mistune
-BuildRequires: python-pytest
-BuildRequires: python-six >= 1.10.0
-%endif
-%endif
-%if %{with python3}
-BuildRequires: python3-modules >= 1:3.6
-BuildRequires: python3-setuptools
-%if %{with tests}
-BuildRequires: python3-apispec
-BuildRequires: python3-apispec-webframeworks
-BuildRequires: python3-PyYAML >= 3.0
-BuildRequires: python3-flask >= 0.10
-BuildRequires: python3-flask-restful
-BuildRequires: python3-flex
-BuildRequires: python3-jsonschema >= 3.0.1
-BuildRequires: python3-mistune
-BuildRequires: python3-pytest
-BuildRequires: python3-six >= 1.10.0
-%endif
-%endif
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.714
-BuildRequires: sed >= 4.0
-Requires: python-modules >= 1:2.7
-BuildArch: noarch
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-
-%description
-Flasgger is a Flask extension to extract OpenAPI-Specification from
-all Flask views registered in your API.
-
-Flasgger also comes with SwaggerUI <http://swagger.io/swagger-ui/>
-embedded so you can access <http://localhost:5000/apidocs> and
-visualize and interact with your API resources.
-
-%description -l pl.UTF-8
-Flasgger to rozszerzenie Flaska do wydobywania specyfikacji OpenAPI ze
-wszystkich widoków Flaska zarejestrowanych w danym API.
-
-Flasgger ma także wbudowany interfejs użytkownika SwaggerUI
-<http://swagger.io/swagger-ui/>, dzięki czemu odwołując się do
-<http://localhost:5000/apidocs> można wizualizować i wykonywać
-interakcje z zasobami swojego API.
-
-%package -n python3-flasgger
-Summary: Easy Swagger UI for your Flask API
-Summary(pl.UTF-8): Łatwe w użyciu UI Swagger dla API Flaska
-Group: Libraries/Python
-Requires: python3-modules >= 1:3.6
-
-%description -n python3-flasgger
-Flasgger is a Flask extension to extract OpenAPI-Specification from
-all Flask views registered in your API.
-
-Flasgger also comes with SwaggerUI <http://swagger.io/swagger-ui/>
-embedded** so you can access <http://localhost:5000/apidocs> and
-visualize and interact with your API resources.
-
-%description -n python3-flasgger -l pl.UTF-8
-Flasgger to rozszerzenie Flaska do wydobywania specyfikacji OpenAPI ze
-wszystkich widoków Flaska zarejestrowanych w danym API.
-
-Flasgger ma także wbudowany interfejs użytkownika SwaggerUI
-<http://swagger.io/swagger-ui/>, dzięki czemu odwołując się do
-<http://localhost:5000/apidocs> można wizualizować i wykonywać
-interakcje z zasobami swojego API.
-
-%prep
-%setup -q -n flasgger-%{version}
-
-%build
-%if %{with python2}
-%py_build
-
-%if %{with tests}
-PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
-PYTEST_PLUGINS= \
-PYTHONPATH=$(pwd):$(pwd)/etc/flasgger_package \
-%{__python} -m pytest tests
-%endif
-%endif
-
-%if %{with python3}
-%py3_build
-
-%if %{with tests}
-PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
-PYTEST_PLUGINS= \
-PYTHONPATH=$(pwd):$(pwd)/etc/flasgger_package \
-%{__python3} -m pytest tests
-%endif
-%endif
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-%if %{with python2}
-%py_install
-
-%py_postclean
-%endif
-
-%if %{with python3}
-%py3_install
-%endif
-
-%if %{with python2}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/python-flasgger-%{version}
-cp -pr demo_app examples $RPM_BUILD_ROOT%{_examplesdir}/python-flasgger-%{version}
-%{__sed} -i -e '1s,/usr/bin/python$,%{__python},' \
- $RPM_BUILD_ROOT%{_examplesdir}/python-flasgger-%{version}/demo_app/app.py
-%endif
-%if %{with python3}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}
-cp -pr demo_app examples $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}
-%{__sed} -i -e '1s,/usr/bin/python$,%{__python3},' \
- $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}/demo_app/app.py
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%if %{with python2}
-%files
-%defattr(644,root,root,755)
-%doc LICENSE README.md
-%{py_sitescriptdir}/flasgger
-%{py_sitescriptdir}/flasgger-%{version}-py*.egg-info
-%{_examplesdir}/python-flasgger-%{version}
-%endif
-
-%if %{with python3}
-%files -n python3-flasgger
-%defattr(644,root,root,755)
-%doc LICENSE README.md
-%{py3_sitescriptdir}/flasgger
-%{py3_sitescriptdir}/flasgger-%{version}-py*.egg-info
-%{_examplesdir}/python3-flasgger-%{version}
-%endif
diff --git a/python3-flasgger.spec b/python3-flasgger.spec
new file mode 100644
index 0000000..5a2944e
--- /dev/null
+++ b/python3-flasgger.spec
@@ -0,0 +1,86 @@
+#
+# Conditional build:
+%bcond_without tests # unit tests
+
+Summary: Easy Swagger UI for your Flask API
+Summary(pl.UTF-8): Łatwe w użyciu UI Swagger dla API Flaska
+Name: python3-flasgger
+Version: 0.9.7.1
+Release: 1
+License: MIT
+Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/flasgger/
+Source0: https://files.pythonhosted.org/packages/source/f/flasgger/flasgger-%{version}.tar.gz
+# Source0-md5: 3f2d4b14b25b22a0e99008c6ad826ba4
+Patch0: flasgger-marshmallow.patch
+URL: https://pypi.org/project/flasgger/
+BuildRequires: python3-modules >= 1:3.6
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-apispec
+BuildRequires: python3-apispec-webframeworks
+BuildRequires: python3-PyYAML >= 3.0
+BuildRequires: python3-flask >= 0.10
+BuildRequires: python3-flask-restful
+BuildRequires: python3-flex
+BuildRequires: python3-jsonschema >= 3.0.1
+BuildRequires: python3-mistune
+BuildRequires: python3-pytest
+BuildRequires: python3-six >= 1.10.0
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: sed >= 4.0
+Requires: python3-modules >= 1:3.6
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Flasgger is a Flask extension to extract OpenAPI-Specification from
+all Flask views registered in your API.
+
+Flasgger also comes with SwaggerUI <http://swagger.io/swagger-ui/>
+embedded so you can access <http://localhost:5000/apidocs> and
+visualize and interact with your API resources.
+
+%description -l pl.UTF-8
+Flasgger to rozszerzenie Flaska do wydobywania specyfikacji OpenAPI ze
+wszystkich widoków Flaska zarejestrowanych w danym API.
+
+Flasgger ma także wbudowany interfejs użytkownika SwaggerUI
+<http://swagger.io/swagger-ui/>, dzięki czemu odwołując się do
+<http://localhost:5000/apidocs> można wizualizować i wykonywać
+interakcje z zasobami swojego API.
+
+%prep
+%setup -q -n flasgger-%{version}
+%patch -P0 -p1
+
+%build
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTHONPATH=$(pwd):$(pwd)/etc/flasgger_package \
+%{__python3} -m pytest tests
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}
+cp -pr demo_app examples $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}
+%{__sed} -i -e '1s,/usr/bin/python$,%{__python3},' \
+ $RPM_BUILD_ROOT%{_examplesdir}/python3-flasgger-%{version}/demo_app/app.py
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py3_sitescriptdir}/flasgger
+%{py3_sitescriptdir}/flasgger-%{version}-py*.egg-info
+%{_examplesdir}/python3-flasgger-%{version}
diff --git a/flasgger-marshmallow.patch b/flasgger-marshmallow.patch
new file mode 100644
index 0000000..9c6ae4c
--- /dev/null
+++ b/flasgger-marshmallow.patch
@@ -0,0 +1,54 @@
+--- flasgger-0.9.7.1/examples/marshmallow_apispec.py.orig 2020-12-23 10:11:59.000000000 +0100
++++ flasgger-0.9.7.1/examples/marshmallow_apispec.py 2025-12-25 20:58:24.567892832 +0100
+@@ -4,6 +4,7 @@ Another example using Marshmallow schema
+ # coding: utf-8
+
+ from flask import Flask, jsonify, request
++from marshmallow import validate
+
+ from flasgger import Schema, Swagger, SwaggerView, fields
+
+@@ -18,7 +19,7 @@ swag = Swagger(app)
+
+ class User(Schema):
+ username = fields.Str(required=True)
+- age = fields.Int(required=True, min=18)
++ age = fields.Int(required=True, validate=validate.Range(min=18))
+ tags = fields.List(fields.Str())
+
+
+--- flasgger-0.9.7.1/examples/swag_annotation.py.orig 2023-05-10 20:08:22.000000000 +0200
++++ flasgger-0.9.7.1/examples/swag_annotation.py 2025-12-26 19:50:53.781768847 +0100
+@@ -12,7 +12,7 @@ swag = {"swag": True,
+
+
+ class Body(Schema):
+- color = fields.List(fields.String(), required=True, validate=Length(max=5), example=["white", "blue", "red"])
++ color = fields.List(fields.String(), required=True, validate=Length(max=5), metadata={"example": ["white", "blue", "red"]})
+
+ def swag_validation_function(self, data, main_def):
+ self.load(data)
+--- flasgger-0.9.7.1/examples/validation.py.orig 2023-05-05 18:18:04.000000000 +0200
++++ flasgger-0.9.7.1/examples/validation.py 2025-12-26 21:55:23.001304611 +0100
+@@ -16,6 +16,7 @@ from flasgger import fields
+ from flasgger import swag_from
+ from flasgger import validate
+ from flasgger import utils
++from marshmallow.validate import Range
+
+ # Examples include intentionally invalid defaults to demonstrate validation.
+ _TEST_META_SKIP_FULL_VALIDATION = True
+@@ -146,10 +147,10 @@ def autovalidation_from_spec_dict():
+
+
+ class User(Schema):
+- username = fields.Str(required=True, default="Sirius Black")
++ username = fields.Str(required=True, dump_default="Sirius Black")
+ # wrong default "180" to force validation error
+- age = fields.Int(required=True, min=18, default="180")
+- tags = fields.List(fields.Str(), default=["wizard", "hogwarts", "dead"])
++ age = fields.Int(required=True, validate=Range(min=18), dump_default="180")
++ tags = fields.List(fields.Str(), dump_default=["wizard", "hogwarts", "dead"])
+
+
+ class UserPostView(SwaggerView):
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python3-flasgger.git/commitdiff/b1d3ccb2970c51750d992a28d0136489c496315a
More information about the pld-cvs-commit
mailing list