golemfactory / yapapi

Python high-level API for Golem.
https://yapapi.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
48 stars 23 forks source link

Manifest creation helper #1103

Closed approxit closed 1 year ago

approxit commented 1 year ago

What I've done:

As this kind of DTOs should be implemented in pydantic, this should be mentioned as work item in https://github.com/golemfactory/golem-core-python/issues/54.

Keep in mind, that parsing object is quite a complex task. This implementation is not mentioned to be so robust as pydantic's. .parse_obj(obj) is just "base minimum".

Also exploding nested dicts is very easy task, but supporting exploding dicts with lists... oh boy, code complexity explodes too... I'm not very happy how it turned out, but at least its working and its covered with tests.

shadeofblue commented 1 year ago

as mentioned in the original issue: https://github.com/golemfactory/yapapi/issues/1090

the ultimate goal here is to have a helper function able to generate a valid manifest with minimal, obligatory input, e.g.:

manifest = generate_manifest(
   {
      "payload": manifest_payload("sha3:05270a8a938ff5f5e30b0e61bc983a8c3e286c5cd414a32e1a077657"),
      "net.inet.out.urls": ["http://bor.golem.network"],
   }
)