Skip to main content

A Python interface to Textile's Powergate Filecoin API

Project description

pygate gRPC client

Tests Code style: black

A Python interface to Textile's Powergate Filecoin API

This a HackFS project.

The gRPC client is Phase 1 in the concept diagram below. It is intended to serve as a stand-alone component that can be used in other projects.

See the project wiki for additional resources and project status.

concept_diagram

  1. Create a Python gRPC client for the Powergate API.
  2. Create a Flask application that reads and writes to IPFS & Filecoin using this client.
  3. Drop the Flask app in an Electron shell and create a cross-platform, drag-and-drop desktop app that moves local files to and from IPFS/Filecoin.
  4. Add Ethereum smart contract(s) to the desktop app to provide escrow funding for storage deals.

Getting Started

You can get started using pygate_grpc by installing it through the test PyPi repository.

pip install pygate_grpc

Usage

The main component of the package is the PowerGateClient class.

Here is a basic usage example of the pygate_grpc:

from pygate_grpc.client import PowerGateClient

client = PowerGateClient("127.0.0.1:5002")

healthcheck = client.health.check()

Simple as that!

Examples of more elaborated usage can be found in the examples folder.

Development

To setup your development environment make sure you have the following software:

Install dependencies

Runtime and development dependencies can be installed in a new virtual environment automatically by running:

NOTE: The --dev flag can be ommited if you only need runtime dependencies

pipenv install --dev

Using the virtual environment

To run any command through pipenv's virtual environment you can spawn a new virtual environment shell by running:

pipenv shell

Code Style

This project uses black code formatter for consistency. Since the are not any precommit hooks defined in the repository yet please format your code before opening a pull request.

Automatic formatting can be performed by running:

pipenv run format

Running the tests

Currently the test suite is very minimal. Full Testing is in the project's roadmap but it will be developed only if the timeframe of the Hackathon allows to do so.

Integration Tests

Integration tests spin up a localnet using the official script from powergate repository and the test cases are run using that network. By implication, to run the test make sure you have the following dependencies installed:

  • docker-compose
  • docker
  • git

To run the integration tests run:

pipenv run integration-test

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

To automatically bump the version of the package run:

bump2version major|minor|patch setup.py

Finally, to push the new version to git and trigger a new release action it is necessary to add the --tags flag at the time of pushing. i.e.:

git push origin main --tags

Authors

  • Antreas Pogiatzis - Initial scaffolding
  • Wang Ge
  • Peter Van Garderen

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

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

pygate_grpc-0.0.4.tar.gz (37.5 kB view hashes)

Uploaded Source

Built Distribution

pygate_grpc-0.0.4-py3-none-any.whl (48.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page