Remove Python 3.10 tomli fallbacks

With requires-python >=3.11, tomllib is always available, so the
version-conditional tomli imports are dead code.

- import tomllib directly in the cli and core config loaders, the
  mcp_server and platform_api config validators, dev_install.py, and
  the cli and cookiecutter tests; dev_install.py no longer pip-installs
  tomli on the fly
- drop the tomli>=2.0; python_version<'3.11' dependency from cli, core,
  mcp_server, and platform_api, plus platform_api's backport comment
- raise the fake-extension fixtures in cli/conftest.py,
  core/integration/conftest.py, and the charting test metadata to
  >=3.11
- relock cli, core, mcp_server, and platform_api; only the tomli
  requires-dist entry is removed and resolution markers are reordered,
  no package versions change
This commit is contained in:
dlee-bq
2026-10-24 01:12:19 -07:00
parent e8459c6778
commit 42fc2838f1
18 changed files with 31 additions and 74 deletions

View File

@@ -43,7 +43,7 @@ PYPROJECT = """\
[project]
name = "{ext_name}"
version = "0.0.1"
requires-python = ">=3.10,<4"
requires-python = ">=3.11,<4"
dependencies = ["openbb-core"]
[project.entry-points."openbb_core_extension"]

View File

@@ -3,15 +3,10 @@
from __future__ import annotations
import os
import sys
import tomllib
from pathlib import Path
from typing import Any
if sys.version_info >= (3, 11): # pragma: no cover
import tomllib
else: # pragma: no cover
import tomli as tomllib
DEFAULT_CONFIG_NAMES: tuple[str, ...] = ("openbb.toml", ".openbb.toml")
PYPROJECT_NAME = "pyproject.toml"
PYPROJECT_TABLE: tuple[str, ...] = ("tool", "openbb-cli")

1
cli/pyproject.toml vendored
View File

@@ -14,7 +14,6 @@ dependencies = [
"openpyxl>=3.1.5,<4.0.0",
"httpx>=0.28.0,<1.0.0",
"pyyaml>=6.0",
"tomli>=2.0;python_version<'3.11'",
]
[project.optional-dependencies]

View File

@@ -213,10 +213,8 @@ def test_render_config_template_returns_valid_toml():
rendered = loader.render_config_template()
# Strip the all-comment lines so tomllib has something to parse — even
# an empty result is fine; the assertion is "no parse error".
if loader.sys.version_info >= (3, 11):
import tomllib
else: # pragma: no cover
import tomli as tomllib
import tomllib
tomllib.loads(rendered)

17
cli/uv.lock generated vendored
View File

@@ -6,13 +6,13 @@ resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
@@ -1514,10 +1514,10 @@ resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
sdist = { url = "https://files.pythonhosted.org/packages/95/b0/c7453d0b6e2073c3264468b106ee1563750cecc910965e67357e3698c83e/numpy-2.5.4.tar.gz", hash = "sha256:9a94cf751c9ad8ebaa835bcd3d40dacf8534ad086b88c38029b65123c7999d2a", size = 20866315, upload-time = "2026-10-10T20:05:31.422Z" }
@@ -1647,7 +1647,6 @@ requires-dist = [
{ name = "pywry", marker = "extra == 'interactive'", specifier = ">=2.0.6" },
{ name = "pyyaml", specifier = ">=6.0" },
{ name = "rich", specifier = ">=14.0.0,<15.0.0" },
{ name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.0" },
]
provides-extras = ["charting", "interactive", "all"]
@@ -2887,10 +2886,10 @@ resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.13.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'win32'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
"python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
dependencies = [

View File

@@ -3,6 +3,7 @@
import shutil
import subprocess
import sys
import tomllib
from pathlib import Path
import pytest
@@ -11,11 +12,6 @@ from cookiecutter.main import cookiecutter
from openbb_cookiecutter import get_template_path
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
PACKAGE = "extension_template"

View File

@@ -44,7 +44,7 @@ PYPROJECT = """\
[project]
name = "{ext_name}"
version = "0.0.1"
requires-python = ">=3.10,<4"
requires-python = ">=3.11,<4"
dependencies = ["openbb-core"]
[project.entry-points."openbb_core_extension"]

View File

@@ -79,15 +79,10 @@ output for a fully documented version.
from __future__ import annotations
import os
import sys
import tomllib
from pathlib import Path
from typing import Any
if sys.version_info >= (3, 11): # pragma: no cover — version-conditional import
import tomllib
else: # pragma: no cover — exercised only on the 3.10 backport path
import tomli as tomllib
from openbb_core.app.constants import OPENBB_DIRECTORY
DEFAULT_CONFIG_NAMES: tuple[str, ...] = ("openbb.toml", ".openbb.toml")

View File

@@ -19,7 +19,6 @@ dependencies = [
"aiohttp>=3.14.2",
"ruff>=0.15",
"pyjwt>=2.13.0",
"tomli>=2.0.0; python_version<'3.11'",
]
[project.optional-dependencies]

View File

@@ -137,7 +137,7 @@ ENGINE_METADATA = f"""\
Metadata-Version: 2.1
Name: {DIST_NAME}
Version: {DIST_VERSION}
Requires-Python: >=3.10,<4
Requires-Python: >=3.11,<4
Requires-Dist: openbb-core
"""

17
openbb_platform/core/uv.lock generated vendored
View File

@@ -6,13 +6,13 @@ resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version < '3.11.5' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'emscripten'",
"python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
@@ -1532,10 +1532,10 @@ version = "2.4.6"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version < '3.11.5' and sys_platform == 'emscripten'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'win32'",
"python_full_version < '3.11.5' and sys_platform == 'emscripten'",
"python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
sdist = { url = "https://files.pythonhosted.org/packages/d0/ad/fed0499ce6a338d2a03ebae59cd15093910c8875328855781952abf6c2fe/numpy-2.4.6.tar.gz", hash = "sha256:f3a3570c4a2a16746ac2c31a7c7c7b0c186b95ce902e33db6f28094ed7387dda", size = 20735807, upload-time = "2026-05-18T23:37:14.07Z" }
@@ -1747,7 +1747,6 @@ requires-dist = [
{ name = "python-multipart", specifier = ">=0.0.29" },
{ name = "requests", specifier = ">=2.34.2" },
{ name = "ruff", specifier = ">=0.15" },
{ name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.0.0" },
{ name = "uuid7", specifier = ">=0.1.0" },
{ name = "uvicorn", specifier = ">=0.48.0" },
{ name = "websockets", specifier = ">=15.0" },
@@ -2716,10 +2715,10 @@ resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
sdist = { url = "https://files.pythonhosted.org/packages/5e/77/2dcfa996b01702ab8fd0763d84098f6a640d6162a328f1c04c2697579a1a/soupsieve-3.0.3.tar.gz", hash = "sha256:7dcf6022eed0399eb9934a75e020148f7a2024c37b7dfcd3cf2c5505d69c364e", size = 115923, upload-time = "2026-10-12T13:21:17.696Z" }

View File

@@ -9,6 +9,7 @@ import shutil
import subprocess
import sys
import time
import tomllib
from importlib.util import find_spec
from pathlib import Path
@@ -94,15 +95,6 @@ def load_toml(path: Path) -> dict:
dict
The parsed document.
"""
if sys.version_info >= (3, 11):
import tomllib
else:
if find_spec("tomli") is None:
subprocess.run(
[*get_uv(), "pip", "install", "--python", sys.executable, "tomli>=2"],
check=True,
)
import tomli as tomllib
return tomllib.loads(path.read_text(encoding="utf-8"))

View File

@@ -55,14 +55,9 @@ def resolve_explicit_config_path(
def _validate_explicit_toml(explicit_path: str) -> None:
"""Pre-parse the user-supplied config so malformed TOML fails loudly."""
import sys as _sys
import tomllib
from pathlib import Path
if _sys.version_info >= (3, 11): # pragma: no cover
import tomllib
else: # pragma: no cover
import tomli as tomllib
p = Path(explicit_path)
if not p.is_file():
return

View File

@@ -10,7 +10,6 @@ dependencies = [
"openbb-core>=2.0.1",
"fastapi>=0.138.2",
"fastmcp>=4.0.9",
"tomli>=2.0;python_version<'3.11'",
]
[project.optional-dependencies]

View File

@@ -6,12 +6,12 @@ resolution-markers = [
"python_full_version >= '3.15' and sys_platform == 'emscripten'",
"python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.14.*' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version == '3.14.*' and sys_platform != 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version < '3.12' and sys_platform == 'win32'",
"python_full_version < '3.12' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
@@ -1861,8 +1861,8 @@ resolution-markers = [
"python_full_version >= '3.15' and sys_platform == 'emscripten'",
"python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'",
"python_full_version == '3.14.*' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version == '3.14.*' and sys_platform != 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'",
]
@@ -2049,7 +2049,6 @@ requires-dist = [
{ name = "fastmcp", specifier = ">=4.0.9" },
{ name = "openbb-cli", marker = "extra == 'cli'", specifier = ">=2.0.1" },
{ name = "openbb-core", specifier = ">=2.0.1" },
{ name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.0" },
]
provides-extras = ["cli"]

View File

@@ -127,14 +127,9 @@ def _validate_explicit_toml(explicit_path: str) -> None:
Missing files are tolerated (cascade behavior) — only
parse failures escalate.
"""
import sys as _sys
import tomllib
from pathlib import Path
if _sys.version_info >= (3, 11): # pragma: no cover — version-conditional
import tomllib
else: # pragma: no cover — exercised only on the 3.10 backport path
import tomli as tomllib # ty: ignore[unresolved-import]
p = Path(explicit_path)
if not p.is_file():
return

View File

@@ -9,8 +9,6 @@ requires-python = ">=3.11,<4"
dependencies = [
"openbb-core>=2.0.1",
"deepdiff>=8.6.2",
# Backport of stdlib ``tomllib`` for py3.10.
"tomli>=2.0;python_version<'3.11'",
]
[project.scripts]

View File

@@ -3,8 +3,8 @@ revision = 3
requires-python = ">=3.11, <4"
resolution-markers = [
"python_full_version >= '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"python_full_version >= '3.14' and sys_platform != 'emscripten'",
"python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'",
"(python_full_version < '3.14' and sys_platform != 'emscripten') or (python_full_version < '3.12' and sys_platform == 'emscripten')",
]
@@ -1496,7 +1496,6 @@ dev = [
requires-dist = [
{ name = "deepdiff", specifier = ">=8.6.2" },
{ name = "openbb-core", specifier = ">=2.0.1" },
{ name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.0" },
]
[package.metadata.requires-dev]