diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 12bb9f6..530b791 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 --config-setting=--build-option=--plat-name=manylinux_2_28_x86_64 --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 --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" @@ -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 --config-setting=--build-option=--plat-name=macosx_11_0_x86_64 --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 diff --git a/README.md b/README.md index 3e3be44..5ffdc79 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,12 @@ 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 + +python3 -m build --wheel --outdir dist --verbose + pip3 install ./dist/bdkpython-.whl --force-reinstall + python3 -m unittest --verbose ``` diff --git a/justfile b/justfile index 94deda6..e2f1344 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 --wheel --verbose + +[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: diff --git a/pyproject.toml b/pyproject.toml index 2012f16..901a889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,36 @@ [build-system] -requires = ["setuptools", "wheel", "setuptools-rust"] +requires = ["setuptools", "wheel"] +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" +license-files = ["LICENSE-MIT", "LICENSE-APACHE"] +authors = [ + { name = "Bitcoin Dev Kit Developers", email = "dev@bitcoindevkit.org" } +] +keywords = ["bitcoin", "bdk", "wallet", "ffi", "rust"] +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] + +[project.urls] +Homepage = "https://github.com/bitcoindevkit" +Repository = "https://github.com/bitcoindevkit/bdkpython" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +bdkpython = ["libbdkffi.*"] [tool.pytest.ini_options] -pythonpath = [ - "." -] \ No newline at end of file +pythonpath = ["."] \ No newline at end of file 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 diff --git a/setup.py b/setup.py index 5dbe2c4..968a71d 100644 --- a/setup.py +++ b/setup.py @@ -1,35 +1,5 @@ -#!/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, -) +) \ No newline at end of file