From 62f4b76362642d0cc2b8bd5c14c77046ad4216e5 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 18:55:27 +0200 Subject: [PATCH 01/13] Update pyproject.toml to include project metadata as per PEP 621 --- pyproject.toml | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2012f16..f68a862 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,40 @@ [build-system] requires = ["setuptools", "wheel", "setuptools-rust"] +build-backend = "setuptools.build_meta" + +[project] +name = "bdkpython" +version = "2.0.0.dev0" +description = "The Python language bindings for the Bitcoin Development Kit" +readme = "README.md" +requires-python = ">=3.7" +license = "MIT OR Apache-2.0" +authors = [ + {name = "Bitcoin Dev Kit Developers", email = "dev@bitcoindevkit.org"} +] +keywords = ["bitcoin", "bdk", "wallet", "ffi", "rust"] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Rust", + "Operating System :: OS Independent" +] +dependencies = [ + "cffi>=1.0" +] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-dir] +bdkpython = "src/bdkpython" + +[tool.setuptools-rust] +rust_extensions = [ + { path = "Cargo.toml", binding = "pyo3", debug = true } +] [tool.pytest.ini_options] -pythonpath = [ - "." -] \ No newline at end of file +pythonpath = ["."] \ No newline at end of file From dae1e21a932e6fe1cbc93295a501a7cc812c0986 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 19:05:37 +0200 Subject: [PATCH 02/13] Update requirements including build for efficient build automation --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index de2e59b..4f49921 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ semantic-version==2.9.0 typing_extensions==4.0.1 setuptools==75.3.2 wheel==0.38.4 +build==1.3.0 \ No newline at end of file From ecc4b245925c1b7061dc8acbb3470c2055a73580 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 19:09:41 +0200 Subject: [PATCH 03/13] Update README.md file to reflect changes in the building process --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e3be44..cc3f4f4 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,16 @@ This repository uses the bdk-ffi repository as a git submodule. Here are useful ```sh source .localpythonenv/bin/activate -bash scripts/generate-macos-arm64.sh -python3 setup.py bdist_wheel + +# Generate FFI bindings +bash scripts/generate-macos-arm64.sh # or the appropriate script for your OS + +# Build the wheel +python3 -m build + +# Install the wheel (force reinstall if needed) pip3 install ./dist/bdkpython-.whl --force-reinstall + +# Run tests python3 -m unittest --verbose ``` From 4c5a6b833671e22582f4d472351913b85e21c334 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 19:11:58 +0200 Subject: [PATCH 04/13] Update justfile to include build spec --- justfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/justfile b/justfile index 94deda6..e45bd3d 100644 --- a/justfile +++ b/justfile @@ -16,6 +16,16 @@ clean: rm -rf ./build/ rm -rf ./dist/ +[group("Build")] +[doc("Build the wheel using pyproject.toml (modern build system).")] +build: + python3 -m build + +[group("Build")] +[doc("Install the wheel locally (force reinstall).")] +install: + pip3 install dist/bdkpython-*.whl --force-reinstall + [group("Submodule")] [doc("Initialize bdk-ffi submodule to committed hash.")] submodule-init: From 73c40568fd298fd90667af104d5315d3128ac5c6 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 19:14:31 +0200 Subject: [PATCH 05/13] add project urls on pyproject.toml file --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f68a862..96af9ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,10 @@ dependencies = [ "cffi>=1.0" ] +[project.urls] +Homepage = "https://github.com/bitcoindevkit" +Repository = "https://github.com/bitcoindevkit/bdkpython" + [tool.setuptools] include-package-data = true From d32d64365fa7db1e3eb6e593a21ede1c875f927d Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 19:36:09 +0200 Subject: [PATCH 06/13] remove setup.py file (new build process has been implemented) --- setup.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 5dbe2c4..0000000 --- a/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - -LONG_DESCRIPTION = """# bdkpython -The Python language bindings for the [Bitcoin Dev Kit](https://github.com/bitcoindevkit). - -## Install the package -```shell -pip install bdkpython -``` - -## Simple example -```python -from bdkpython import Wallet -``` -""" - -setup( - name="bdkpython", - version="2.0.0.dev0", - description="The Python language bindings for the Bitcoin Development Kit", - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - include_package_data = True, - zip_safe=False, - packages=["bdkpython"], - package_dir={"bdkpython": "./src/bdkpython"}, - url="https://github.com/bitcoindevkit/bdkpython", - author="Bitcoin Dev Kit Developers ", - license="MIT or Apache 2.0", - # This is required to ensure the library name includes the python version, abi, and platform tags - # See issue #350 for more information - has_ext_modules=lambda: True, -) From c5c6cdd985d2620042d67bda7a76d2017675ddff Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Tue, 5 Aug 2025 20:09:20 +0200 Subject: [PATCH 07/13] clean README.md file by removing comment from shell ommand section --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index cc3f4f4..3dcde6b 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,11 @@ This repository uses the bdk-ffi repository as a git submodule. Here are useful ```sh source .localpythonenv/bin/activate -# Generate FFI bindings -bash scripts/generate-macos-arm64.sh # or the appropriate script for your OS +bash scripts/generate-macos-arm64.sh -# Build the wheel python3 -m build -# Install the wheel (force reinstall if needed) pip3 install ./dist/bdkpython-.whl --force-reinstall -# Run tests python3 -m unittest --verbose ``` From 2138daaf035e04f7e76b4d998c2f5e7cfef14515 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 19:26:30 +0200 Subject: [PATCH 08/13] fix: remove setuptools-rust dependency --- pyproject.toml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 96af9ad..901a889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "wheel", "setuptools-rust"] +requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] @@ -9,17 +9,14 @@ description = "The Python language bindings for the Bitcoin Development Kit" readme = "README.md" requires-python = ">=3.7" license = "MIT OR Apache-2.0" +license-files = ["LICENSE-MIT", "LICENSE-APACHE"] authors = [ - {name = "Bitcoin Dev Kit Developers", email = "dev@bitcoindevkit.org"} + { name = "Bitcoin Dev Kit Developers", email = "dev@bitcoindevkit.org" } ] keywords = ["bitcoin", "bdk", "wallet", "ffi", "rust"] classifiers = [ - "Programming Language :: Python :: 3", - "Programming Language :: Rust", - "Operating System :: OS Independent" -] -dependencies = [ - "cffi>=1.0" + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", ] [project.urls] @@ -32,13 +29,8 @@ include-package-data = true [tool.setuptools.packages.find] where = ["src"] -[tool.setuptools.package-dir] -bdkpython = "src/bdkpython" - -[tool.setuptools-rust] -rust_extensions = [ - { path = "Cargo.toml", binding = "pyo3", debug = true } -] +[tool.setuptools.package-data] +bdkpython = ["libbdkffi.*"] [tool.pytest.ini_options] pythonpath = ["."] \ No newline at end of file From 71fc7901e3553cf0813f4eb7d17d88093f6bc6ed Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 19:26:58 +0200 Subject: [PATCH 09/13] fix: restore setup.py (minimum requirements) --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..968a71d --- /dev/null +++ b/setup.py @@ -0,0 +1,5 @@ +from setuptools import setup + +setup( + has_ext_modules=lambda: True, +) \ No newline at end of file From 7315dc84387e0a1b351a7511af3d609279a1d0dd Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 19:27:27 +0200 Subject: [PATCH 10/13] fix: README build wheel prcess --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3dcde6b..5ffdc79 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ source .localpythonenv/bin/activate bash scripts/generate-macos-arm64.sh -python3 -m build +python3 -m build --wheel --outdir dist --verbose pip3 install ./dist/bdkpython-.whl --force-reinstall From f01b83358c2146370b77eb0ad7604a10316a14c2 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 19:27:53 +0200 Subject: [PATCH 11/13] fix: github action workflow (new build wheel process) --- .github/workflows/test-python.yaml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 12bb9f6..2957102 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -41,10 +41,11 @@ jobs: - name: "Generate bdk.py and binaries" run: bash ./scripts/generate-linux.sh + - name: "Install build" + run: ${PYBIN}/pip install build + - name: "Build wheel" - # Specifying the plat-name argument is necessary to build a wheel with the correct name, - # see issue #350 for more information - run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_28_x86_64 --verbose + run: ${PYBIN}/python -m build --wheel --verbose - name: "Install wheel" run: ${PYBIN}/pip install ./dist/*.whl @@ -84,10 +85,13 @@ jobs: - name: "Generate bdk.py and binaries" run: bash ./scripts/generate-macos-arm64.sh + - name: "Install build" + run: pip3 install build + - name: "Build wheel" # Specifying the plat-name argument is necessary to build a wheel with the correct name, # see issue #350 for more information - run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose + run: python3 -m build --wheel --verbose # You can't install the arm64 wheel on the CI, so we skip these steps and simply test that the wheel builds # - name: "Install wheel and run tests" @@ -126,10 +130,11 @@ jobs: - name: "Generate bdk.py and binaries" run: bash ./scripts/generate-macos-x86_64.sh + - name: "Install build" + run: pip3 install build + - name: "Build wheel" - # Specifying the plat-name argument is necessary to build a wheel with the correct name, - # see issue #350 for more information - run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose + run: python3 -m build --wheel --verbose - name: "Install wheel" run: pip3 install ./dist/*.whl @@ -169,8 +174,11 @@ jobs: - name: "Generate bdk.py and binaries" run: bash ./scripts/generate-windows.sh + - name: "Install build" + run: pip install build + - name: "Build wheel" - run: python setup.py bdist_wheel --verbose + run: python -m build --wheel --verbose - name: "Upload artifact test" uses: actions/upload-artifact@v4 From 757387d0fb0660a6db88b04c5861a1308f60c611 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 19:31:52 +0200 Subject: [PATCH 12/13] fix: build command on justfile --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index e45bd3d..e2f1344 100644 --- a/justfile +++ b/justfile @@ -19,7 +19,7 @@ clean: [group("Build")] [doc("Build the wheel using pyproject.toml (modern build system).")] build: - python3 -m build + python3 -m build --wheel --verbose [group("Build")] [doc("Install the wheel locally (force reinstall).")] From f45f9243deb4811569b41d1c6f38b2e09c65c0b9 Mon Sep 17 00:00:00 2001 From: mg-twentyone <36_twentyone@proton.me> Date: Fri, 8 Aug 2025 20:52:56 +0200 Subject: [PATCH 13/13] fix: restore plat name parameter --- .github/workflows/test-python.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 2957102..530b791 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -45,7 +45,7 @@ jobs: run: ${PYBIN}/pip install build - name: "Build wheel" - run: ${PYBIN}/python -m build --wheel --verbose + run: ${PYBIN}/python -m build --wheel --config-setting=--build-option=--plat-name=manylinux_2_28_x86_64 --verbose - name: "Install wheel" run: ${PYBIN}/pip install ./dist/*.whl @@ -91,7 +91,7 @@ jobs: - name: "Build wheel" # Specifying the plat-name argument is necessary to build a wheel with the correct name, # see issue #350 for more information - run: python3 -m build --wheel --verbose + run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_arm64 --verbose # You can't install the arm64 wheel on the CI, so we skip these steps and simply test that the wheel builds # - name: "Install wheel and run tests" @@ -134,7 +134,7 @@ jobs: run: pip3 install build - name: "Build wheel" - run: python3 -m build --wheel --verbose + run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_x86_64 --verbose - name: "Install wheel" run: pip3 install ./dist/*.whl