diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1dae6e5d..2f9506c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.9", "pypy3.10"] + python: ["3.8", "3.9", "3.10", "3.11", "pypy3.9", "pypy3.10"] steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f11c26a..1dbd36ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,7 +57,7 @@ repos: rev: v3.9.0 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] # exclude: *fixtures language: python types: [python] diff --git a/.sourcery.yaml b/.sourcery.yaml index 68856ece..7b54d568 100644 --- a/.sourcery.yaml +++ b/.sourcery.yaml @@ -7,7 +7,7 @@ # 📚 For a complete reference to this file, see the documentation at # https://docs.sourcery.ai/Configuration/Project-Settings/ -# This file was auto-generated by Sourcery on 2023-01-01 at 13:20. +# This file was auto-generated by Sourcery on 2023-07-08 at 01:13. version: "1" # The schema version of this config file @@ -18,6 +18,8 @@ ignore: # A list of paths or files which Sourcery will ignore. - env - .env - .tox + - node_modules + - vendor rule_settings: enable: @@ -27,12 +29,13 @@ rule_settings: - refactoring - suggestion - comment - python_version: "3.7" # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version. + python_version: "3.8" # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version. # rules: # A list of custom rules Sourcery will include in its analysis. # - id: no-print-statements # description: Do not use print statements in the test directory. # pattern: print(...) +# language: python # replacement: # condition: # explanation: diff --git a/HISTORY.md b/HISTORY.md index 1b17676f..935dd959 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,6 +5,12 @@ Notable changes to the codebase are documented here. Release names follow *[calendar versioning](https://calver.org/)*: full year, short month, short day (YYYY-M-D) +## v2023.8 (work in progress, not released yet) + +Major changes includes: + +- dropped python 3.7 support + ## v2023.7.12 This is the last release supporting py37. diff --git a/btclib/__init__.py b/btclib/__init__.py index 8ebdbb70..8ebfa1b4 100644 --- a/btclib/__init__.py +++ b/btclib/__init__.py @@ -10,7 +10,7 @@ """__init__ module for the btclib package.""" name = "btclib" -__version__ = "2023.7.12" +__version__ = "2023.8" __author__ = "The btclib developers" __author_email__ = "devs@btclib.org" __copyright__ = "Copyright (C) 2017-2023 The btclib developers" diff --git a/btclib/b58.py b/btclib/b58.py index 527fee50..5741526c 100644 --- a/btclib/b58.py +++ b/btclib/b58.py @@ -75,10 +75,7 @@ def h160_from_address(b58addr: String) -> tuple[str, bytes, str]: prefix = payload[:1] for script_type in ("p2pkh", "p2sh"): - # with python>=3.8 use walrus operator - # if network := network_from_key_value(script_type, prefix): - network = network_from_key_value(script_type, prefix) - if network: + if network := network_from_key_value(script_type, prefix): return script_type, payload[1:], network err_msg = f"invalid base58 address prefix: 0x{prefix.hex()}" diff --git a/btclib/bip32/slip132.py b/btclib/bip32/slip132.py index 0723459e..ee99185f 100644 --- a/btclib/bip32/slip132.py +++ b/btclib/bip32/slip132.py @@ -58,10 +58,7 @@ def address_from_xpub(xpub: BIP32Key) -> str: b58.p2wpkh_p2sh, ] for version, function in zip(version_list, function_list): - # with python>=3.8 use walrus operator - # if network := network_from_key_value(version, xpub.version): - network = network_from_key_value(version, xpub.version) - if network: + if network := network_from_key_value(version, xpub.version): return function(xpub, network) err_msg = f"unknown xpub version: {xpub.version.hex()}" # pragma: no cover raise BTClibValueError(err_msg) # pragma: no cover diff --git a/btclib/ec/curve_group.py b/btclib/ec/curve_group.py index f437b229..34d31f8e 100644 --- a/btclib/ec/curve_group.py +++ b/btclib/ec/curve_group.py @@ -472,7 +472,7 @@ def multiples(Q: JacPoint, size: int, ec: CurveGroup) -> list[JacPoint]: MAX_W = 5 -@functools.lru_cache() # results are cached to increase efficiency +@functools.lru_cache # results are cached to increase efficiency def cached_multiples(Q: JacPoint, ec: CurveGroup) -> list[JacPoint]: T = [INFJ, Q] for i in range(3, 2**MAX_W, 2): @@ -481,7 +481,7 @@ def cached_multiples(Q: JacPoint, ec: CurveGroup) -> list[JacPoint]: return T -@functools.lru_cache() # results are cached to increase efficiency +@functools.lru_cache # results are cached to increase efficiency def cached_multiples_fixwind( Q: JacPoint, ec: CurveGroup, w: int = 4 ) -> list[list[JacPoint]]: diff --git a/btclib/psbt/psbt.py b/btclib/psbt/psbt.py index 967eaf76..57d44deb 100644 --- a/btclib/psbt/psbt.py +++ b/btclib/psbt/psbt.py @@ -144,10 +144,7 @@ def assert_signable(self) -> None: for i, tx_in in enumerate(self.tx.vin): non_witness_utxo = self.inputs[i].non_witness_utxo redeem_script = self.inputs[i].redeem_script - # with python>=3.8 use walrus operator - # if witness_utxo := self.inputs[i].witness_utxo: - witness_utxo = self.inputs[i].witness_utxo - if witness_utxo: + if witness_utxo := self.inputs[i].witness_utxo: script_pub_key = witness_utxo.script_pub_key script_type, payload = type_and_payload(script_pub_key.script) if script_type == "p2sh": diff --git a/docs/source/conf.py b/docs/source/conf.py index 3c87300d..16a281fb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ project = "btclib" project_copyright = "2017-2023 The btclib developers" author = "The btclib developers" -release = "2023.7.12" +release = "2023.8" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/setup.py b/setup.py index 63340d14..41693e35 100644 --- a/setup.py +++ b/setup.py @@ -44,11 +44,10 @@ "bip32 bip39 electrum base58 bech32 segwit message-signing " "bip340" ), - python_requires=">=3.7", + python_requires=">=3.8", classifiers=[ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10",