Add support for free-threaded builds (#70)
* Build free-threaded wheels, disable limited API there Co-authored-by: Min RK <151929+minrk@users.noreply.github.com> * Try installing libffi-dev on Linux It's faling due to lack of includes. Presumably because the lack of cffi wheels. * Revert "Try installing libffi-dev on Linux" Does not work. * Merge * Actually build FT * support the free-threaded build of Python 3.14 (#93) * support the free-threaded build of Python 3.14 * attempt to get 3.14t CI to run * Add trove classifier * Add changelog * Add 3.14 trove classifier, too --------- Co-authored-by: Hynek Schlawack <hs@ox.cx> --------- Co-authored-by: Min RK <151929+minrk@users.noreply.github.com> Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
This commit is contained in:
parent
3ed9734847
commit
1aad4747f9
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -29,6 +29,7 @@ jobs:
|
|||||||
- "3.12"
|
- "3.12"
|
||||||
- "3.13"
|
- "3.13"
|
||||||
- "3.14"
|
- "3.14"
|
||||||
|
- "3.14t"
|
||||||
- "pypy-3.9"
|
- "pypy-3.9"
|
||||||
- "pypy-3.10"
|
- "pypy-3.10"
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ jobs:
|
|||||||
|
|
||||||
echo TOX_PYTHON=$V >>$GITHUB_ENV
|
echo TOX_PYTHON=$V >>$GITHUB_ENV
|
||||||
|
|
||||||
- run: python -Im tox run -f $TOX_PYTHON
|
- run: python -Im tox run -e $TOX_PYTHON
|
||||||
|
|
||||||
system-package:
|
system-package:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/wheels.yml
vendored
2
.github/workflows/wheels.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
# See pyproject.toml for config.
|
# See pyproject.toml for config.
|
||||||
- uses: pypa/cibuildwheel@v3.0
|
- uses: pypa/cibuildwheel@v3.1
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@ -25,6 +25,9 @@ Vendoring Argon2 @ [**`f57e61e`**](https://github.com/P-H-C/phc-winner-argon2/co
|
|||||||
- Official Python 3.12, 3.13, and 3.14 support.
|
- Official Python 3.12, 3.13, and 3.14 support.
|
||||||
No code or packaging changes were necessary.
|
No code or packaging changes were necessary.
|
||||||
|
|
||||||
|
- Support for free-threading (aka nogil) on Python 3.14.
|
||||||
|
[#93](https://github.com/hynek/argon2-cffi-bindings/pull/93)
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
requires = [
|
requires = [
|
||||||
"setuptools>=77",
|
"setuptools>=77",
|
||||||
"setuptools_scm[toml]>=6.2",
|
"setuptools_scm[toml]>=6.2",
|
||||||
"cffi>=1.0.1",
|
"cffi>=1.0.1; python_version < '3.14'",
|
||||||
|
"cffi>=2.0.0b1; python_version >= '3.14'",
|
||||||
]
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
@ -30,13 +31,18 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Programming Language :: Python :: 3.13",
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
|
"Programming Language :: Python :: Free Threading",
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
"Topic :: Security :: Cryptography",
|
"Topic :: Security :: Cryptography",
|
||||||
"Topic :: Security",
|
"Topic :: Security",
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
]
|
]
|
||||||
dependencies = ["cffi>=1.0.1"]
|
dependencies = [
|
||||||
|
"cffi>=1.0.1; python_version < '3.14'",
|
||||||
|
"cffi>=2.0.0b1; python_version >= '3.14'",
|
||||||
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
tests = ["pytest"]
|
tests = ["pytest"]
|
||||||
@ -61,6 +67,7 @@ local_scheme = "no-local-version"
|
|||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
build = [
|
build = [
|
||||||
"cp39-*" , # We have portable abi3 wheels.
|
"cp39-*" , # We have portable abi3 wheels.
|
||||||
|
"cp314t-*", # Free-threading / nogil.
|
||||||
"pp310-*", # PyPy 3.9 is EOL and doesn't build on Windows anymore.
|
"pp310-*", # PyPy 3.9 is EOL and doesn't build on Windows anymore.
|
||||||
]
|
]
|
||||||
enable = ["pypy"]
|
enable = ["pypy"]
|
||||||
|
|||||||
7
setup.py
7
setup.py
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
import sysconfig
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
@ -17,7 +18,11 @@ if platform.python_implementation() == "CPython":
|
|||||||
|
|
||||||
class BDistWheel(bdist_wheel):
|
class BDistWheel(bdist_wheel):
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
self.py_limited_api = f"cp3{sys.version_info[1]}"
|
# Free-threaded CPython doesn't support limited API.
|
||||||
|
if sysconfig.get_config_var("Py_GIL_DISABLED"):
|
||||||
|
self.py_limited_api = False
|
||||||
|
else:
|
||||||
|
self.py_limited_api = f"cp3{sys.version_info[1]}"
|
||||||
|
|
||||||
super().finalize_options()
|
super().finalize_options()
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import sysconfig
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -11,6 +12,8 @@ from cffi import FFI
|
|||||||
use_system_argon2 = os.environ.get("ARGON2_CFFI_USE_SYSTEM", "0") == "1"
|
use_system_argon2 = os.environ.get("ARGON2_CFFI_USE_SYSTEM", "0") == "1"
|
||||||
use_sse2 = os.environ.get("ARGON2_CFFI_USE_SSE2", None)
|
use_sse2 = os.environ.get("ARGON2_CFFI_USE_SSE2", None)
|
||||||
windows = platform.system() == "Windows"
|
windows = platform.system() == "Windows"
|
||||||
|
# Free-threaded CPython doesn't support limited API.
|
||||||
|
limited_api = not sysconfig.get_config_var("Py_GIL_DISABLED")
|
||||||
|
|
||||||
|
|
||||||
# Try to detect cross-compilation.
|
# Try to detect cross-compilation.
|
||||||
@ -48,6 +51,7 @@ if use_system_argon2:
|
|||||||
"_ffi",
|
"_ffi",
|
||||||
"#include <argon2.h>",
|
"#include <argon2.h>",
|
||||||
libraries=["argon2"],
|
libraries=["argon2"],
|
||||||
|
py_limited_api=limited_api,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
lib_base = Path("extras") / "libargon2" / "src"
|
lib_base = Path("extras") / "libargon2" / "src"
|
||||||
@ -56,6 +60,7 @@ else:
|
|||||||
"#include <argon2.h>",
|
"#include <argon2.h>",
|
||||||
extra_compile_args=["-msse2"] if (optimized and not windows) else None,
|
extra_compile_args=["-msse2"] if (optimized and not windows) else None,
|
||||||
include_dirs=[str(Path("extras", "libargon2", "include"))],
|
include_dirs=[str(Path("extras", "libargon2", "include"))],
|
||||||
|
py_limited_api=limited_api,
|
||||||
sources=[
|
sources=[
|
||||||
str(lib_base / path)
|
str(lib_base / path)
|
||||||
for path in [
|
for path in [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user