Repository navigation
Description
Problem
coincurve is a hard dependency (requirements.txt: coincurve>=20.0.0,<21), and it cannot currently be installed on Python 3.14:
coincurve20.x has no Python 3.14 wheel, and building it from source fails with recentscikit-build-core(ERROR: Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10). See also Poetry install crash #116.coincurve21.x is excluded by the<21pin, and its source build also fails when thecffidistribution has no LICENSE file (RuntimeError: Expected exactly one LICENSE file in cffi distribution, got 0). A fix exists upstream but has not been released: Addget_cffi_distribution_license_files()ofek/coincurve#188, tracked in python 3.14 ofek/coincurve#219 (Python 3.14), #208 and #223.
So pip install hdwallet (and anything depending on it) fails on Python 3.14.
Observation
The pure-Python ecdsa backend is already implemented and selectable through SLIP10_SECP256K1_CONST.USE. However, hdwallet/eccs/slip10/secp256k1/{point,public_key,private_key}.py run import coincurve unconditionally, and use coincurve.PublicKey / coincurve.PrivateKey in annotations, so the package cannot even be imported without it.
Suggested change
Make coincurve optional and fall back to ecdsa when it is not installed:
- Import
coincurvein atry/except ImportErrorin the three modules above, and addfrom __future__ import annotationsso the annotations are not evaluated. - Default
SLIP10_SECP256K1_CONST.USEto"ecdsa"whencoincurveis not installed. - Only define
SLIP10Secp256k1ECCCoincurve(ineccs/slip10/secp256k1/__init__.py) whencoincurveis the selected backend. - Move
coincurvefromrequirements.txtto an optional extra (e.g.pip install hdwallet[coincurve]). - Skip the
*_coincurvetests intests/hdwallet/eccs/test_slip10_sec256k1_ecc.pywhen it is not installed.
Testing
I tried this on Python 3.14.4 against the python-slip39 fork of this project (commit 3d18107, v4.0.3):
- Without
coincurveinstalled (ecdsabackend): 290 tests passed and 4 skipped (the*_coincurveones); the 117tests/test_examples.pyandtests/test_clients.pyscript tests also passed. - With
coincurve21 installed (backendcoincurve): 294 passed.
Trade-off: the ecdsa backend is slower and not constant-time, so coincurve remains the preferred backend whenever it is installed.
I can open a PR with this change if you are interested.
Activity