Use compiled version
By default the pure python version of the lib is used as a fallback. Using the compiled version is not mandatory but highly advised and will give you a performance boost.
Getting started
To use the compiled version you will first need the cython module,
you can install the corresponding version by also installing the
[compile]
dependencies of the library.
pip install flask-inputfilter[compile]
Secondly, you will need the c++ compiler.
Normally this is already installed on your system, but if not, depending on your os, you can use:
Install the gcc compiler using apt.
sudo apt install g++
Either install the Xcode command line tools or use homebrew:
xcode-select --install g++
brew install g++
- Download MinGW:
Install and add
g++.exe
to PATH.
If you have the c++ compiler installed and reinstall the library,
with or without the [compile]
flag, depending if you already installed it,
it will automatically compile the files, that offer an optimized version.
After these steps you can use the library normally and should not get the warning in the console.
Verify Installation
If you followed the steps above, you should not see the warning message in the console.
Additionally, you can verify if the compiled versions are being used by running the following commands:
python -c "import flask_inputfilter"
python -c "InputFilter"
If the result is <class 'flask_inputfilter._InputFilter.InputFilter'>
,
the compiled version is being used.