Add python-gmp as optional backend (gmpy2 alternative)

Closes #895
This commit is contained in:
Sergey B Kirpichev
2025-04-28 20:52:16 +03:00
parent 7a0b3f48b6
commit 33eb8b787b
4 changed files with 18 additions and 3 deletions
+5 -1
View File
@@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install --upgrade .[develop,gmpy2,ci]
pip install --upgrade .[develop,gmpy2,gmp,ci]
- name: Run coverage tests
run: |
pytest
@@ -27,6 +27,10 @@ jobs:
pytest mpmath/tests/test_basic_ops.py mpmath/tests/test_convert.py \
mpmath/tests/test_functions.py mpmath/tests/test_gammazeta.py \
mpmath/tests/test_bitwise.py
pip uninstall -y python-gmp
pytest mpmath/tests/test_basic_ops.py mpmath/tests/test_convert.py \
mpmath/tests/test_functions.py mpmath/tests/test_gammazeta.py \
mpmath/tests/test_bitwise.py
- name: Generate coverage reports
run: |
coverage xml
+7 -1
View File
@@ -16,6 +16,10 @@ jobs:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14, 'pypy3.10', pypy3.11]
nogmpy: [false]
include:
- python-version: 3.13
nogmpy: true
env:
PYTEST_ADDOPTS: -n auto
steps:
@@ -33,5 +37,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install --upgrade .[develop,gmpy2,ci]
pip install --upgrade .[develop,gmpy2,gmp,ci]
- run: pip uninstall -y gmpy2
if: matrix.nogmpy
- run: pytest
+5 -1
View File
@@ -27,7 +27,11 @@ if 'MPMATH_NOGMPY' not in os.environ:
import gmpy2 as gmpy
BACKEND = 'gmpy'
except ImportError:
pass
try:
import gmp as gmpy
BACKEND = 'gmp'
except ImportError:
pass
if gmpy:
MPZ = gmpy.mpz
+1
View File
@@ -37,6 +37,7 @@ develop = ['mpmath[tests]', 'flake518>=1.5; python_version>="3.9"',
'pytest-cov', 'wheel', 'build']
gmpy2 = ['gmpy2>=2.2; platform_python_implementation!="PyPy"']
gmpy = ['mpmath[gmpy2]']
gmp = ['python-gmp>=0.4.0a1']
docs = ['sphinx',
'matplotlib; platform_python_implementation!="PyPy" and python_version<"3.14"',
'sphinxcontrib-autoprogram']