From 5630c64348f8c4490828a98a831aad3fd196125a Mon Sep 17 00:00:00 2001 From: David Irvine Date: Mon, 11 Nov 2024 13:06:36 +0000 Subject: [PATCH 1/3] fix: python publish workflow --- .github/workflows/python-publish-client.yml | 27 ++++++++++------ .github/workflows/python-publish-node.yml | 2 +- autonomi/Cargo.toml | 2 +- autonomi/pyproject.toml | 3 ++ sn_node/Cargo.toml | 2 +- sn_node/README.md | 22 ------------- sn_node/pyproject.toml | 2 +- sn_node/python/example.py | 34 ++------------------- 8 files changed, 27 insertions(+), 67 deletions(-) diff --git a/.github/workflows/python-publish-client.yml b/.github/workflows/python-publish-client.yml index 6353300f2c..5714ec7c22 100644 --- a/.github/workflows/python-publish-client.yml +++ b/.github/workflows/python-publish-client.yml @@ -3,7 +3,7 @@ name: Build and Publish Python Client Package on: push: tags: - - 'XXX*' + - 'xxx' permissions: id-token: write @@ -32,14 +32,14 @@ jobs: run: | mkdir -p autonomi/python/autonomi_client cat > autonomi/python/autonomi_client/__init__.py << EOL - from ._autonomi import * + from .autonomi_client import * __version__ = "${{ github.ref_name }}" EOL - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist + args: --release --out dist --find-interpreter --compatibility manylinux2014 sccache: 'true' working-directory: ./autonomi - name: Upload wheels @@ -79,12 +79,12 @@ jobs: shell: cmd run: | if not exist "autonomi\python\autonomi_client" mkdir autonomi\python\autonomi_client - echo from ._autonomi import * > autonomi\python\autonomi_client\__init__.py + echo from .autonomi_client import * > autonomi\python\autonomi_client\__init__.py echo __version__ = "${{ github.ref_name }}" >> autonomi\python\autonomi_client\__init__.py - name: Build wheels uses: PyO3/maturin-action@v1 with: - args: --release --out dist + args: --release --out dist --find-interpreter --compatibility manylinux2014 sccache: 'true' working-directory: ./autonomi - name: Upload wheels @@ -129,15 +129,15 @@ jobs: run: | mkdir -p autonomi/python/autonomi_client cat > autonomi/python/autonomi_client/__init__.py << EOL - from ._autonomi import * + from .autonomi_client import * __version__ = "${{ github.ref_name }}" EOL - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - manylinux: auto - args: --release --out dist + manylinux: "2014" + args: --release --out dist --find-interpreter sccache: 'true' working-directory: ./autonomi before-script-linux: | @@ -173,7 +173,7 @@ jobs: run: | mkdir -p autonomi/python/autonomi_client cat > autonomi/python/autonomi_client/__init__.py << EOL - from ._autonomi import * + from .autonomi_client import * __version__ = "${{ github.ref_name }}" EOL - name: Build sdist @@ -221,6 +221,15 @@ jobs: echo "Final dist directory contents:" ls -la dist/ + - name: Check if version exists + run: | + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" # Remove 'v' prefix if present + if pip index versions autonomi-client | grep -q "${VERSION}"; then + echo "Version ${VERSION} already exists on PyPI" + exit 1 + fi + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/.github/workflows/python-publish-node.yml b/.github/workflows/python-publish-node.yml index 276c0584b8..c65cca0bb5 100644 --- a/.github/workflows/python-publish-node.yml +++ b/.github/workflows/python-publish-node.yml @@ -3,7 +3,7 @@ name: Build and Publish Python Node Package on: push: tags: - - 'XXX*' + - 'xxx' permissions: id-token: write diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 3ac4f23e66..8b06cdebc3 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] description = "Autonomi client API" name = "autonomi" license = "GPL-3.0" -version = "0.2.3" +version = "0.2.32" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" diff --git a/autonomi/pyproject.toml b/autonomi/pyproject.toml index 2560b77469..0a17202968 100644 --- a/autonomi/pyproject.toml +++ b/autonomi/pyproject.toml @@ -29,3 +29,6 @@ classifiers = [ "Programming Language :: Rust", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", ] +dependencies = [ + "pip>=24.3.1", +] diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index 9474738594..c65eeaea47 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "Safe Node" name = "sn_node" -version = "0.112.3" +version = "0.112.41" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" diff --git a/sn_node/README.md b/sn_node/README.md index 2d1587acc8..890e2e8b28 100644 --- a/sn_node/README.md +++ b/sn_node/README.md @@ -89,28 +89,6 @@ Directory Management: - `get_logs_dir() -> str`: Get logs directory path - `get_data_dir() -> str`: Get data storage directory path -#### Storage Example - -```python -# Store some data -key = "1234567890abcdef" # Hex string key -data = b"Hello, Safe Network!" -node.store_record(key, data, "chunk") - -# Retrieve the data -stored_data = node.get_record(key) -if stored_data: - print(f"Retrieved: {stored_data.decode()}") - -# Get storage info -size = node.get_stored_records_size() -print(f"Total storage used: {size} bytes") - -# Delete data -if node.delete_record(key): - print("Data deleted successfully") -``` - #### Directory Management Example ```python diff --git a/sn_node/pyproject.toml b/sn_node/pyproject.toml index 53099296b3..7cd3a34891 100644 --- a/sn_node/pyproject.toml +++ b/sn_node/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "safenode" -version = "0.112.3" +dynamic = ["version"] description = "SAFE Network Node" requires-python = ">=3.8" dependencies = [ diff --git a/sn_node/python/example.py b/sn_node/python/example.py index eaff726f6b..97314f40f2 100644 --- a/sn_node/python/example.py +++ b/sn_node/python/example.py @@ -39,36 +39,7 @@ def demonstrate_basic_node_operations(): return node, peer_id -def demonstrate_storage_operations(node): - print_section("Storage Operations") - - # Store data - key = "1234567890abcdef" # Example hex key - data = b"Hello, Safe Network!" - - try: - # Store a chunk - node.store_record(key, data, "chunk") - print(f"Successfully stored chunk with key: {key}") - - # Retrieve the data - stored_data = node.get_record(key) - if stored_data: - print(f"Retrieved data: {stored_data.decode()}") - - # Get storage stats - size = node.get_stored_records_size() - print(f"Total storage used: {size} bytes") - - # List all stored records - addresses = node.get_all_record_addresses() - print(f"Stored record addresses: {addresses}") - - # Delete the record - if node.delete_record(key): - print(f"Successfully deleted record: {key}") - except Exception as e: - print(f"Storage operation failed: {e}") + def demonstrate_network_operations(node): print_section("Network Operations") @@ -128,8 +99,7 @@ def main(): # Basic setup and node operations node, peer_id = demonstrate_basic_node_operations() - # Storage operations - demonstrate_storage_operations(node) + # Network operations demonstrate_network_operations(node) From eea1daf93edeb943e3d5ff2ede386f6f31f1677c Mon Sep 17 00:00:00 2001 From: David Irvine Date: Tue, 12 Nov 2024 11:18:32 +0000 Subject: [PATCH 2/3] fix: revert Cargo.toml --- autonomi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 8b06cdebc3..3ac4f23e66 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] description = "Autonomi client API" name = "autonomi" license = "GPL-3.0" -version = "0.2.32" +version = "0.2.3" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" From 7efcdd5e5a24e1cd3f61009f43289c91bdcd7018 Mon Sep 17 00:00:00 2001 From: David Irvine Date: Tue, 12 Nov 2024 11:19:08 +0000 Subject: [PATCH 3/3] fix: revert Cargo.toml --- sn_node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index c65eeaea47..9474738594 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "Safe Node" name = "sn_node" -version = "0.112.41" +version = "0.112.3" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net"