Package: yapapi
Golem Python APIWhat's Golem and yapapi?The Golem Networkfosters 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.Yapapiis 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 developmentFor 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.Installationyapapiis available as aPyPI package.You can install it throughpip:pipinstallyapapiOr if your project usespoetryyou can add it to your dependencies like this:poetryaddyapapiAPI ReferenceFor a comprehensive API reference, please refer toour official readthedocs page.Local setup for yapapi developersPoetryyapapiusespoetryto manage its dependencies and provide a runner for common tasks.If you don't havepoetryavailable on your system then follow itsinstallation instructionsbefore proceeding.
Verify your installation by running:poetry--versionProject dependenciesTo install the project's dependencies run:poetryinstallBy default,poetrylooks for the required Python version on yourPATHand 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 testsyapapiusesPoe the Poetfor running tasks.
Declarations of project tasks can be found inpyproject.toml.poetryrunpoetests_unitRunninggothintegration testsPrerequisitesIf you'd like to run theyapapiintegration test suite locally then you'll need to install an additional set of dependencies separately.First, installthe dependencies required to run goth.Next,configure goth's GitHub API token.Make sure you have OpenSSH installed and added to pathssh-VNow, you can install goth and its additional python requirements:poetryinstall-Eintegration-testsFinally, generate goth's default assets:poetryrunpoetests_integration_assetsRunning the testsOnce you have the environment set up, to run all the integration tests, use:poetryrunpoetests_integrationContributingIt is recommended to run unit tests and static code analysis before committing changes.poetryrunpoechecksYou can clean up the artifacts created during the test runs with:poetryrunpoecleanSee alsoGolem, a global, open-source, decentralized supercomputer that anyone can access.Learn what you need to know to set-up your Golem requestor node:Requestor development: a quick primerRun first task on GolemHave a look at the most important concepts behind any Golem application:Golem application fundamentalsLearn about preparing your own Docker-like images for theVM runtimeWrite your own app with yapapi:Task Model developmentService Model developmentEnvironment variablesIt's possible to set various elements ofyagnaconfiguration through environment variables.yapapicurrently supports the following environment variables:YAGNA_ACTIVITY_URL, URL toyagnaactivity API, e.g.http://localhost:7500/activity-api/v1YAGNA_API_URL, base URL toyagnaREST API, e.g.http://localhost:7500YAGNA_APPKEY,yagnaapp key to be used, e.g.a70facb9501d4528a77f25574ab0f12bYAGNA_MARKET_URL, URL toyagnamarket API, e.g.http://localhost:7500/market-api/v1YAGNA_PAYMENT_NETWORK, Ethereum network name foryagnato use, e.g.rinkebyYAGNA_PAYMENT_DRIVER, payment driver name foryagnato use, e.g.erc20YAGNA_PAYMENT_URL, URL toyagnapayment API, e.g.http://localhost:7500/payment-api/v1YAGNA_NET_URL, URL toyagnanet APU, e.g.http://localhost:7500/net-api/v1YAGNA_SUBNET, name of theyagnasub network to be used, e.g.publicYAPAPI_USE_GFTP_CLOSE, if set to atruthyvalue (e.g. "1", "Y", "True", "on") thenyapapiwill askgftpto close files when there's no need to publish them any longer. This may greatly
reduce the number of files kept open whileyapapiis running but requiresyagna0.7.3 or newer, with older versions it will cause errors.