Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-QA code in Python example #273

Open
tools200ms opened this issue May 18, 2024 · 5 comments
Open

NO-QA code in Python example #273

tools200ms opened this issue May 18, 2024 · 5 comments

Comments

@tools200ms
Copy link

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)

@cryptobench
Copy link
Member

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.

@tools200ms
Copy link
Author

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.

@cryptobench
Copy link
Member

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.

@tools200ms
Copy link
Author

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.

@shadeofblue
Copy link
Contributor

shadeofblue commented Aug 26, 2024

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants