Skip to content

holochain/holochain-client-python

Repository files navigation

Project Discord License: CAL 1.0 Twitter Follow

Holochain Client - Python

Warning

☢️ This package is under development, it is not a complete Holochain client and is not fully tested! ☢️

Set up a development environment

The developer environment for this project relies on Holonix, which you can find out more about in the Holochain getting started guide. Once you have Nix installed, you can create a new development environment by entering the following command into your shell at the root of this project:

nix develop

Then once the Nix shell has spawned, create a virtual environment:

python -m venv .venv
source .venv/bin/activate

Then install dependencies using Poetry:

poetry install --no-root

Running the tests is a good way to check your development environment!

Run the tests

The tests rely on a fixture. The fixture is a simple Holochain app that contains a single zome. It must be built before running the tests. You can do this using:

cd fixture
npm install
npm run build:happ
cd ..

If that succeeds then the tests will be able to find the built happ and you can move on to running the tests.

You can run all the tests using:

poetry run pytest

To select a single test suite, pass the path to pytest. For example:

poetry run tests/api/app/client_test.py

To run a single test, pass the path to the test suite and the use the -k flag. For example:

poetry run pytest tests/api/app/client_test.py -k test_call_zome

Tip

By default pytest captures output. Use the -s flag in combination with RUST_LOG=info to debug tests against Holochain.

Keep the code tidy

Linting and formatting are done by one tool, Ruff. Run the linter using:

poetry run ruff check

If you want it to automatically fix the problems it finds, then use:

poetry run ruff check --fix

Run the formatter using:

poetry run ruff format

Releases

No releases published

Packages

No packages published