Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-lib-building.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
python test_script.py

- name: Verify library usage - Part II
run: pytest test/
run: pytest tests/
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Exit immediately if a variable is not defined.

docker run --rm -e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest test/ && coveralls"
docker run --rm -e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest tests/ && coveralls"

- name: Run code style checks
run: |
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ WORKDIR /app

RUN apt-get update && apt-get install -y gcc python3-dev git

RUN pip install --upgrade pip
COPY pyproject.toml /app

COPY requirements.txt /app

RUN pip install --no-cache-dir -r requirements.txt
RUN python -m pip install .[dev]

COPY . /app

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include docs/index.rst
include LICENSE
include docs/changelog.rst
prune tests
6 changes: 2 additions & 4 deletions env_configs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ RUN /root/.pyenv/bin/pyenv install 3.14-dev

RUN /root/.pyenv/bin/pyenv global 3.7.12 3.8.12 3.9.7 3.10.2 3.11.0 3.12.0 3.13.0 3.14-dev

RUN pip install --upgrade pip
COPY pyproject.toml /app

COPY ../requirements.txt /app

RUN pip install --no-cache-dir -r requirements.txt && pip install tox
RUN python -m pip install .[dev] && python -m pip install tox

COPY .. /app
59 changes: 58 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,63 @@
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "flask_inputfilter"
version = "0.3.0"
description = "A library to easily filter and validate input data in Flask applications"
readme = "README.rst"
requires-python = ">=3.7"
license = {text = "MIT"}
authors = [
{name = "Leander Cain Slotosch", email = "[email protected]"}
]
dependencies = [
"flask>=2.1",
"typing_extensions>=3.6.2",
]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.7",
]

[project.optional-dependencies]
dev = [
"autoflake",
"black",
"coverage",
"coveralls",
#"docformatter",
"flake8==5.0.4",
"flake8-pyproject==1.2.3",
"isort",
"pillow>=8.0.0",
"pytest",
"requests>=2.22.0",
"sphinx",
"sphinx-autobuild",
"sphinx_rtd_theme"
]
optional = [
"pillow>=8.0.0",
"requests>=2.22.0",
]

[project.urls]
Homepage = "https://github.com/LeanderCS/flask-inputfilter"
Documentation = "https://leandercs.github.io/flask-inputfilter"
Source = "https://github.com/LeanderCS/flask-inputfilter"
Issues = "https://github.com/LeanderCS/flask-inputfilter/issues"

[tool.setuptools.packages.find]
include = ["flask_inputfilter"]

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning"
Expand All @@ -24,7 +81,7 @@ commands =
source = ["flask_inputfilter"]

[tool.coverage.report]
omit = ["__init__.py", "setup.py", "*/test/*"]
omit = ["__init__.py", "setup.py", "*/tests/*"]

[tool.flake8]
exclude = ["__init__.py", "venv", "*.md", ".*"]
Expand Down
15 changes: 0 additions & 15 deletions requirements.txt

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions test/test_filter.py → tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_base64_image_downscale_filter(self) -> None:
filters=[Base64ImageDownscaleFilter(size=144)],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
validated_data = self.inputFilter.validateData(
{"image": file.read()}
)
Expand All @@ -96,7 +96,7 @@ def test_base64_image_downscale_filter(self) -> None:
).size
self.assertEqual(size, (12, 12))

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
validated_data = self.inputFilter.validateData(
{
"image": Image.open(
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_base64_image_size_reduce_filter(self) -> None:
filters=[Base64ImageResizeFilter(max_size=1024)],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
validated_data = self.inputFilter.validateData(
{"image": file.read()}
)
Expand All @@ -138,7 +138,7 @@ def test_base64_image_size_reduce_filter(self) -> None:
size = buffer.tell()
self.assertLessEqual(size, 1024)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
validated_data = self.inputFilter.validateData(
{
"image": Image.open(
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions test/test_validator.py → tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def test_is_base64_image_validator(self) -> None:
"image", required=True, validators=[IsBase64ImageValidator()]
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
self.inputFilter.validateData({"image": file.read()})

with self.assertRaises(ValidationError):
Expand Down Expand Up @@ -885,7 +885,7 @@ def test_is_horizontally_image_validator(self) -> None:
"image", validators=[IsHorizontalImageValidator()]
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
self.inputFilter.validateData({"image": file.read()})

with self.assertRaises(ValidationError):
Expand All @@ -901,7 +901,7 @@ def test_is_horizontally_image_validator(self) -> None:
validators=[IsHorizontalImageValidator()],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
self.inputFilter.validateData({"horizontally_image": file.read()})

self.inputFilter.add(
Expand All @@ -914,7 +914,7 @@ def test_is_horizontally_image_validator(self) -> None:
validators=[IsHorizontalImageValidator()],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
with self.assertRaises(ValidationError):
self.inputFilter.validateData(
{"vertically_image": file.read()}
Expand Down Expand Up @@ -1265,7 +1265,7 @@ def test_is_vertically_image_validator(self) -> None:

self.inputFilter.add("image", validators=[IsVerticalImageValidator()])

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
self.inputFilter.validateData({"image": file.read()})

with self.assertRaises(ValidationError):
Expand All @@ -1281,7 +1281,7 @@ def test_is_vertically_image_validator(self) -> None:
validators=[IsVerticalImageValidator()],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
with self.assertRaises(ValidationError):
self.inputFilter.validateData(
{"horizontally_image": file.read()}
Expand All @@ -1297,7 +1297,7 @@ def test_is_vertically_image_validator(self) -> None:
validators=[IsVerticalImageValidator()],
)

with open("test/data/base64_image.txt", "r") as file:
with open("tests/data/base64_image.txt", "r") as file:
self.inputFilter.validateData({"vertically_image": file.read()})

with self.assertRaises(ValidationError):
Expand Down