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

[Feature] - refactor examples #6154

Merged
merged 142 commits into from
Mar 9, 2024
Merged

Conversation

montezdesousa
Copy link
Contributor

@montezdesousa montezdesousa commented Mar 1, 2024

  1. Why?

    • Examples were written in python but API clients are not bound to python language
    • Excel wants to use the examples, parsing python code into Excel examples would be prone to failure and hard to maintain since you have a lot ways to call the same function in python
    • Examples are inconsistent, sometimes with to_df, other times accessing internal obbject attributes, etc. This will only get worse with time if we don't impose any restrictions on how the example should look
    • There's no policy on which types of examples we should have for each endpoint added
  2. What?

    • Creates 2 example models APIEx and PythonEx
    • These must implement a to_python method that renders the example into python code (pacakge_builder.py then calls this to create docstrings)
    • APIEx are more structured aiming to be language agnostic - provide less freedom
    • PythonEx give more freedom to create complex examples
    • When a given provider is not installed, its example will be excluded from openapi.json and python docstrings
  3. Impact:

    • For the general Python/API users this will have no impact
    • Platform documentation: generate_platform_markdown.py needs a few tweaks to get the examples @the-praxs
    • Excel documentation: generate_excel_markdown.py will start using these examples when this reaches production
  4. Testing Done:

    • The examples should look almost the same as before
    • @IgorWounds will add unit tests to follow a policy with 2 rules:
    1. at least one example for all endpoints
    2. at least one API example with the required parameters for GET endpoints

@github-actions github-actions bot added enhancement Enhancement platform OpenBB Platform v4 PRs for v4 labels Mar 1, 2024
@montezdesousa montezdesousa marked this pull request as ready for review March 8, 2024 20:07
@montezdesousa montezdesousa added this pull request to the merge queue Mar 9, 2024
Merged via the queue into develop with commit f328a45 Mar 9, 2024
15 checks passed
@IgorWounds IgorWounds deleted the feature/refactor_examples branch March 10, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Code documentation enhancement Enhancement platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants