Skip to main content

Python client for the Hashiverse decentralized social network

Project description

hashiverse-client-python

Python client for the Hashiverse decentralized social network. Wraps the Rust hashiverse-lib via PyO3 for native performance.

Usage

test-hashiverse-client-python with maturin develop --release + pytest

Prerequisites

  • Python 3.9+
  • Rust nightly toolchain (see rust-toolchain.toml in workspace root)

Development build

cd hashiverse-rust/hashiverse-client-python

# Create and activate a virtual environment
python -m venv .venv

# Windows
.venv\Scripts\activate

# Linux/macOS
source .venv/bin/activate

# Install maturin and build the extension into the venv
pip install maturin
maturin develop

maturin develop compiles the Rust code in debug mode and installs the resulting Python package into the active venv. Re-run it after any Rust code changes.

For a faster extension (recommended if testing PoW or network operations):

maturin develop --release

Production build

To build a distributable wheel:

maturin build --release

The wheel is written to target/wheels/ and can be installed with:

pip install target/wheels/hashiverse_client-*.whl

Running the example

The example connects to a local hashiverse server, creates an identity, fetches trending hashtags, and reads the #hashiverse timeline.

  1. Start a local server cluster using the test harness (in a separate terminal from the workspace root):
cd hashiverse-rust
cargo run -p hashiverse-integration-tests --bin test_harness
  1. Run the example:
cd hashiverse-rust/hashiverse-client-python
python examples/hello_hashiverse.py

Running tests

The test suite exercises offline client operations (no server required): identity creation, key management, and storage operations.

cd hashiverse-rust/hashiverse-client-python
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install pytest
maturin develop --release
python -m pytest tests/ -v

Quick start

from hashiverse_client import HashiverseClient

client = HashiverseClient.create_from_keyphrase(
    key_phrase="my secret keyphrase",
    data_dir="~/.hashiverse",
    passphrase="my secret passphrase",  # encrypts key files at rest (default: "" = no encryption)
)

print(client.client_id)
client.post("Hello from Python! #hashiverse-python")

timeline = client.get_hashtag_timeline("hashiverse-python")
for post in timeline.posts:
    print(f"{post.client_id[:8]}: {post.post}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hashiverse_client-1.0.3-cp39-abi3-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

hashiverse_client-1.0.3-cp39-abi3-macosx_11_0_arm64.whl (6.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

hashiverse_client-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file hashiverse_client-1.0.3-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 02b3c0c29e2f7a686d995b18021fcdf80f25ccb1c39f7fe81b6e4d6e4c23a44d
MD5 dfaabedb7542272b39ec37d7dd9d191e
BLAKE2b-256 fba82bb1426f21dcde11356fc462da7494f36669894ca03a823f58dff4dec99f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.3-cp39-abi3-win_amd64.whl:

Publisher: publish-hashiverse-client-python.yml on hashiverse/hashiverse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89b1c12bc89f5873dcac93fa599093c924ca168c9706b4d7b27d25663c0632b3
MD5 a930920794a1ae7f1ae4986191deff60
BLAKE2b-256 6218d7220a8b471d1ebd3e6d839b9edafede85e832cbf60c3cd4ede7f9bbd78d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-hashiverse-client-python.yml on hashiverse/hashiverse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9dcdfdeaf46b8804f9c266264eba9a1acdbb831ca4d88a781e958b2e86bbb287
MD5 4bf7edee186b1ea0499f5a5c2a4a61ba
BLAKE2b-256 5420763a5eff1fd91ea5701579dc9c72546ff5fabadccd137a49a6db479a2a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-hashiverse-client-python.yml on hashiverse/hashiverse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hashiverse_client-1.0.3-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5cca799e9540ef40143d0e5f13c85fe8a5083b1a9ae45520aec214215a66eca
MD5 5a37a58179c5cd29bb16fc3f56ae4593
BLAKE2b-256 88f61965ca7b79fde96fa5a0fb8c610bde33a219125bb5d77e58a8b51c993f50

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.3-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-hashiverse-client-python.yml on hashiverse/hashiverse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hashiverse_client-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a4aa89f58fec57e7596ea7d6e821b1a173db18bddb58c0e135189e268947b13f
MD5 402e6730567d8c50dce0a90b749832a9
BLAKE2b-256 f2bdefc207fb8161cf5aa70fd46a3780839d76c00105d79be64ad9e3a246ba64

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-hashiverse-client-python.yml on hashiverse/hashiverse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page