Skip to main content

Restx-Monkey

codecov

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.

Installation

To install restx_monkey, use pip:

python -m pip install -U restx-monkey

Usage

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

What is patched?

Here is list of patches applied to flask-restx package by this monkey:

  • replace_parse_rule - injects parse_rule method into werkzeug because flask-restx is using this internal method
  • fix_restx_api - fix deprecated flask-restx.api.Api init of doc endpoints after blueprint is bound
  • fix_restx_parser - replace failing flask_restx.reqparse.Argument class with child whom can correctly handle json location of argument in flask.Request even in HTTP GET 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__ to flask and werkzeug for 3.0+ where the version was removed

Goal of project

Keep flask-restx compatible with the latest flask and werkzeug as long as it is reasonable simple to monkey patch it.

What this project is not

This project does not solve incompatibilities of other python packages using flask-restx.

Tests

You can run tests with coverage tracing:

python -m coverage run -m unittest tests/test_* -v 

To generate coverage report:

python -m coverage html   

Build

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/* 
    

Metadata

Release files for restx-monkey 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for restx-monkey 0.6.1
File Size Uploaded
restx-monkey-0.6.1.tar.gz 2.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for restx-monkey 0.6.1
File Interpreter ABI Platform
restx_monkey-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 MB

Release files / restx-monkey-0.6.1.tar.gz

Download URL restx-monkey-0.6.1.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
bd46c1659e206c43b63af6d48d440b7c6e20c147594d5cc28451f2978545d09e
BLAKE2b-256 checksum
How to use checksums
964f2ac99e185a62548c22f5ba815851170b50b604b8a9180b53b7900d9fae5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / restx_monkey-0.6.1-py3-none-any.whl

Download URL restx_monkey-0.6.1-py3-none-any.whl
Size 2.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2060f9887717ac296f4952eca78fe8034677508d424ed2d74fe1527d10788bbc
BLAKE2b-256 checksum
How to use checksums
fe20d66a3b16443a096da061bae99903c4554e26d34e6dd9c41538042e520b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page