Skip to main content

High-level Python API for the New Golem

Project description

Golem Python API

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

What's Golem and yapapi?

Golem is a global, open-source, decentralized supercomputer that anyone can access. It connects individual machines to form a vast network which combines their resources and allows requestors to utilize its unique potential - which may be its combined computing power, storage, the geographical distribution or its censorship resistance.

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 test

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 goth-assets

Running the tests

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

poetry run poe goth-tests

Contributing

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

poetry run poe check

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:

  • YAGNA_ACTIVITY_URL, URL to yagna activity API, e.g. http://localhost:7500/activity-api/v1
  • YAGNA_API_URL, base URL to yagna REST API, e.g. http://localhost:7500
  • YAGNA_APPKEY, yagna app key to be used, e.g. a70facb9501d4528a77f25574ab0f12b
  • YAGNA_MARKET_URL, URL to yagna market API, e.g. http://localhost:7500/market-api/v1
  • YAGNA_PAYMENT_NETWORK, Ethereum network name for yagna to use, e.g. rinkeby
  • YAGNA_PAYMENT_DRIVER, payment driver name for yagna to use, e.g. erc20
  • YAGNA_PAYMENT_URL, URL to yagna payment API, e.g. http://localhost:7500/payment-api/v1
  • YAGNA_SUBNET, name of the yagna sub network to be used, e.g. public
  • YAPAPI_USE_GFTP_CLOSE, if set to a truthy value (e.g. "1", "Y", "True", "on") then yapapi will ask gftp to close files when there's no need to publish them any longer. This may greatly reduce the number of files kept open while yapapi is running but requires yagna 0.7.3 or newer, with older versions it will cause errors.

Project details


Download files

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

Source Distribution

yapapi-0.10.0.tar.gz (108.8 kB view details)

Uploaded Source

Built Distribution

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

yapapi-0.10.0-py3-none-any.whl (128.9 kB view details)

Uploaded Python 3

File details

Details for the file yapapi-0.10.0.tar.gz.

File metadata

  • Download URL: yapapi-0.10.0.tar.gz
  • Upload date:
  • Size: 108.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for yapapi-0.10.0.tar.gz
Algorithm Hash digest
SHA256 cf7b1497e266bd38ca39430f78f41697941a5523068ca965bb005352a09f9364
MD5 00c4137db89a59591e28f2407a9297d1
BLAKE2b-256 85ca439e92c6f998cdc7ebbe501fb568720e9fd8af4bb83a24ce89988d77d447

See more details on using hashes here.

File details

Details for the file yapapi-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: yapapi-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 128.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for yapapi-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e92a9769269fa8dbc8cd43716fa77cbca238a95dfc452f283aa5c924f0d264d
MD5 ccfbd9706c76ce2f5886930ef5988cad
BLAKE2b-256 51c8ae8f16a094c21cfa7e1197f0aac9ec94c5da4fc5f965bdefa0591f5f734c

See more details on using hashes here.

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