Home

Awesome

Golem Python API

Tests - Status Docs status PyPI - Status PyPI version GitHub license GitHub issues

What's Golem and yapapi?

The Golem Network fosters a global group of creators building ambitious software solutions that will shape the technological landscape of future generations by accessing computing resources across the platform. Golem Network is an accessible, reliable, open access and censorship-resistant protocol, democratizing access to digital resources and connecting users through a flexible, open-source platform.

Yapapi is the Python high-level API that allows developers to connect to their Golem nodes and manage their distributed, computational loads through Golem Network.

Golem application development

For a detailed introduction to using Golem and yapapi to run your tasks on Golem and a guide to Golem Network application development in general, please consult our handbook.

Installation

yapapi is available as a PyPI package.

You can install it through pip:

pip install yapapi

Or if your project uses poetry you can add it to your dependencies like this:

poetry add yapapi

API Reference

For a comprehensive API reference, please refer to our official readthedocs page.

Local setup for yapapi developers

Poetry

yapapi uses poetry to manage its dependencies and provide a runner for common tasks.

If you don't have poetry available on your system then follow its installation instructions before proceeding. Verify your installation by running:

poetry --version

Project dependencies

To install the project's dependencies run:

poetry install

By default, poetry looks for the required Python version on your PATH and creates a virtual environment for the project if there's none active (or already configured by Poetry).

All of the project's dependencies will be installed to that virtual environment.

Running unit tests

yapapi uses Poe the Poet for running tasks. Declarations of project tasks can be found in pyproject.toml.

poetry run poe tests_unit

Running goth integration tests

Prerequisites

If you'd like to run the yapapi integration test suite locally then you'll need to install an additional set of dependencies separately.

First, install the dependencies required to run goth.

Next, configure goth's GitHub API token.

Make sure you have OpenSSH installed and added to path

ssh -V

Now, you can install goth and its additional python requirements:

poetry install -E integration-tests

Finally, generate goth's default assets:

poetry run poe tests_integration_assets

Running the tests

Once you have the environment set up, to run all the integration tests, use:

poetry run poe tests_integration

Contributing

It is recommended to run unit tests and static code analysis before committing changes.

poetry run poe checks

You can clean up the artifacts created during the test runs with:

poetry run poe clean

See also

Environment variables

It's possible to set various elements of yagna configuration through environment variables. yapapi currently supports the following environment variables: