summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-07-04 02:39:31 -0700
committerGitHub <noreply@github.com>2024-07-04 09:39:31 +0000
commit8877f616988e68f470b7c96df300c30607c49f03 (patch)
tree75866c7401f24c4c47ee5ab5d4c968333d14ee7d
parent0bd6cd0a1e7401fde7947c7f2bac5ec10a914cc6 (diff)
[BugFix] Fix OECD Unemployment Age Brackets & Fix `No module named 'pkg_resources'` (#6563)
* fix pkg_resources not in Python 3.9 * black
-rw-r--r--openbb_platform/core/openbb_core/app/version.py20
-rw-r--r--openbb_platform/openbb/assets/reference.json23
-rw-r--r--openbb_platform/openbb/package/economy.py2
-rw-r--r--openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py19
4 files changed, 31 insertions, 33 deletions
diff --git a/openbb_platform/core/openbb_core/app/version.py b/openbb_platform/core/openbb_core/app/version.py
index 39872d98a1c..c49232ed6e6 100644
--- a/openbb_platform/core/openbb_core/app/version.py
+++ b/openbb_platform/core/openbb_core/app/version.py
@@ -2,10 +2,12 @@
import shutil
import subprocess
+from importlib.metadata import (
+ PackageNotFoundError,
+ version as pkg_version,
+)
from pathlib import Path
-import pkg_resources
-
PACKAGE = "openbb"
@@ -13,15 +15,15 @@ def get_package_version(package: str):
"""Retrieve the version of a package from installed pip packages."""
is_nightly = False
try:
- version = pkg_resources.get_distribution(package).version
- except pkg_resources.DistributionNotFound:
+ version = pkg_version(package)
+ except PackageNotFoundError:
package += "-nightly"
is_nightly = True
try:
- version = pkg_resources.get_distribution(package).version
- except pkg_resources.DistributionNotFound:
+ version = pkg_version(package)
+ except PackageNotFoundError:
package = "openbb-core"
- version = pkg_resources.get_distribution(package).version
+ version = pkg_version(package)
version += "core"
if is_git_repo(Path(__file__).parent.resolve()) and not is_nightly:
@@ -56,10 +58,10 @@ def get_major_minor(version: str) -> tuple[int, int]:
try:
VERSION = get_package_version(PACKAGE)
-except pkg_resources.DistributionNotFound:
+except PackageNotFoundError:
VERSION = "unknown"
try:
CORE_VERSION = get_package_version("openbb-core")
-except pkg_resources.DistributionNotFound:
+except PackageNotFoundError:
CORE_VERSION = "unknown"
diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json
index 9139dd5420c..28947a0e598 100644
--- a/openbb_platform/openbb/assets/reference.json
+++ b/openbb_platform/openbb/assets/reference.json
@@ -3,7 +3,7 @@
"info": {
"title": "OpenBB Platform (Python)",
"description": "Investment research for everyone, anywhere.",
- "core": "1.2.7",
+ "core": "1.2.9",
"extensions": {
"openbb_core_extension": [
"commodity@1.1.3",
@@ -2443,8 +2443,8 @@
},
{
"name": "date",
- "type": "Union[date, str]",
- "description": "A specific date to get data for.",
+ "type": "Union[Union[Union[str, date], str], List[Union[Union[str, date], str]]]",
+ "description": "A specific date to get data for. Multiple items allowed for provider(s): yfinance.",
"default": null,
"optional": true,
"choices": null
@@ -2491,6 +2491,14 @@
"data": {
"standard": [
{
+ "name": "date",
+ "type": "date",
+ "description": "The date of the data.",
+ "default": null,
+ "optional": true,
+ "choices": null
+ },
+ {
"name": "expiration",
"type": "str",
"description": "Futures expiration month.",
@@ -2501,7 +2509,7 @@
{
"name": "price",
"type": "float",
- "description": "The close price.",
+ "description": "The price of the futures contract.",
"default": null,
"optional": true,
"choices": null
@@ -5374,17 +5382,14 @@
},
{
"name": "age",
- "type": "Literal['total', '15-24', '25-54', '55-64', '15-64', '15-74']",
+ "type": "Literal['total', '15-24', '25+']",
"description": "Age group to get unemployment for. Total indicates 15 years or over",
"default": "total",
"optional": true,
"choices": [
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74"
+ "25+"
]
},
{
diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py
index e6719909149..65befb797d2 100644
--- a/openbb_platform/openbb/package/economy.py
+++ b/openbb_platform/openbb/package/economy.py
@@ -2187,7 +2187,7 @@ class ROUTER_economy(Container):
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: oecd.
sex : Literal['total', 'male', 'female']
Sex to get unemployment for. (provider: oecd)
- age : Literal['total', '15-24', '25-54', '55-64', '15-64', '15-74']
+ age : Literal['total', '15-24', '25+']
Age group to get unemployment for. Total indicates 15 years or over (provider: oecd)
seasonal_adjustment : bool
Whether to get seasonally adjusted unemployment. Defaults to False. (provider: oecd)
diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py b/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
index 236513430d2..5641c967188 100644
--- a/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
+++ b/openbb_platform/providers/oecd/openbb_oecd/models/unemployment.py
@@ -29,18 +29,12 @@ CountriesList = sorted(list(countries)) # type: ignore
AGES = [
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74",
+ "25+",
]
AgesLiteral = Literal[
"total",
"15-24",
- "25-54",
- "55-64",
- "15-64",
- "15-74",
+ "25+",
]
@@ -55,7 +49,7 @@ class OECDUnemploymentQueryParams(UnemploymentQueryParams):
country: str = Field(
description=QUERY_DESCRIPTIONS.get("country", ""),
default="united_states",
- choices=CountriesList,
+ json_schema_extra={"choices": CountriesList}, # type: ignore
)
sex: Literal["total", "male", "female"] = Field(
description="Sex to get unemployment for.",
@@ -65,7 +59,7 @@ class OECDUnemploymentQueryParams(UnemploymentQueryParams):
age: Literal[AgesLiteral] = Field(
description="Age group to get unemployment for. Total indicates 15 years or over",
default="total",
- json_schema_extra={"choices": AGES},
+ json_schema_extra={"choices": AGES}, # type: ignore
)
seasonal_adjustment: bool = Field(
description="Whether to get seasonally adjusted unemployment. Defaults to False.",
@@ -131,10 +125,7 @@ class OECDUnemploymentFetcher(
age = {
"total": "Y_GE15",
"15-24": "Y15T24",
- "15-64": "Y15T64",
- "15-74": "Y15T74",
- "25-54": "Y25T54",
- "55-64": "Y55T64",
+ "25+": "Y_GE25",
}[query.age]
seasonal_adjustment = "Y" if query.seasonal_adjustment else "N"