Merge pull request #7084 from OpenBB-finance/hotfix/package-builder

[HotFix] Fix Missing Docstring Examples
This commit is contained in:
Danglewood
2025-04-03 23:48:02 -07:00
committed by GitHub
7 changed files with 523 additions and 792 deletions

View File

@@ -29,6 +29,7 @@ from typing import (
get_type_hints,
)
from fastapi import Query
from importlib_metadata import entry_points
from openbb_core.app.extension_loader import ExtensionLoader, OpenBBGroups
from openbb_core.app.model.example import Example
@@ -713,7 +714,7 @@ class MethodDefinition:
kind=Parameter.POSITIONAL_OR_KEYWORD,
annotation=Annotated[
bool,
OpenBBField(
Query(
description="Whether to create a chart or not, by default False.",
),
],
@@ -1864,6 +1865,7 @@ class DocstringGenerator:
description = getattr(field, "description", "")
docstring += f"{create_indent(2)}{field.alias or name} : {field_type}\n"
docstring += f"{create_indent(3)}{format_schema_description(description.strip())}\n"
return docstring
@classmethod
@@ -1919,6 +1921,13 @@ class DocstringGenerator:
results_type=results_type,
sections=sections,
)
if "examples" in sections:
doc += cls.build_examples(
path.replace("/", "."),
param_types,
examples,
)
else:
doc_parts = []
if doc:
@@ -2063,12 +2072,12 @@ class DocstringGenerator:
doc = result_doc + "\n"
if doc and examples and "examples" in sections:
doc += cls.build_examples(
path.replace("/", "."),
param_types,
examples,
)
if "examples" in sections:
doc += cls.build_examples(
path.replace("/", "."),
param_types,
examples,
)
if (
max_length # pylint: disable=chained-comparison

View File

@@ -1,7 +1,7 @@
"""Script to build the OpenBB platform static assets."""
# flake8: noqa: S603
# pylint: disable=import-outside-toplevel
# pylint: disable=import-outside-toplevel,unused-import
import subprocess
import sys
@@ -10,14 +10,12 @@ import sys
def main():
"""Build the OpenBB platform static assets."""
try:
from openbb import build
build()
import openbb # noqa
except (
ImportError,
ModuleNotFoundError,
AttributeError,
) as e:
):
print( # noqa: T201
"\nOpenBB build script not found, installing from PyPI...\n",
)
@@ -25,14 +23,15 @@ def main():
[sys.executable, "-m", "pip", "install", "openbb", "--no-deps"],
check=True,
)
try:
subprocess.run(
[sys.executable, "-c", "import openbb; openbb.build()"],
check=True,
)
except (subprocess.CalledProcessError, AttributeError):
except Exception as e:
raise RuntimeError(
"Failed to find the OpenBB build script. Install with `pip install openbb --no-deps`"
f"Failed to build the OpenBB platform static assets. \n{e}"
) from e

963
openbb_platform/core/poetry.lock generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "openbb-core"
version = "1.4.3"
version = "1.4.4"
description = "OpenBB package with core functionality."
authors = ["OpenBB Team <hello@openbb.co>"]
license = "AGPL-3.0-only"

View File

@@ -1,9 +1,9 @@
{
"openbb": "4.4.2",
"openbb": "4.4.3",
"info": {
"title": "OpenBB Platform (Python)",
"description": "Investment research for everyone, anywhere.",
"core": "1.4.3",
"core": "1.4.4",
"extensions": {
"openbb_core_extension": [
"commodity@1.3.0",
@@ -25,7 +25,7 @@
"econdb@1.3.0",
"federal_reserve@1.4.1",
"fmp@1.4.1",
"fred@1.4.1",
"fred@1.4.3",
"imf@1.1.0",
"intrinio@1.4.0",
"oecd@1.4.0",
@@ -9292,42 +9292,6 @@
"choices": null
}
],
"fred": [
{
"name": "item",
"type": "Literal['beverages', 'cereals', 'dairy', 'fuel', 'produce', 'meats', 'bacon', 'bananas', 'beans', 'beef', 'beer', 'bread', 'butter', 'cheese', 'chicken', 'chops', 'coffee', 'cookies', 'corn', 'diesel', 'eggs', 'electricity', 'flour', 'gas', 'gasoline', 'grapefruit', 'ground_beef', 'ham', 'ice_cream', 'lemons', 'lettuce', 'malt_beverages', 'milk', 'oil', 'orange_juice', 'oranges', 'pork', 'potato_chips', 'potatoes', 'rice', 'soft_drinks', 'spaghetti', 'steak', 'strawberries', 'sugar', 'tomatoes', 'unleaded', 'usda', 'vodka', 'wine', 'yogurt']",
"description": "The item or basket of items to query.",
"default": "fuel",
"optional": true,
"choices": null
},
{
"name": "country",
"type": "str",
"description": "The country to get data.",
"default": "united_states",
"optional": true,
"choices": [
"united_states"
]
},
{
"name": "start_date",
"type": "Union[date, str]",
"description": "Start date of the data, in YYYY-MM-DD format.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "end_date",
"type": "Union[date, str]",
"description": "End date of the data, in YYYY-MM-DD format.",
"default": null,
"optional": true,
"choices": null
}
],
"fred": [
{
"name": "item",
@@ -38597,15 +38561,15 @@
"fred": [
{
"name": "maturity",
"type": "Literal[5, 10, 20, 30]",
"type": "Literal['5', '10', '20', '30']",
"description": "The maturity of the security in years - 5, 10, 20, 30 - defaults to all. Note that the maturity is the tenor of the security, not the time to maturity.",
"default": null,
"optional": true,
"choices": [
5,
10,
20,
30
"5",
"10",
"20",
"30"
]
},
{
@@ -41856,262 +41820,6 @@
"model": "SecHtmFile"
}
},
"/regulators/sec/filing_headers": {
"deprecated": {
"flag": null,
"message": null
},
"description": "Download the index headers, and cover page if available, for any SEC filing.",
"examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.regulators.sec.filing_headers(url=https://www.sec.gov/Archives/edgar/data/317540/000119312524076556/d645509ddef14a.htm, provider='sec')\n```\n\n",
"parameters": {
"standard": [],
"sec": [
{
"name": "url",
"type": "str",
"description": "URL for the SEC filing. The specific URL is not directly used or downloaded, but is used to generate the base URL for the filing. e.g. https://www.sec.gov/Archives/edgar/data/317540/000031754024000045/coke-20240731.htm and https://www.sec.gov/Archives/edgar/data/317540/000031754024000045/ are both valid URLs for the same filing.",
"default": "",
"optional": true,
"choices": null
},
{
"name": "use_cache",
"type": "bool",
"description": "Use cache for the index headers and cover page. Default is True.",
"default": true,
"optional": true,
"choices": null
}
]
},
"returns": {
"OBBject": [
{
"name": "results",
"type": "List[SecFiling]",
"description": "Serializable results."
},
{
"name": "provider",
"type": "Optional[Literal['sec']]",
"description": "Provider name."
},
{
"name": "warnings",
"type": "Optional[List[Warning_]]",
"description": "List of warnings."
},
{
"name": "chart",
"type": "Optional[Chart]",
"description": "Chart object."
},
{
"name": "extra",
"type": "Dict[str, Any]",
"description": "Extra info."
}
]
},
"data": {
"standard": [],
"sec": [
{
"name": "base_url",
"type": "str",
"description": "Base URL of the filing.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "name",
"type": "str",
"description": "Name of the entity filing.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "cik",
"type": "str",
"description": "Central Index Key.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "trading_symbols",
"type": "list",
"description": "Trading symbols, if available.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "sic",
"type": "str",
"description": "Standard Industrial Classification.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "sic_organization_name",
"type": "str",
"description": "SIC Organization Name.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "filing_date",
"type": "date",
"description": "Filing date.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "period_ending",
"type": "date",
"description": "Date of the ending period for the filing, if available.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "fiscal_year_end",
"type": "str",
"description": "Fiscal year end of the entity, if available. Format: MM-DD",
"default": null,
"optional": true,
"choices": null
},
{
"name": "document_type",
"type": "str",
"description": "Specific SEC filing type.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "has_cover_page",
"type": "bool",
"description": "True if the filing has a cover page.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "description",
"type": "str",
"description": "Description of attached content, mostly applicable to 8-K filings.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "cover_page",
"type": "dict",
"description": "Cover page information, if available.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "document_urls",
"type": "list",
"description": "List of files associated with the filing.",
"default": "",
"optional": false,
"choices": null
}
]
},
"model": "SecFiling"
},
"/regulators/sec/htm_file": {
"deprecated": {
"flag": null,
"message": null
},
"description": "Download a raw HTML object from the SEC website.",
"examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.regulators.sec.htm_file(url=https://www.sec.gov/Archives/edgar/data/1723690/000119312525030074/d866336dex991.htm, provider='sec')\n```\n\n",
"parameters": {
"standard": [],
"sec": [
{
"name": "url",
"type": "str",
"description": "URL for the SEC filing.",
"default": "",
"optional": true,
"choices": null
},
{
"name": "use_cache",
"type": "bool",
"description": "Cache the file for use later. Default is True.",
"default": true,
"optional": true,
"choices": null
}
]
},
"returns": {
"OBBject": [
{
"name": "results",
"type": "List[SecHtmFile]",
"description": "Serializable results."
},
{
"name": "provider",
"type": "Optional[Literal['sec']]",
"description": "Provider name."
},
{
"name": "warnings",
"type": "Optional[List[Warning_]]",
"description": "List of warnings."
},
{
"name": "chart",
"type": "Optional[Chart]",
"description": "Chart object."
},
{
"name": "extra",
"type": "Dict[str, Any]",
"description": "Extra info."
}
]
},
"data": {
"standard": [],
"sec": [
{
"name": "url",
"type": "str",
"description": "URL of the downloaded file.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "content",
"type": "str",
"description": "Raw content of the HTM/HTML file.",
"default": "",
"optional": false,
"choices": null
}
]
},
"model": "SecHtmFile"
},
"/regulators/sec/cik_map": {
"deprecated": {
"flag": null,

View File

@@ -39,7 +39,7 @@ Extensions:
- econdb@1.3.0
- federal_reserve@1.4.1
- fmp@1.4.1
- fred@1.4.1
- fred@1.4.3
- imf@1.1.0
- intrinio@1.4.0
- oecd@1.4.0

View File

@@ -51,7 +51,7 @@ class ROUTER_fixedincome_government(Container):
Start date of the data, in YYYY-MM-DD format.
end_date : Union[date, None, str]
End date of the data, in YYYY-MM-DD format.
maturity : Optional[Literal[5, 10, 20, 30]]
maturity : Optional[Literal['5', '10', '20', '30']]
The maturity of the security in years - 5, 10, 20, 30 - defaults to all. Note that the maturity is the tenor of the security, not the time to maturity. (provider: fred)
frequency : Optional[Literal['a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem']]
Frequency aggregation to convert high frequency data to lower frequency.
@@ -120,7 +120,7 @@ class ROUTER_fixedincome_government(Container):
--------
>>> from openbb import obb
>>> obb.fixedincome.government.tips_yields(provider='fred')
>>> obb.fixedincome.government.tips_yields(maturity=10, provider='fred')
>>> obb.fixedincome.government.tips_yields(maturity='10', provider='fred')
""" # noqa: E501
return self._run(