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.4-cp39-abi3-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

hashiverse_client-1.0.4-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.4-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.4-cp39-abi3-macosx_11_0_arm64.whl (6.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

hashiverse_client-1.0.4-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.4-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 81f7ea796e1e9412735b664b77225bd101b399915ac1762a1e87b1604dd165e6
MD5 abe84f49e1433d0bed957877b7a4b01e
BLAKE2b-256 6a0cc0694e21213091afe45d03224a46e2e1bb8da6220bb8d604f3dac92dcd91

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.4-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.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35ea00bd102d08f38d56fc3ad88269e3a627c6e4a6b47557ba1961c6ad453032
MD5 9bf66b451562468efa999644a687c5dc
BLAKE2b-256 d800ee0528788358eeee8a34f0ad93c7a8d4947e8e03dbc7c56fc0250450cb7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.4-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.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 14a4231d06a9dde3aad1fdc01a4eef8c736467f2790e6ddd1335bbbbef24728f
MD5 fcedda2bec8b1105c5ac1ea4f55ebb1c
BLAKE2b-256 54bfd2ba9818baffa3e8e1b39fee679352181ec0de0f0a919db59eb06e2340e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.4-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.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b256bd76997ec1c0d6cef843386f4ec9b4d7735e0f0e91e4703c62c3fa80803a
MD5 8c1410ceae360cead7e9fbebd6a0b62c
BLAKE2b-256 fd1d46d3aca88216cbfa8148f1e83331e8b2957021e635faf3171106d6c4a49a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.4-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.4-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c73893275330192da90a22436878047db78157bfb12d936937564ab19fedcc1d
MD5 1a1b92fda2f60b2cbc4c0730acfd7da6
BLAKE2b-256 cea18d7a4c0ca23a222d22730885c62727e2954eb56bffc6cb2312338ef2f474

See more details on using hashes here.

Provenance

The following attestation bundles were made for hashiverse_client-1.0.4-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