mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
fix(docs): Update tomllib import handling and streamline pyproject path resolution
This commit is contained in:
13
docs/conf.py
13
docs/conf.py
@ -16,23 +16,18 @@
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
import doctest
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ImportError:
|
||||
except ModuleNotFoundError:
|
||||
# For Python < 3.11
|
||||
import tomli as tomllib # type: ignore
|
||||
import tomli as tomllib # type: ignore (In case of >3.11 Pyrefly doesnt find tomli , which is right but a false flag)
|
||||
|
||||
# Path to pyproject.toml (assuming conf.py is in a 'docs' subdirectory)
|
||||
try:
|
||||
from libp2p.utils.paths import get_project_root, join_paths
|
||||
pyproject_path = join_paths(get_project_root(), "pyproject.toml")
|
||||
except ImportError:
|
||||
# Fallback for documentation builds where libp2p is not available
|
||||
import os
|
||||
pyproject_path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml")
|
||||
pyproject_path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml")
|
||||
|
||||
with open(pyproject_path, "rb") as f:
|
||||
pyproject_data = tomllib.load(f)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Fixed cross-platform path handling by replacing hardcoded OS-specific
|
||||
paths with standardized utilities in core modules and examples.
|
||||
Fixed cross-platform path handling by replacing hardcoded OS-specific
|
||||
paths with standardized utilities in core modules and examples.
|
||||
|
||||
Reference in New Issue
Block a user