[V5] CLI 2.0 - Pluggable Backends, Non-TTY Default, HTTP Dispatcher, Spec Files + Codegen#7433
Open
deeleeramone wants to merge 48 commits into
Open
[V5] CLI 2.0 - Pluggable Backends, Non-TTY Default, HTTP Dispatcher, Spec Files + Codegen#7433deeleeramone wants to merge 48 commits into
deeleeramone wants to merge 48 commits into
Conversation
…ature/cli-2 Co-authored-by: Copilot <copilot@github.com>
openbb-core Dependency + Optimize For One-Shot CL Interactions + More...
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a WIP. The goal is to reduce the overhead of running CLI by making it compatible with just the
openbb-corepackage as the default, and expanding the base feature set to provide more utility.Rewrites the CLI to be agent/CI-friendly out of the box and to talk to a remote
openbb-platform-apiserver without importingopenbblocally.The legacy behavior is available via the
-iflag with collection of ODP extensions installed.For performant one-shots that are compatible with multi-user operation, it is recommended to generate a spec file from the running server and operate the CLI from a separate environment with only
openbb-cliinstalled.Now cold starts become instant.
openbb --spec /tmp/openbb.spec --describe economy.fred_series {"id": null, "ok": true, "result": {"name": "economy.fred_series", "providers": {"fred": {"parameters": [{"name": "symbol", "in": "query", "type": "string", "required": true, "help": "Symbol to get data for. Multiple comma separated items allowed for provider(s): fred."}, {"name": "start_date", "in": "query", "type": "string", "help": "Start date of the data, in YYYY-MM-DD format."}, {"name": "end_date", "in": "query", "type": "string", "help": "End date of the data, in YYYY-MM-DD format."}, {"name": "limit", "in": "query", "type": "integer", "default": 100000, "help": "The number of data entries to return."}, {"name": "frequency", "in": "query", "type": "string", "choices": ["a", "q", "m", "w", "d", "wef", "weth", "wew", "wetu", "wem", "wesu", "wesa", "bwew", "bwem"], "help": "Frequency aggregation to convert high frequency data to lower frequency.\n None = No change\n a = Annual\n q = Quarterly\n m = Monthly\n w = Weekly\n d = Daily\n wef = Weekly, Ending Friday\n weth = Weekly, Ending Thursday\n wew = Weekly, Ending Wednesday\n wetu = Weekly, Ending Tuesday\n wem = Weekly, Ending Monday\n wesu = Weekly, Ending Sunday\n wesa = Weekly, Ending Saturday\n bwew = Biweekly, Ending Wednesday\n bwem = Biweekly, Ending Monday"}, {"name": "aggregation_method", "in": "query", "type": "string", "default": "eop", "choices": ["avg", "sum", "eop"], "help": "A key that indicates the aggregation method used for frequency aggregation.\n This parameter has no affect if the frequency parameter is not set.\n avg = Average\n sum = Sum\n eop = End of Period"}, {"name": "transform", "in": "query", "type": "string", "choices": ["chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"], "help": "Transformation type\n None = No transformation\n chg = Change\n ch1 = Change from Year Ago\n pch = Percent Change\n pc1 = Percent Change from Year Ago\n pca = Compounded Annual Rate of Change\n cch = Continuously Compounded Rate of Change\n cca = Continuously Compounded Annual Rate of Change\n log = Natural Log"}], "output_schema": {"properties": {"date": {"type": "string", "format": "date", "title": "Date", "description": "The date of the data."}}, "additionalProperties": true, "type": "object", "required": ["date"], "title": "FredSeriesData", "description": "FRED Series Data."}}, "intrinio": {"parameters": [{"name": "symbol", "in": "query", "type": "string", "required": true, "help": "Symbol to get data for. Multiple comma separated items allowed for provider(s): fred."}, {"name": "start_date", "in": "query", "type": "string", "help": "Start date of the data, in YYYY-MM-DD format."}, {"name": "end_date", "in": "query", "type": "string", "help": "End date of the data, in YYYY-MM-DD format."}, {"name": "limit", "in": "query", "type": "integer", "default": 100000, "help": "The number of data entries to return."}, {"name": "all_pages", "in": "query", "type": "boolean", "default": false, "help": "Returns all pages of data from the API call at once."}, {"name": "sleep", "in": "query", "type": "number", "default": 1.0, "help": "Time to sleep between requests to avoid rate limiting."}], "output_schema": {"properties": {"date": {"type": "string", "format": "date", "title": "Date", "description": "The date of the data."}, "value": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Value", "description": "Value of the index."}}, "additionalProperties": true, "type": "object", "required": ["date"], "title": "IntrinioFredSeriesData", "description": "Intrinio FRED Series Data."}}}}, "error": null}Here is the new help text from
openbb -h:Socrata Soda compatibility lets you point to a story, resource, view, or filter. The SoQL queries get bridged as OpenBB functions through a dedicated dispatcher, fully compatible with the
.specfile. Essentially, creating an OpenAPI V3 client for the hosted service that can be used directly in the legacy TTY mode.Codegen creates PEP-compliant ODP extension project code from a spec file. This makes it possible to instantly generate valid client code that works just like any other ODP provider and router extension.
Enter the terminal in interactive TTY mode by including the
-iflag. No spec file required, loads into memory at runtime.For Socrata APIs, use the
--socrata-storyargument:Generate a spec file, subsequent invocations are essentially zero-cost:
openbb --generate-spec \ --server https://markets.newyorkfed.org \ --openapi-path /static/docs/markets-api.yml \ --output nyfed.specGenerate extension code from a spec file:
openbb --generate-extension \ --spec nyfed.spec \ --provider-name nyfed \ --output ./openbb-nyfedInstall and build:
Run a command:
Spec files carry provenance and integrity checks:
Removed
accountmenu — surface no longer exists.Packaging
Migrated to PEP 621 + Hatchling +
uv.lockto match the V5 standard set by #7482.[tool.uv.sources]workspace-pinsopenbb-core,openbb-charting, andopenbb-devtoolsto in-repo checkouts.CI
Dedicated workflows under
.github/workflows/:test-unit-cli.yml— full V5 platform matrix (Linux 3.10–3.15, macOS 3.10/3.15, Windows 3.10/3.14) withactions/cacheon the uv wheel cache so source-built scientific deps (scipy/numpy/pandas) compile once per (os, python, dep-hash) tuple. Python 3.15 jobs install gfortran + OpenBLAS for the inevitable scipy source build.lint-openbb-cli.yml— ruff format/check + ty type-check on changedcli/**.pyfiles. Cached uv install pulls the full[charting]surface so ty resolves every runtime import.general-linting.ymlis now scoped toopenbb_platform/only.Coverage
100% test coverage
Notes for reviewers
openbb <cmd>no longer enters the REPL. Existing scripts that piped input to stdin must be migrated toopenbb -i(REPL) or argv-style one-shot.[charting],[interactive],[all])