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

add factory flag to openbb-api launcher #7030

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Feb 13, 2025

  1. Why?:

    • This PR modifies openbb-platform-api to:
      • Allow a factory function to serve the FastAPI instance to the launcher.
      • Allow arbitrary app instance name via --name kwarg.
      • Use the CWD when the path to the target file is not absolute (path beginning with "/")
      • Use Uvicorn-style module references for --app and --name`.
        • openbb-api some_file:main --factory
  2. What?:

  3. Impact:

    • More flexibility and out-of-the-box compatibility with FastAPI applications.
    • Less keystrokes required to launch.

image

To load a pre-existing widgets.json file, and skip reading openapi.json, do something like:

openbb-api --widgets-path . --no-build 

Where "." is defining the path to widgets.json as the current working directory.

Additionally:

  • Provider Interface needed to be modified to allow for x-widget_config being passed in the Provider's QueryParams model.
  • "exclude" can be set as True at the Params, ColumnsDefs, and Widget level.
  • Fixes a couple of edge cases where the response model was not being found from the provider interface.
class SomeData(Data):

    base_url: str = Field(
        title="Base URL",
        description="Base URL of the filing.",
        json_schema_extra={
            "x-widget_config": {
                "exclude": True
            }  # Tells the widget factory to exclude this field. Has no effect on endpoint.
        },
    )

@deeleeramone deeleeramone added do not merge Label to prevent pull request merge platform OpenBB Platform v4 PRs for v4 labels Feb 13, 2025
@deeleeramone deeleeramone removed the do not merge Label to prevent pull request merge label Feb 14, 2025
@github-actions github-actions bot added the enhancement Enhancement label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants