Skip to content

Commit

Permalink
Switch from toml to tomli for TOML v1 compat (#622)
Browse files Browse the repository at this point in the history
* Switch from `toml` to `tomli` for TOML v1 compat

* Fix docs build by adding upper pinning to Sphinx
  • Loading branch information
hukkin committed Jul 15, 2021
1 parent 773c9cd commit a8bb13a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/requirements-docs.txt
@@ -1,4 +1,4 @@
myst-parser>=0.12.0
Sphinx>=3.2.0
Sphinx>=3.2.0,<4.1.0
sphinx-copybutton>=0.3.0
sphinx-rtd-theme>=0.5.0
7 changes: 4 additions & 3 deletions nbqa/__main__.py
Expand Up @@ -19,7 +19,7 @@
Tuple,
)

import toml
import tomli
from pkg_resources import parse_version

from nbqa import replace_source, save_source
Expand Down Expand Up @@ -309,9 +309,10 @@ def _get_configs(cli_args: CLIArgs, project_root: Path) -> Configs:
config = get_default_config()

# If a section is in pyproject.toml, use that.
if (project_root / "pyproject.toml").is_file():
pyproject_path = project_root / "pyproject.toml"
if pyproject_path.is_file():

config_file = toml.load(str(project_root / "pyproject.toml"))
config_file = tomli.loads(pyproject_path.read_text("utf-8"))
if "tool" in config_file and "nbqa" in config_file["tool"]:
file_config = config_file["tool"]["nbqa"]
for section in config:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -35,7 +35,7 @@ py_modules = nbqa
install_requires =
ipython>=7.8.0
tokenize-rt>=3.2.0
toml
tomli<2.0.0
importlib_metadata;python_version < '3.8'
python_requires = >=3.6.0

Expand Down

0 comments on commit a8bb13a

Please sign in to comment.