From 0ed63c459c7650d682a17d9540e77a0c3d24e2a5 Mon Sep 17 00:00:00 2001 From: "Ferdinando M. Ametrano" Date: Wed, 12 Jul 2023 15:56:04 +0200 Subject: [PATCH] Post release (#115) * dropped python 3.7 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Bump version --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Giacomo Caironi --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 2 +- .sourcery.yaml | 7 +++++-- HISTORY.md | 6 ++++++ btclib/__init__.py | 2 +- btclib/b58.py | 5 +---- btclib/bip32/slip132.py | 5 +---- btclib/ec/curve_group.py | 4 ++-- btclib/psbt/psbt.py | 5 +---- docs/source/conf.py | 2 +- setup.py | 3 +-- 11 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1dae6e5dc..2f9506c28 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 6f11c26a7..1dbd36ad1 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 68856ece4..7b54d5685 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 1b17676f3..935dd9595 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 8ebdbb700..8ebfa1b45 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 527fee501..5741526cc 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 0723459e2..ee99185fd 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 f437b2296..34d31f8e9 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 967eaf76a..57d44deb9 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 3c87300d5..16a281fb5 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 63340d143..41693e352 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",