Upgrade from tomlkit to tomli

This commit is contained in:
Dan Yeaw 2021-09-04 16:12:24 -04:00
parent 46030fc997
commit 9ecf784458
No known key found for this signature in database
GPG Key ID: 42239C515C9B9841
4 changed files with 10 additions and 9 deletions

View File

@ -16,8 +16,8 @@ from datetime import date
from pathlib import Path
from typing import Dict, List
import tomli
from recommonmark.transform import AutoStructify
from tomlkit import parse
# -- Project information -----------------------------------------------------
@ -29,7 +29,7 @@ author = "Arjan J. Molenaar"
version = ""
project_dir = Path(__file__).resolve().parent.parent
f = project_dir.joinpath("pyproject.toml")
release = str(parse(f.read_text())["tool"]["poetry"]["version"])
release = str(tomli.loads(f.read_text())["tool"]["poetry"]["version"])
sys.path.append(str(project_dir))
# -- General configuration ---------------------------------------------------

View File

@ -6,7 +6,7 @@ Sphinx==4.1.2
sphinx-rtd-theme==0.5.2
sphinxcontrib-websupport==1.2.4
sphinxcontrib-images==0.9.4
tomlkit==0.7.2
tomli==1.2.1
generic==1.0.0
typing_extensions==3.10.0.2
importlib_metadata==4.8.1

View File

@ -3,7 +3,7 @@ import subprocess
from pathlib import Path
import pyinstaller_versionfile
import tomlkit
import tomli
packaging_path = Path(__file__).resolve().parent
@ -11,13 +11,13 @@ packaging_path = Path(__file__).resolve().parent
def get_version() -> str:
project_dir = Path(__file__).resolve().parent.parent
f = project_dir / "pyproject.toml"
return str(tomlkit.parse(f.read_text())["tool"]["poetry"]["version"])
return str(tomli.loads(f.read_text())["tool"]["poetry"]["version"])
def make_gaphor_script():
pyproject_toml = packaging_path.parent / "pyproject.toml"
with open(pyproject_toml) as f:
toml = tomlkit.parse(f.read())
with open(pyproject_toml, "rb") as f:
toml = tomli.load(f)
gaphor_script = packaging_path / "gaphor-script.py"
with open(gaphor_script, "w") as file:

View File

@ -45,9 +45,10 @@ tinycss2 = "^1.0.2"
pyinstaller = { version = "^4.3", optional = true }
pyinstaller-versionfile = { version = "^2.0.0", optional = true }
poethepoet = { version = "^0.10.0", optional = true }
tomli = { version = "^1.2", optional = true }
[tool.poetry.dev-dependencies]
tomlkit = "^0.7"
tomli = "^1.2"
pytest = "^6.2"
pytest-cov = "^2.12"
pytest-mock = "^3.6.1"
@ -66,7 +67,7 @@ isort = "^5.9"
poethepoet = "^0.10.0"
[tool.poetry.extras]
pyinstall = ["poethepoet", "pyinstaller", "pyinstaller-versionfile"]
pyinstall = ["poethepoet", "pyinstaller", "pyinstaller-versionfile", "tomli"]
[tool.poetry.scripts]
gaphor = "gaphor.ui:main"