Skip to content

Migrate build process to PEP 621/517 compliance #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<yourversion>.whl --force-reinstall

python3 -m unittest --verbose
```
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
37 changes: 33 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" }
]
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 = [
"."
]
pythonpath = ["."]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 1 addition & 31 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
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,
)
)
Loading