Monkey patches for unmaintained flask-restx python package to keep your installation of flask-restx compatible with the latest flask and werkzeug.
Good NEWS everyone! Package flask-restx is maintained now! I strongly suggest to submit issues on official project issues page.
To install restx_monkey, use pip:
python -m pip install -U restx-monkey
Before importing flask-restx
apply all patches in your main module:
# app main file
import restx_monkey as monkey
monkey.patch_restx()
# after patch import other modules
import flask_restx
# your other code
or select which patches you do not want to apply
# app main file
import restx_monkey as monkey
monkey.patch_restx(fix_restx_api=False)
# after patch import other modules
import flask_restx
# your other code
Here is list of patches applied to flask-restx package by this monkey:
- replace_parse_rule - injects
parse_rule
method into werkzeug becauseflask-restx
is using this internal method - fix_restx_api - fix deprecated
flask-restx.api.Api
init ofdoc
endpoints after blueprint is bound - fix_restx_parser - replace failing
flask_restx.reqparse.Argument
class with child whom can correctly handlejson
location of argument inflask.Request
even in HTTPGET
callback - update_swagger_ui - replace content of
flask_restx.static
directory with the later swagger UI then restx < 1.0 - fix_endpoint_from_view - fix
flask.scaffold
missing_endpoint_from_view_func
- inject_versions - puts back
__version__
toflask
andwerkzeug
for3.0+
where the version was removed
Keep flask-restx compatible with the latest flask and werkzeug as long as it is reasonable simple to monkey patch it.
This project does not solve incompatibilities of other python packages using flask-restx.
You can run tests with coverage tracing:
python -m coverage run -m unittest tests/test_* -v
To generate coverage report:
python -m coverage html
Clone repo and set up your pypi repo account credentials on build for build environment.
-
Move to package repo:
cd ~/git/restx_monkey
-
Install requirements:
python -m pip install -Ur requirements.txt
-
Clean old build fragments:
rm -rf ./dist ./build ./src/restx_monkey.egg-info
-
Build new package:
python -m build
-
Upload new package:
python -m twine upload dist/*