diff --git a/bdk-python/MANIFEST.in b/bdk-python/MANIFEST.in new file mode 100644 index 0000000..f1c5a14 --- /dev/null +++ b/bdk-python/MANIFEST.in @@ -0,0 +1 @@ +include ./src/bdkpython/libbdkffi.dylib diff --git a/bdk-python/generate.sh b/bdk-python/generate.sh index a53a5ff..e93fa2e 100644 --- a/bdk-python/generate.sh +++ b/bdk-python/generate.sh @@ -2,10 +2,16 @@ set -euo pipefail -SCRIPT_DIR=$(dirname "$(realpath $0)") -PY_SRC="${SCRIPT_DIR}/src/bdkpython/" - echo "Generating bdk.py..." -# GENERATE_PYTHON_BINDINGS_OUT="$PY_SRC" GENERATE_PYTHON_BINDINGS_FIXUP_LIB_PATH=bdkffi cargo run --manifest-path ./bdk-ffi/Cargo.toml --release --bin generate --features generate-python -# BDKFFI_BINDGEN_PYTHON_FIXUP_PATH=bdkffi cargo run --manifest-path ./bdk-ffi/Cargo.toml --package bdk-ffi-bindgen -- --language python --udl-file ./bdk-ffi/src/bdk.udl --out-dir ./src/bdkpython/ -BDKFFI_BINDGEN_OUTPUT_DIR="$PY_SRC" BDKFFI_BINDGEN_PYTHON_FIXUP_PATH=bdkffi cargo run --manifest-path ../bdk-ffi/Cargo.toml --package bdk-ffi-bindgen -- --language python --udl-file ../bdk-ffi/src/bdk.udl +cd ../bdk-ffi/ +cargo run --features uniffi/cli --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format +cargo build --features uniffi/cli --profile release-smaller + +echo "Generating native binaries..." +mv ../target/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib + +echo "Bundling bdkpython..." +cd ../bdk-python/ +python3 setup.py --verbose bdist_wheel + +echo "All done!" diff --git a/bdk-python/setup.py b/bdk-python/setup.py index 84555d2..8a1720b 100644 --- a/bdk-python/setup.py +++ b/bdk-python/setup.py @@ -1,9 +1,6 @@ #!/usr/bin/env python -import os - from setuptools import setup -from setuptools_rust import Binding, RustExtension LONG_DESCRIPTION = """# bdkpython The Python language bindings for the [Bitcoin Dev Kit](https://github.com/bitcoindevkit). @@ -52,22 +49,16 @@ balance = wallet.get_balance() print(f"Wallet balance is: {balance.total}") """ -rust_ext = RustExtension( - target="bdkpython.bdkffi", - path="../bdk-ffi/Cargo.toml", - binding=Binding.NoBinding, -) - setup( - name='bdkpython', - version='0.28.0.dev0', + name="bdkpython", + version="0.28.0.dev0", description="The Python language bindings for the Bitcoin Development Kit", long_description=LONG_DESCRIPTION, - long_description_content_type='text/markdown', - rust_extensions=[rust_ext], + long_description_content_type="text/markdown", + include_package_data = True, zip_safe=False, - packages=['bdkpython'], - package_dir={'bdkpython': './src/bdkpython'}, + packages=["bdkpython"], + package_dir={"bdkpython": "./src/bdkpython"}, url="https://github.com/bitcoindevkit/bdk-ffi", author="Alekos Filini , Steve Myers ", license="MIT or Apache 2.0", diff --git a/bdk-python/src/bdkpython/__init__.py b/bdk-python/src/bdkpython/__init__.py index 0b0ba05..67de00c 100644 --- a/bdk-python/src/bdkpython/__init__.py +++ b/bdk-python/src/bdkpython/__init__.py @@ -1 +1 @@ -from bdkpython.bdk import * +from bdkpython.bdk import * \ No newline at end of file