Skip to content

Commit

Permalink
ffi: rename bindings-python folder to python
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Nov 2, 2024
1 parent 7c8fb7e commit 499ac0d
Show file tree
Hide file tree
Showing 37 changed files with 41 additions and 41 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/publish-sdk-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- cp312-cp312
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
container:
image: quay.io/pypa/manylinux_2_28_x86_64
env:
Expand All @@ -46,7 +46,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: nostr_sdk-manylinux_2_28_x86_64-${{ matrix.python }}
path: /home/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/bindings-python/dist/*.whl
path: /home/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/python/dist/*.whl

build-linux-aarch64:
name: "Build manylinux_2_31 aarch64 wheel"
Expand All @@ -56,7 +56,7 @@ jobs:
python: ["3.9", "3.10", "3.11", "3.12"]
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
steps:
- name: "Checkout"
uses: actions/checkout@v3
Expand All @@ -80,14 +80,14 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: nostr_sdk-manylinux_2_31_aarch64-${{ matrix.python }}
path: /home/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/bindings-python/dist/*.whl
path: /home/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/python/dist/*.whl

build-macos-arm64:
name: "Build macOS arm64 wheel"
runs-on: macos-13
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
Expand All @@ -114,14 +114,14 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: nostr_sdk-macos-arm64-${{ matrix.python }}
path: /Users/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/bindings-python/dist/*.whl
path: /Users/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/python/dist/*.whl

build-macos-x86_64:
name: "Build macOS x86_64 wheel"
runs-on: macos-13
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
Expand All @@ -147,14 +147,14 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: nostr_sdk-macos-x86_64-${{ matrix.python }}
path: /Users/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/bindings-python/dist/*.whl
path: /Users/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/python/dist/*.whl

build-windows:
name: "Build Windows wheel"
runs-on: windows-2022
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
Expand All @@ -177,14 +177,14 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: nostr_sdk-win-${{ matrix.python }}
path: D:\a\nostr\nostr\bindings\nostr-sdk-ffi\bindings-python\dist\*.whl
path: D:\a\nostr\nostr\bindings\nostr-sdk-ffi\python\dist\*.whl

publish-pypi:
name: "Publish on PyPI"
runs-on: ubuntu-20.04
defaults:
run:
working-directory: bindings/nostr-sdk-ffi/bindings-python
working-directory: bindings/nostr-sdk-ffi/python
needs: [build-linux-x86_64, build-linux-aarch64, build-macos-arm64, build-macos-x86_64, build-windows]
if: github.event.inputs.dry-run == 'false'
steps:
Expand Down
36 changes: 18 additions & 18 deletions bindings/nostr-sdk-ffi/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,30 @@ bindings-swift: ios-universal darwin-universal assemble-swift-package

[linux]
python:
rm -rf bindings-python/dist
pip install -r bindings-python/requirements.txt
rm -rf python/dist
pip install -r python/requirements.txt
cargo build --release
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o bindings-python/src/nostr-sdk/
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so bindings-python/src/nostr-sdk/
cd bindings-python && python setup.py --verbose bdist_wheel
pip install ./bindings-python/dist/nostr_sdk*.whl --force-reinstall
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o python/src/nostr-sdk/
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so python/src/nostr-sdk/
cd python && python setup.py --verbose bdist_wheel
pip install ./python/dist/nostr_sdk*.whl --force-reinstall

[macos]
python:
rm -rf bindings-python/dist
pip install -r bindings-python/requirements.txt
rm -rf python/dist
pip install -r python/requirements.txt
cargo build --release
cargo run -p uniffi-bindgen generate --library ../../target/release/libnostr_sdk_ffi.dylib --language python --no-format -o bindings-python/src/nostr-sdk/
cp ../../target/release/libnostr_sdk_ffi.dylib bindings-python/src/nostr-sdk/
cd bindings-python && python setup.py --verbose bdist_wheel
pip install ./bindings-python/dist/nostr_sdk*.whl --force-reinstall
cargo run -p uniffi-bindgen generate --library ../../target/release/libnostr_sdk_ffi.dylib --language python --no-format -o python/src/nostr-sdk/
cp ../../target/release/libnostr_sdk_ffi.dylib python/src/nostr-sdk/
cd python && python setup.py --verbose bdist_wheel
pip install ./python/dist/nostr_sdk*.whl --force-reinstall

[windows]
python:
pip install -r bindings-python\requirements.txt
pip install -r python\requirements.txt
cargo build --release
cargo run -p uniffi-bindgen generate --library ..\..\target\release\nostr_sdk_ffi.dll --language python --no-format -o bindings-python\src\nostr-sdk\
copy ..\..\target\release\nostr_sdk_ffi.dll bindings-python\src\nostr-sdk
del /F /Q bindings-python\dist\* 2>nul || exit /b 0
cd bindings-python && python setup.py --verbose bdist_wheel
FOR %%i in (.\bindings-python\dist\*.whl) DO pip install %i --force-reinstall
cargo run -p uniffi-bindgen generate --library ..\..\target\release\nostr_sdk_ffi.dll --language python --no-format -o python\src\nostr-sdk\
copy ..\..\target\release\nostr_sdk_ffi.dll python\src\nostr-sdk
del /F /Q python\dist\* 2>nul || exit /b 0
cd python && python setup.py --verbose bdist_wheel
FOR %%i in (.\python\dist\*.whl) DO pip install %i --force-reinstall
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def main():
asyncio.run(main())
```

More examples can be found [here](https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/bindings-python/examples).
More examples can be found [here](https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/python/examples).

## Supported NIPs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc cargo build

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/aarch64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/aarch64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o python/src/nostr-sdk/

echo "Copying linux libnostr_sdk_ffi.so..."
cp ../../target/aarch64-unknown-linux-gnu/release/libnostr_sdk_ffi.so bindings-python/src/nostr-sdk/
cp ../../target/aarch64-unknown-linux-gnu/release/libnostr_sdk_ffi.so python/src/nostr-sdk/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ cargo build --release --target x86_64-unknown-linux-gnu

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o python/src/nostr-sdk/

echo "Copying linux libnostr_sdk_ffi.so..."
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so bindings-python/src/nostr-sdk/
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so python/src/nostr-sdk/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ cargo build --release --target aarch64-apple-darwin

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/aarch64-apple-darwin/release/libnostr_sdk_ffi.dylib --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/aarch64-apple-darwin/release/libnostr_sdk_ffi.dylib --language python --no-format -o python/src/nostr-sdk/

echo "Copying libraries libnostr_sdk_ffi.dylib..."
cp ../../target/aarch64-apple-darwin/release/libnostr_sdk_ffi.dylib bindings-python/src/nostr-sdk/
cp ../../target/aarch64-apple-darwin/release/libnostr_sdk_ffi.dylib python/src/nostr-sdk/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ cargo build --release --target x86_64-apple-darwin

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-apple-darwin/release/libnostr_sdk_ffi.dylib --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-apple-darwin/release/libnostr_sdk_ffi.dylib --language python --no-format -o python/src/nostr-sdk/

echo "Copying libraries libnostr_sdk_ffi.dylib..."
cp ../../target/x86_64-apple-darwin/release/libnostr_sdk_ffi.dylib bindings-python/src/nostr-sdk/
cp ../../target/x86_64-apple-darwin/release/libnostr_sdk_ffi.dylib python/src/nostr-sdk/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ cargo build --release --target x86_64-pc-windows-msvc

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-pc-windows-msvc/release/nostr_sdk_ffi.dll --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-pc-windows-msvc/release/nostr_sdk_ffi.dll --language python --no-format -o python/src/nostr-sdk/

echo "Copying libraries nostr_sdk_ffi.dll..."
cp ../../target/x86_64-pc-windows-msvc/release/nostr_sdk_ffi.dll bindings-python/src/nostr-sdk/
cp ../../target/x86_64-pc-windows-msvc/release/nostr_sdk_ffi.dll python/src/nostr-sdk/

echo "All done!"
File renamed without changes.
2 changes: 1 addition & 1 deletion book/src/nostr-sdk/03-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Listen for notifications from the relays based on the subscribed filters and pro
<div slot="title">Python</div>
<section>

Docs aren't ready yet, please check the examples at <https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/bindings-python/examples>.
Docs aren't ready yet, please check the examples at <https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/python/examples>.

</section>

Expand Down

0 comments on commit 499ac0d

Please sign in to comment.