Skip to content

Commit e643b44

Browse files
committed
31 | Use compiled version of InputFilter class in lib to increase speed
1 parent 1f2dbda commit e643b44

File tree

12 files changed

+51
-12
lines changed

12 files changed

+51
-12
lines changed

.github/workflows/publish-to-pypi.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ jobs:
1818
python-version: 3.9
1919

2020
- name: Install build tools
21-
run: pip install build twine wheel
21+
run: pip install build twine wheel cython
2222

23-
- name: Build package
24-
run: python setup.py sdist bdist_wheel
23+
- name: Compile and Build package
24+
run: |
25+
python setup.py build_ext --inplace
26+
python setup.py sdist bdist_wheel
2527
2628
- name: Publish to PyPI
2729
env:

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ jobs:
2121

2222
- name: Install build tools and test dependencies
2323
run: |
24-
pip install build pytest
24+
pip install build pytest cython
25+
26+
- name: Compile Cython code
27+
run: |
28+
python setup.py build_ext --inplace
2529
2630
- name: Build the library
2731
run: |
32+
ls -la flask_inputfilter
2833
python -m build
2934
id: build
3035

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,5 @@ cython_debug/
158158
.vscode/
159159
.DS_Store
160160
_build
161+
162+
*.c

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
include README.rst
22
include LICENSE
33
include docs/changelog.rst
4+
include flask_inputfilter/*.py
5+
include flask_inputfilter/*.pyx
6+
include flask_inputfilter/*.pxd

docs/changelog.rst

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

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

6+
[0.2.0] - 2025-03-26
7+
--------------------
8+
9+
Changed
10+
^^^^^^^
11+
- Uses compiled version of InputFilter class to increase speed drastically.
12+
13+
614
[0.1.0] - 2025-03-26
715
--------------------
816

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project = "flask-inputfilter"
22
copyright = "2025, Leander Cain Slotosch"
33
author = "Leander Cain Slotosch"
4-
release = "0.1.0"
4+
release = "0.2.0"
55

66
extensions = ["sphinx_rtd_theme"]
77

flask_inputfilter/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
from .InputFilter import InputFilter
1+
try:
2+
from .InputFilter import InputFilter
3+
except ImportError:
4+
import pyximport
5+
6+
pyximport.install()
7+
from .InputFilter import InputFilter

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
2+
requires = ["setuptools", "wheel", "Cython"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.black]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ autoflake
22
black
33
coverage
44
coveralls
5+
cython
56
docformatter
67
flake8==4.0.0
78
flask==2.1

0 commit comments

Comments
 (0)