oceanprotocol / pybundlr

Simple py driver for bundlr
MIT License
2 stars 3 forks source link

Reduce friction in the integration with bundlr -- remove global install #7

Closed juanpablovs closed 9 months ago

juanpablovs commented 1 year ago

Background / motivation

Pybundlr currently uses use bundlr's CLI. bundlr's CLI needs to be installed globally via node. This creates many problems for users. Perhaps most notably, in node, the default installation does not allow for global installs.

A solution would be to find a way to execute bundlr's CLI without a global install

Candidate solutions

  1. Rewrite pybundlr in node
  2. Execute a python subprocess that is fetched with a js file
  3. Use bundlr's REST API
  4. Use bundlr's JS SDK. Via tools to wrap JS with Py, such sa JSPyBridge or PyScript
  5. (Remove the need for bundlr in our use case)

Analysis of candidates

  1. Rewrite pybundlr in node

There is already a bundlr JS SDK. The point of pybundlr is the "py" part: to be readily accessible in python

  1. Execute a python subprocess that is fetched with a js file

This needs elaboration. Feels like a lot of moving parts though

  1. Use bundlr's REST API

As of Nov 2022, this is poorly documented. Not clear how to use it. If we really needed, however, we could see if & how the Bundlr JS SDK uses it

  1. Use bundlr's JS SDK

Promising, should explore more

  1. (Remove the need for bundlr in our use case)

Our (Ocean's) main use case for pybundlr was Predict-ETH Challenge.

As of late Feb 2023, for Predict-ETH Round 4, we removed the need for bundlr.

This has lowered the priority of this issue for Ocean.

trentmc commented 1 year ago

possible solution: rewrite pybundlr in node

FYI there is already a bundlr JS SDK.

The point of pybundlr is the "py" part: to be readily accessible in python

execute a python subprocess that is fetched with a js file

Please elaborate. FYI there's a python library called "javascript" that makes JS code look like a python library. So one option would be to wrap the bundlr SDK this way.

see if bundlr's API works so we can replace the CLI

this is the simplest

trentmc commented 1 year ago

JP & I discussed: we're going with using JS <> py integration

trentmc commented 1 year ago

using JS <> py integration

Here are a couple recent blog posts of interest, each showing a JS <> py integratoin.

trentmc commented 1 year ago

https://github.com/oceanprotocol/pybundlr/tree/replace-cli-with-javascript-sdk

trentmc commented 1 year ago

Low priority for predict-eth, because we're using ERC725 for now.