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
94 changes: 84 additions & 10 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,65 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
publish:

build-whl:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
exclude:
- os: windows-latest
python: "3.14"
- os: macos-latest
python: "3.8"
- os: macos-latest
python: "3.7"
- os: ubuntu-latest
python: "3.7"

steps:
- uses: actions/checkout@v4

- name: Install Python 3.14 with pyenv (if needed)
if: ${{ matrix.python == '3.14' }}
run: |
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pyenv install 3.14-dev
pyenv global 3.14-dev

- name: Setup Python
if: ${{ matrix.python != '3.14' }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install build tools
run: pip install build twine wheel

- name: Build wheel
run: python -m build --wheel

- name: Upload built packages
uses: actions/upload-artifact@v4
with:
name: pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
path: |
./dist/*.whl

build-sdist:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
Expand All @@ -19,11 +71,33 @@ jobs:
- name: Install build tools
run: pip install build twine wheel

- name: Build package
run: python -m build
- name: Build source distribution
run: python -m build --sdist

- name: Upload built packages
uses: actions/upload-artifact@v4
with:
name: pkg-sdist
path: |
./dist/*.tar.gz

publish:
needs: [build-whl, build-sdist]
runs-on: ubuntu-latest

environment:
name: release
url: https://pypi.org/project/flask-inputfilter

permissions:
id-token: write

steps:
- name: Download built packages
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*.tar.gz
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Changelog

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

[0.4.2] - 2025-04-25
--------------------

Added
^^^^^
- .whl generation for all major versions and envs.


[0.4.1] - 2025-04-24
--------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project = "flask-inputfilter"
copyright = "2025, Leander Cain Slotosch"
author = "Leander Cain Slotosch"
release = "0.4.1"
release = "0.4.2"

extensions = ["sphinx_rtd_theme", "sphinx_design"]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "flask_inputfilter"
version = "0.4.1"
version = "0.4.2"
description = "A library to easily filter and validate input data in Flask applications"
readme = "README.rst"
requires-python = ">=3.7"
Expand Down
18 changes: 13 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

if shutil.which("g++") is not None:
from Cython.Build import cythonize
from setuptools.extension import Extension

pyx_modules = [
"flask_inputfilter.Mixin._ExternalApiMixin",
"flask_inputfilter.Model._FieldModel",
"flask_inputfilter._InputFilter",
]

ext_modules = cythonize(
[
"flask_inputfilter/Mixin/_ExternalApiMixin.pyx",
"flask_inputfilter/Model/_FieldModel.pyx",
"flask_inputfilter/_InputFilter.pyx",
],
module_list=[Extension(
name=module,
sources=[module.replace('.', '/') + ".pyx"],
extra_compile_args=["-std=c++11"],
language="c++"
) for module in pyx_modules],
language_level=3,
)
options = {
Expand Down