diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7825e2b7..57f351b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,11 @@ jobs: strategy: matrix: config: - - {platform: ubuntu-latest, python-version: 3.7} - - {platform: ubuntu-latest, python-version: 3.8} - - {platform: ubuntu-latest, python-version: 3.9} - - {platform: windows-latest, python-version: 3.9} + - {platform: ubuntu-latest, python-version: "3.8"} + - {platform: ubuntu-latest, python-version: "3.9"} + - {platform: ubuntu-latest, python-version: "3.10"} + - {platform: ubuntu-latest, python-version: "3.11"} + - {platform: windows-latest, python-version: "3.11"} steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 5770c40e..ae52710a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ nanoemoji --helpfull nanoemoji --color_format glyf_colr_1 $(find ../noto-emoji/svg -name 'emoji_u270d*.svg') ``` -Requires Python 3.7 or greater. +Requires Python 3.8 or greater. ## Color table support diff --git a/setup.py b/setup.py index 9f110c00..fe9dc81c 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ "picosvg>=0.22.1", "pillow>=7.2.0", "regex>=2020.4.4", - "tomlkit", + "toml>=0.10.1", "ufo2ft[cffsubr]>=2.24.0", "ufoLib2>=0.6.2", "resvg-cli>=0.22.0.post3", @@ -53,8 +53,7 @@ "pngquant-cli>=2.17.0.post5", ], extras_require=extras_require, - # this is so we can use the built-in dataclasses module - python_requires=">=3.7", + python_requires=">=3.8", # this is for type checker to use our inline type hints: # https://www.python.org/dev/peps/pep-0561/#id18 diff --git a/src/nanoemoji/config.py b/src/nanoemoji/config.py index a44d22a4..0d18c0d5 100644 --- a/src/nanoemoji/config.py +++ b/src/nanoemoji/config.py @@ -20,9 +20,9 @@ import importlib_resources as resources # pytype: disable=import-error import itertools -import tomlkit from pathlib import Path from picosvg.svg_transform import Affine2D +import toml from typing import Any, Iterable, MutableMapping, NamedTuple, Optional, Tuple, Sequence from nanoemoji import util @@ -247,20 +247,6 @@ def default(self) -> MasterConfig: raise ValueError("Must have a default master") -def toml_strip(data): - """ - Workaround for: - https://github.com/sdispater/tomlkit/issues/240 - """ - new_data = {} - for key, val in data.items(): - if isinstance(val, dict): - val = toml_strip(val) - if val is not None: - new_data[key] = val - return new_data - - def write(dest: Path, config: FontConfig): toml_cfg = { "family": config.family, @@ -302,8 +288,7 @@ def write(dest: Path, config: FontConfig): for m in config.masters }, } - with open(dest, "w") as toml_file: - tomlkit.dump(toml_strip(toml_cfg), toml_file) + dest.write_text(toml.dumps(toml_cfg)) def _resolve_config( @@ -311,11 +296,9 @@ def _resolve_config( ) -> Tuple[Optional[Path], MutableMapping[str, Any]]: if config_file is None: with resources.path("nanoemoji.data", _DEFAULT_CONFIG_FILE) as config_file: - with open(config_file) as file: - # no config_dir in this context; bad input if we need it - return None, tomlkit.load(file) - with open(config_file) as file: - return config_file.parent, tomlkit.load(file) + # no config_dir in this context; bad input if we need it + return None, toml.load(config_file) + return config_file.parent, toml.load(config_file) def _resolve_src(relative_base: Optional[Path], src: str) -> Iterable[Path]: diff --git a/tox.ini b/tox.ini index 185241c7..d3efbe26 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ ; $ export TOXENV=py39 ; $ tox ; # If present use $TOXENV environment variable -envlist = lint, py3{7,8,9} +envlist = lint, py3{8,9,10,11} ; if any of the requested python interpreters is unavailable (e.g. on the local dev ; workstation), the tests are skipped and tox won't return an error