diff --git a/python/helpers/lib/parser.py b/python/helpers/lib/parser.py index c2cfc8ff40..17c5e6f80b 100644 --- a/python/helpers/lib/parser.py +++ b/python/helpers/lib/parser.py @@ -14,9 +14,9 @@ ) from packaging.requirements import InvalidRequirement, Requirement -# TODO: Replace 3p package `toml` with 3.11's new stdlib `tomllib` once we drop -# support for Python 3.10. -import toml +# TODO: Replace 3p package `tomli` with 3.11's new stdlib `tomllib` once we +# drop support for Python 3.10. +import tomli # Inspired by pips internal check: # https://github.com/pypa/pip/blob/0bb3ac87f5bb149bd75cceac000844128b574385/src/pip/_internal/req/req_file.py#L35 @@ -24,7 +24,8 @@ def parse_pep621_dependencies(pyproject_path): - project_toml = toml.load(pyproject_path) + with open(pyproject_path, "rb") as file: + project_toml = tomli.load(file) def parse_toml_section_pep621_dependencies(pyproject_path, dependencies): requirement_packages = [] diff --git a/python/helpers/requirements.txt b/python/helpers/requirements.txt index f5998ed5e9..f16e275938 100644 --- a/python/helpers/requirements.txt +++ b/python/helpers/requirements.txt @@ -7,8 +7,8 @@ hashin==1.0.3; python_version >= '3.9' pipenv==2024.0.2 plette==2.1.0 poetry==1.8.5 -# TODO: Replace 3p package `toml` with 3.11's new stdlib `tomllib` once we drop support for Python 3.10. -toml==0.10.2 +# TODO: Replace 3p package `tomli` with 3.11's new stdlib `tomllib` once we drop support for Python 3.10. +tomli==2.0.1 # Some dependencies will only install if Cython is present Cython==3.0.10