golemfactory/golem-docs

NO-QA code in Python example

Opened this issue · 5 comments

In .md file:
https://github.com/golemfactory/golem-docs/blob/reputation-system-rework/src/pages/docs/reputation/finding-the-best-providers.md

there is the Python example, but it does not run. Module "utils" refers to a non-existing "build_parser", "print_env_info", "run_golem_example" names.
These imports are commented with "NO-QA", exactly the line below:

from utils import build_parser, print_env_info, run_golem_example # noqa

Probably it has been working in the past, but over a time as module utils has changed this No Quality code has been removed.

I can rewrite that example, let me know if it's fine for you.
Also, would it be possible to split python code from MarkDown? So, .md would contain something like:

include path/to/example.py
?

Cheers,
Mateusz (Barnaba)

Hey bud! Thanks for the issue.

I would definitely appreciate your assistance in rewriting the example to fix the issue!

As for splitting code from markdown, we have a similar option that fetches it from an online raw github link on build of our docs.

You can use it like this {% codefromgithub url="https://raw.githubusercontent.com/golemfactory/golem-js/master/examples/strategy/whiteListProvidersIds.ts" language="typescript" /%} - so for example you can submit a gist or similar like that and add the raw URL in which our docs will populate it for you with the code at the link.

Good, now we would need repository for an examples. I'll have a look on Python and Node example today evening. So the code is coherent across various languages.

Good, now we would need repository for an examples. I'll have a look on Python and Node example today evening. So the code is coherent across various languages.

Much appreciated bud! If you just create some gists then I will make sure to figure out where to place the code snippets in our repositories afterwards.

Very similar example is here:
https://github.com/golemfactory/yapapi/blob/master/examples/market-strategy/market_strategy.py

I see it's significant work to do to have this API running smoothly.

it's not about the API -> it's just that those examples take code from the examples folder, plus, are meant as illustrations, not necessarily as immediately runnable code... but indeed, we could include some additional comments in the code there - or - also, place the code in the repository so that it's obvious where those, allegedly missing, modules are taken from...