Skip to content

Commit 0a812ce

Browse files
authored
Merge pull request #46 from LeanderCS/45
45 | Implement first parts in cython
2 parents eadb584 + 8ad8095 commit 0a812ce

37 files changed

+543
-416
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ include docs/source/index.rst
22
include LICENSE
33
include docs/source/changelog.rst
44
recursive-include flask_inputfilter *.py *.pyx *.c *.cpp
5+
recursive-include flask_inputfilter/include *.h
56
prune tests
67
recursive-prune __pycache__

docs/source/changelog.rst

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

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

6+
[0.4.1] - 2025-04-24
7+
--------------------
8+
9+
Changed
10+
^^^^^^^
11+
- Introduced first c++ vector in ``InputFilter`` to improve performance.
12+
- Updated required ``cython`` version to 3.0 or higher for python 3.7 - 3.11.
13+
- Moved static methods outside of pure InputFilter class.
14+
15+
616
[0.4.0] - 2025-04-20
717
--------------------
818

docs/source/guides/create_own_components.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Example implementation
3131

3232
.. code-block:: python
3333
34-
from typing import Any, Dict
34+
from typing import Any
3535
3636
from flask_inputfilter.Condition import BaseCondition
3737
@@ -45,7 +45,7 @@ Example implementation
4545
self.first_field = first_field
4646
self.second_field = second_field
4747
48-
def check(self, data: Dict[str, Any]) -> bool:
48+
def check(self, data: dict[str, Any]) -> bool:
4949
return data.get(self.first_field) == data.get(self.second_field)
5050
5151
@@ -69,7 +69,7 @@ Example implementation
6969
.. code-block:: python
7070
7171
from datetime import date, datetime
72-
from typing import Any, Union
72+
from typing import Any
7373
7474
from flask_inputfilter.Filter import BaseFilter
7575
@@ -80,7 +80,7 @@ Example implementation
8080
Supports ISO 8601 formatted strings.
8181
"""
8282
83-
def apply(self, value: Any) -> Union[datetime, Any]:
83+
def apply(self, value: Any) -> datetime|Any:
8484
if isinstance(value, datetime):
8585
return value
8686
@@ -94,8 +94,7 @@ Example implementation
9494
except ValueError:
9595
return value
9696
97-
else:
98-
return value
97+
return value
9998
10099
101100
Validator
@@ -116,7 +115,7 @@ Example implementation
116115

117116
.. code-block:: python
118117
119-
from typing import Any, List, Optional
118+
from typing import Any, Optional
120119
121120
from flask_inputfilter.Exception import ValidationError
122121
from flask_inputfilter.Validator import BaseValidator
@@ -129,7 +128,7 @@ Example implementation
129128
130129
def __init__(
131130
self,
132-
haystack: List[Any],
131+
haystack: list[Any],
133132
strict: bool = False,
134133
error_message: Optional[str] = None,
135134
) -> None:

docs/source/options/copy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Basic Copy Integration
4444
def test_route():
4545
validated_data = g.validated_data
4646
47-
# Cotains the same value as username but escaped eg. "very-important-user"
47+
# Contains the same value as username but escaped eg. "very-important-user"
4848
print(validated_data["escapedUsername"])
4949
5050

env_configs/cython.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ FROM python:3.7-slim
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y g++ git
5+
RUN apt-get update \
6+
&& apt-get install -y g++ git \
7+
&& apt-get clean
68

79
COPY pyproject.toml /app
810

env_configs/env.Dockerfile

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@ FROM debian:buster-slim
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y \
6-
build-essential \
7-
curl \
8-
g++ \
9-
git \
10-
libbz2-dev \
11-
libffi-dev \
12-
libjpeg-dev \
13-
liblzma-dev \
14-
libncurses5-dev \
15-
libncursesw5-dev \
16-
libreadline-dev \
17-
libsqlite3-dev \
18-
libssl-dev \
19-
llvm \
20-
make \
21-
python3-dev \
22-
tk-dev \
23-
wget \
24-
xz-utils \
25-
zlib1g-dev
5+
RUN apt-get update \
6+
&& apt-get install -y \
7+
build-essential \
8+
curl \
9+
g++ \
10+
git \
11+
libbz2-dev \
12+
libffi-dev \
13+
libjpeg-dev \
14+
liblzma-dev \
15+
libncurses5-dev \
16+
libncursesw5-dev \
17+
libreadline-dev \
18+
libsqlite3-dev \
19+
libssl-dev \
20+
llvm \
21+
make \
22+
python3-dev \
23+
tk-dev \
24+
wget \
25+
xz-utils \
26+
zlib1g-dev \
27+
&& apt-get clean
2628

2729
RUN curl https://pyenv.run | bash
2830

2931
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:/root/.pyenv/versions/3.7.12/bin:$PATH"
30-
RUN echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bashrc
31-
RUN echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
32-
RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc
33-
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
32+
RUN echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bashrc \
33+
&& echo 'eval "$(pyenv init --path)"' >> ~/.bashrc \
34+
&& echo 'eval "$(pyenv init -)"' >> ~/.bashrc \
35+
&& echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
3436

3537
RUN /root/.pyenv/bin/pyenv install 3.7.12
3638
RUN /root/.pyenv/bin/pyenv install 3.8.12

env_configs/pure.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ FROM python:3.7-slim
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y git
5+
RUN apt-get update \
6+
&& apt-get install -y git \
7+
&& apt-get clean
68

79
COPY pyproject.toml /app
810

env_configs/requirements-py310.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cython==0.29.24
1+
cython==3.0
22
flask==2.1
33
pillow==8.0.0
44
pytest

env_configs/requirements-py311.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cython==0.29.32
1+
cython==3.0
22
flask==2.1
33
pillow==8.0.0
44
pytest

env_configs/requirements-py37.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cython==0.29
1+
cython==3.0
22
flask==2.1
33
pillow==8.0.0
44
pytest

0 commit comments

Comments
 (0)