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

Uploaded CPython 3.9+Windows x86-64

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

Uploaded CPython 3.9+macOS 11.0+ ARM64

hashiverse_client-1.0.2-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.2-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for hashiverse_client-1.0.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 66a907743b60833410c26dc231c6b084bfedefe5b6bfa0b46d81490f9a5ba470
MD5 a6ab2ddc36e6584e3b01c748220f2aa6
BLAKE2b-256 4a3b82594b3dfd010793d2547fb5abe6374f44c6cef17bdd4f3615731044fe9b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hashiverse_client-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d828b9c1bc810caefdf35299dfc40d11e863b2b1201d0f3d05f8ac6e8408a354
MD5 3fc13e280d14e6d8d6f4b149081e2cc4
BLAKE2b-256 40307454f91199e6eb2ace1c46fc1e2be2983eecdfbb68c8e85649cdba27f08d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hashiverse_client-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 edc2da587c471ee6e48c7fac5999c61409020dbfeecfb1139d37543d85e9d8c9
MD5 fd4b353f2f7b61a49ed568bb5c81e394
BLAKE2b-256 76c32f591290f92ef705a9bc838e6c4823cfe1380ad4f98840f6b3d9e40982ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hashiverse_client-1.0.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15984b46306ae39c1a6c320ef584bb62f9d20b12744ef3899dfcc647a04ab9a4
MD5 932f8315746108428439f9e14cab75a8
BLAKE2b-256 e7c0f4e3a5b6453bfc3c7fbf67b680d543dfc987f9165be0ad4f7b1b95cf716b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hashiverse_client-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 24a7cb5efa8fa46687b4f5b54baf50ec9247ec186d2bcef93d47e775a6334115
MD5 7a5193f787bd06a7bad18a1cf5c07390
BLAKE2b-256 370c85a2a665871561540eaa13328118a21415758ac87bbb4bb32e6f7ee11d9c

See more details on using hashes here.

Provenance

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