Skip to content

Commit f8f04fa

Browse files
committed
Finalize version 0.4.0 and update docs
1 parent 3d9501a commit f8f04fa

File tree

10 files changed

+116
-12
lines changed

10 files changed

+116
-12
lines changed

.github/workflows/test-lib-building.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,25 @@ jobs:
3030
- name: Install built library
3131
run: pip install "$(ls dist/*.tar.gz | head -n 1)[optional]"
3232

33-
- name: Verify library usage - Part I
33+
- name: Verify library usage - Part I - installation
3434
run: |
3535
python -c "import flask_inputfilter.InputFilter"
3636
python -c "from flask_inputfilter import InputFilter"
3737
38-
- name: Verify library usage - Part II
38+
- name: Verify library usage - Part II - functional test
3939
run: pytest tests/
4040

41+
- name: Verify library usage - Part III - correct version
42+
run: |
43+
output=$(python -c "from flask_inputfilter import InputFilter; print(InputFilter)")
44+
45+
if [ "$output" = "<class 'flask_inputfilter.InputFilter.InputFilter'>" ]; then
46+
echo "Test passed: Correct class returned"
47+
else
48+
echo "Test failed: Unexpected output - $output"
49+
exit 1
50+
fi
51+
4152
build-and-test-cython:
4253
runs-on: ubuntu-latest
4354

@@ -61,10 +72,21 @@ jobs:
6172
- name: Install built library
6273
run: pip install "$(ls dist/*.tar.gz | head -n 1)[optional]"
6374

64-
- name: Verify library usage - Part I
75+
- name: Verify library usage - Part I - installation
6576
run: |
6677
python -c "import flask_inputfilter.InputFilter"
6778
python -c "from flask_inputfilter import InputFilter"
6879
69-
#- name: Verify library usage - Part II
70-
# run: pytest tests/
80+
- name: Verify library usage - Part II - functional test
81+
run: pytest tests/
82+
83+
- name: Verify library usage - Part III - correct version
84+
run: |
85+
output=$(python -c "from flask_inputfilter import InputFilter; print(InputFilter)")
86+
87+
if [ "$output" = "<class 'flask_inputfilter._InputFilter.InputFilter'>" ]; then
88+
echo "Test passed: Correct class returned"
89+
else
90+
echo "Test failed: Unexpected output - $output"
91+
exit 1
92+
fi

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ include LICENSE
33
include docs/source/changelog.rst
44
recursive-include flask_inputfilter *.py *.pyx *.c *.cpp
55
prune tests
6+
recursive-prune __pycache__

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Definition
6767
6868
class UpdateZipcodeInputFilter(InputFilter):
6969
def __init__(self):
70+
super().__init__()
7071
7172
self.add(
7273
'id',

docs/source/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Changelog
33

44
All notable changes to this project will be documented in this file.
55

6+
[0.4.0] - 2025-04-20
7+
--------------------
8+
9+
10+
11+
612
[0.4.0a2] - 2025-04-17
713
----------------------
814

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
project = "flask-inputfilter"
22
copyright = "2025, Leander Cain Slotosch"
33
author = "Leander Cain Slotosch"
4-
release = "0.4.0a2"
4+
release = "0.4.0"
55

6-
extensions = ["sphinx_rtd_theme"]
6+
extensions = ["sphinx_rtd_theme", "sphinx_design"]
77

88
templates_path = []
99
exclude_patterns = []

docs/source/guides/compile.rst

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Use compiled version
2+
====================
3+
4+
By default the pure python version of the lib is used as a fallback.
5+
6+
Getting started
7+
---------------
8+
9+
To use the compiled version you will first need the cython module,
10+
you can install the corresponding version by also installing the
11+
``[compile]`` dependencies of the library.
12+
13+
.. code-block:: bash
14+
15+
pip install flask-inputfilter[compile]
16+
17+
Secondly, you will need the c++ compiler.
18+
19+
Normally this is already installed on your system, but if not,
20+
depending on your os, you can use:
21+
22+
.. grid:: 1
23+
:gutter: 2
24+
25+
.. grid-item::
26+
.. card:: Linux
27+
28+
Install the gcc compiler using apt.
29+
30+
.. code-block:: bash
31+
32+
sudo apt install g++
33+
34+
.. grid-item::
35+
.. card:: MacOS
36+
37+
Either install the Xcode command line tools or use homebrew:
38+
39+
.. code-block:: bash
40+
41+
xcode-select --install g++
42+
43+
.. code-block:: bash
44+
45+
brew install g++
46+
47+
.. grid-item::
48+
.. card:: Windows
49+
50+
1. Download MinGW:
51+
https://www.mingw-w64.org
52+
2. Install and add ``g++.exe`` to PATH.
53+
54+
If you have the c++ compiler installed and reinstall the library,
55+
with or without the ``[compile]`` flag, depending if you already installed it,
56+
it will automatically compile the files, that offer an optimized version.
57+
58+
After these steps you can use the library normally and should not get the warning in the console.
59+
60+
Verify Installation
61+
-------------------
62+
63+
If you followed the steps above, you should not see the warning message in the console.
64+
65+
Additionally, you can verify if the compiled versions are
66+
being used by running the following commands:
67+
68+
.. code-block:: bash
69+
70+
python -c "import flask_inputfilter"
71+
python -c "InputFilter"
72+
73+
If the result is ``<class 'flask_inputfilter._InputFilter.InputFilter'>``,
74+
the compiled version is being used.

docs/source/guides/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Guides
77

88
create_own_components
99
frontend_validation
10+
compile

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Available functions:
3333

3434
.. note::
3535

36-
If you like the project, please consider giving it a star on GitHub.
36+
If you like the project, please consider giving it a star on `GitHub <https://github.com/LeanderCS/flask-inputfilter>`_.
3737

3838
Installation
3939
------------

flask_inputfilter/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
else:
1818
logging.getLogger(__name__).warning(
19-
"Cython is not installed and g++ is not available. "
20-
"Falling back to pure Python implementation. "
21-
"Consider installing Cython and g++ for better performance."
19+
"Cython or g++ not available. Falling back to pure Python implementation.\n"
20+
"Consult docs for better performance: https://leandercs.github.io/flask-inputfilter/guides/compile.html"
2221
)
2322
from .InputFilter import InputFilter

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "flask_inputfilter"
7-
version = "0.4.0a2"
7+
version = "0.4.0"
88
description = "A library to easily filter and validate input data in Flask applications"
99
readme = "README.rst"
1010
requires-python = ">=3.7"

0 commit comments

Comments
 (0)