|
|
2acc408 |
From b81b1da55ef0f2768413669725d2874fcb0c29fb Mon Sep 17 00:00:00 2001
|
|
|
2acc408 |
From: Kale Kundert <kale@thekunderts.net>
|
|
|
2acc408 |
Date: Sun, 2 Feb 2020 19:22:34 -0500
|
|
|
2acc408 |
Subject: [PATCH] Replace 'pytoml' with 'toml'
|
|
|
2acc408 |
|
|
|
2acc408 |
The pytoml package is deprecated, and doesn't support the most recent
|
|
|
2acc408 |
TOML standard (e.g. dotted keys).
|
|
|
2acc408 |
---
|
|
|
2acc408 |
doc/development.rst | 2 +-
|
|
|
2acc408 |
doc/pyproject_toml.rst | 2 +-
|
|
|
2acc408 |
flit/init.py | 2 +-
|
|
|
2acc408 |
flit/tomlify.py | 8 ++++----
|
|
|
2acc408 |
flit_core/flit_core/build_thyself.py | 2 +-
|
|
|
2acc408 |
flit_core/flit_core/config.py | 2 +-
|
|
|
2acc408 |
flit_core/flit_core/sdist.py | 2 +-
|
|
|
2acc408 |
flit_core/flit_core/wheel.py | 2 +-
|
|
|
2acc408 |
pyproject.toml | 2 +-
|
|
|
2acc408 |
tests/test_init.py | 12 ++++++------
|
|
|
2acc408 |
tests/test_tomlify.py | 4 ++--
|
|
|
2acc408 |
tox.ini | 2 +-
|
|
|
2acc408 |
12 files changed, 21 insertions(+), 21 deletions(-)
|
|
|
2acc408 |
|
|
|
2acc408 |
diff --git a/doc/development.rst b/doc/development.rst
|
|
|
2acc408 |
index 9b8dc5e..f714999 100644
|
|
|
2acc408 |
--- a/doc/development.rst
|
|
|
2acc408 |
+++ b/doc/development.rst
|
|
|
2acc408 |
@@ -5,7 +5,7 @@ To get a development installation of Flit itself::
|
|
|
2acc408 |
|
|
|
2acc408 |
git clone https://github.com/takluyver/flit.git
|
|
|
2acc408 |
cd flit
|
|
|
2acc408 |
- python3 -m pip install docutils requests pytoml
|
|
|
2acc408 |
+ python3 -m pip install docutils requests toml
|
|
|
2acc408 |
python3 bootstrap_dev.py
|
|
|
2acc408 |
|
|
|
2acc408 |
This links Flit into the current Python environment, so you can make changes
|
|
|
2acc408 |
diff --git a/doc/pyproject_toml.rst b/doc/pyproject_toml.rst
|
|
|
2acc408 |
index f9ddc7f..8d38bf9 100644
|
|
|
2acc408 |
--- a/doc/pyproject_toml.rst
|
|
|
2acc408 |
+++ b/doc/pyproject_toml.rst
|
|
|
2acc408 |
@@ -120,7 +120,7 @@ Here's the full metadata section from flit itself:
|
|
|
2acc408 |
"flit_core>=2.2.0",
|
|
|
2acc408 |
"requests",
|
|
|
2acc408 |
"docutils",
|
|
|
2acc408 |
- "pytoml",
|
|
|
2acc408 |
+ "toml",
|
|
|
2acc408 |
"zipfile36; python_version in '3.3 3.4 3.5'",
|
|
|
2acc408 |
]
|
|
|
2acc408 |
requires-python=">=3.5"
|
|
|
2acc408 |
diff --git a/flit/init.py b/flit/init.py
|
|
|
2acc408 |
index f7ea93a..b0c77c6 100644
|
|
|
2acc408 |
--- a/flit/init.py
|
|
|
2acc408 |
+++ b/flit/init.py
|
|
|
2acc408 |
@@ -5,7 +5,7 @@
|
|
|
2acc408 |
from pathlib import Path
|
|
|
2acc408 |
import re
|
|
|
2acc408 |
import sys
|
|
|
2acc408 |
-import pytoml as toml
|
|
|
2acc408 |
+import toml
|
|
|
2acc408 |
|
|
|
2acc408 |
def get_data_dir():
|
|
|
2acc408 |
"""Get the directory path for flit user data files.
|
|
|
2acc408 |
diff --git a/flit/tomlify.py b/flit/tomlify.py
|
|
|
2acc408 |
index 0c8db69..a9c9c60 100644
|
|
|
2acc408 |
--- a/flit/tomlify.py
|
|
|
2acc408 |
+++ b/flit/tomlify.py
|
|
|
2acc408 |
@@ -5,7 +5,7 @@
|
|
|
2acc408 |
import configparser
|
|
|
2acc408 |
import os
|
|
|
2acc408 |
from pathlib import Path
|
|
|
2acc408 |
-import pytoml
|
|
|
2acc408 |
+import toml
|
|
|
2acc408 |
|
|
|
2acc408 |
from .config import metadata_list_fields
|
|
|
2acc408 |
from .init import TEMPLATE
|
|
|
2acc408 |
@@ -40,11 +40,11 @@ def convert(path):
|
|
|
2acc408 |
|
|
|
2acc408 |
written_entrypoints = False
|
|
|
2acc408 |
with Path('pyproject.toml').open('w', encoding='utf-8') as f:
|
|
|
2acc408 |
- f.write(TEMPLATE.format(metadata=pytoml.dumps(metadata)))
|
|
|
2acc408 |
+ f.write(TEMPLATE.format(metadata=toml.dumps(metadata)))
|
|
|
2acc408 |
|
|
|
2acc408 |
if scripts:
|
|
|
2acc408 |
f.write('\n[tool.flit.scripts]\n')
|
|
|
2acc408 |
- pytoml.dump(scripts, f)
|
|
|
2acc408 |
+ toml.dump(scripts, f)
|
|
|
2acc408 |
|
|
|
2acc408 |
for groupname, group in entrypoints.items():
|
|
|
2acc408 |
if not dict(group):
|
|
|
2acc408 |
@@ -53,7 +53,7 @@ def convert(path):
|
|
|
2acc408 |
if '.' in groupname:
|
|
|
2acc408 |
groupname = '"{}"'.format(groupname)
|
|
|
2acc408 |
f.write('\n[tool.flit.entrypoints.{}]\n'.format(groupname))
|
|
|
2acc408 |
- pytoml.dump(OrderedDict(group), f)
|
|
|
2acc408 |
+ toml.dump(OrderedDict(group), f)
|
|
|
2acc408 |
written_entrypoints = True
|
|
|
2acc408 |
|
|
|
2acc408 |
print("Written 'pyproject.toml'")
|
|
|
2acc408 |
diff --git a/flit_core/flit_core/build_thyself.py b/flit_core/flit_core/build_thyself.py
|
|
|
2acc408 |
index 7daf67f..f3aaf7c 100644
|
|
|
2acc408 |
--- a/flit_core/flit_core/build_thyself.py
|
|
|
2acc408 |
+++ b/flit_core/flit_core/build_thyself.py
|
|
|
2acc408 |
@@ -25,7 +25,7 @@
|
|
|
2acc408 |
'summary': ('Distribution-building parts of Flit. '
|
|
|
2acc408 |
'See flit package for more information'),
|
|
|
2acc408 |
'requires_dist': [
|
|
|
2acc408 |
- 'pytoml',
|
|
|
2acc408 |
+ 'toml',
|
|
|
2acc408 |
],
|
|
|
2acc408 |
'requires_python': '>=3.4',
|
|
|
2acc408 |
'classifiers': [
|
|
|
2acc408 |
diff --git a/flit_core/flit_core/config.py b/flit_core/flit_core/config.py
|
|
|
2acc408 |
index 0af9c00..6ed20d3 100644
|
|
|
2acc408 |
--- a/flit_core/flit_core/config.py
|
|
|
2acc408 |
+++ b/flit_core/flit_core/config.py
|
|
|
2acc408 |
@@ -3,7 +3,7 @@
|
|
|
2acc408 |
import logging
|
|
|
2acc408 |
import os
|
|
|
2acc408 |
import os.path as osp
|
|
|
2acc408 |
-import pytoml as toml
|
|
|
2acc408 |
+import toml
|
|
|
2acc408 |
import re
|
|
|
2acc408 |
|
|
|
2acc408 |
log = logging.getLogger(__name__)
|
|
|
2acc408 |
diff --git a/flit_core/flit_core/sdist.py b/flit_core/flit_core/sdist.py
|
|
|
2acc408 |
index 1fe5bb4..963b4e5 100644
|
|
|
2acc408 |
--- a/flit_core/flit_core/sdist.py
|
|
|
2acc408 |
+++ b/flit_core/flit_core/sdist.py
|
|
|
2acc408 |
@@ -95,7 +95,7 @@ def __init__(self, module, metadata, cfgdir, reqs_by_extra, entrypoints,
|
|
|
2acc408 |
|
|
|
2acc408 |
@classmethod
|
|
|
2acc408 |
def from_ini_path(cls, ini_path: Path):
|
|
|
2acc408 |
- # Local import so bootstrapping doesn't try to load pytoml
|
|
|
2acc408 |
+ # Local import so bootstrapping doesn't try to load toml
|
|
|
2acc408 |
from .config import read_flit_config
|
|
|
2acc408 |
ini_info = read_flit_config(ini_path)
|
|
|
2acc408 |
srcdir = ini_path.parent
|
|
|
2acc408 |
diff --git a/flit_core/flit_core/wheel.py b/flit_core/flit_core/wheel.py
|
|
|
2acc408 |
index 1550846..2bc55e1 100644
|
|
|
2acc408 |
--- a/flit_core/flit_core/wheel.py
|
|
|
2acc408 |
+++ b/flit_core/flit_core/wheel.py
|
|
|
2acc408 |
@@ -83,7 +83,7 @@ def __init__(self, directory, module, metadata, entrypoints, target_fp):
|
|
|
2acc408 |
|
|
|
2acc408 |
@classmethod
|
|
|
2acc408 |
def from_ini_path(cls, ini_path, target_fp):
|
|
|
2acc408 |
- # Local import so bootstrapping doesn't try to load pytoml
|
|
|
2acc408 |
+ # Local import so bootstrapping doesn't try to load toml
|
|
|
2acc408 |
from .config import read_flit_config
|
|
|
2acc408 |
directory = ini_path.parent
|
|
|
2acc408 |
ini_info = read_flit_config(ini_path)
|
|
|
2acc408 |
diff --git a/pyproject.toml b/pyproject.toml
|
|
|
2acc408 |
index ac8d001..0af74b2 100644
|
|
|
2acc408 |
--- a/pyproject.toml
|
|
|
2acc408 |
+++ b/pyproject.toml
|
|
|
2acc408 |
@@ -11,7 +11,7 @@ requires=[
|
|
|
2acc408 |
"flit_core>=3.0.0",
|
|
|
2acc408 |
"requests",
|
|
|
2acc408 |
"docutils",
|
|
|
2acc408 |
- "pytoml",
|
|
|
2acc408 |
+ "toml",
|
|
|
2acc408 |
"zipfile36; python_version in '3.3 3.4 3.5'",
|
|
|
2acc408 |
]
|
|
|
2acc408 |
requires-python=">=3.5"
|
|
|
2acc408 |
diff --git a/tests/test_init.py b/tests/test_init.py
|
|
|
2acc408 |
index fb8ad4d..7330ff5 100644
|
|
|
2acc408 |
--- a/tests/test_init.py
|
|
|
2acc408 |
+++ b/tests/test_init.py
|
|
|
2acc408 |
@@ -6,7 +6,7 @@
|
|
|
2acc408 |
from unittest.mock import patch
|
|
|
2acc408 |
import pytest
|
|
|
2acc408 |
|
|
|
2acc408 |
-import pytoml
|
|
|
2acc408 |
+import toml
|
|
|
2acc408 |
|
|
|
2acc408 |
from flit import init
|
|
|
2acc408 |
|
|
|
2acc408 |
@@ -107,7 +107,7 @@ def test_init():
|
|
|
2acc408 |
generated = Path(td) / 'pyproject.toml'
|
|
|
2acc408 |
assert_isfile(generated)
|
|
|
2acc408 |
with generated.open() as f:
|
|
|
2acc408 |
- data = pytoml.load(f)
|
|
|
2acc408 |
+ data = toml.load(f)
|
|
|
2acc408 |
assert data['tool']['flit']['metadata'][
|
|
|
2acc408 |
'author-email'] == "test@example.com"
|
|
|
2acc408 |
license = Path(td) / 'LICENSE'
|
|
|
2acc408 |
@@ -131,7 +131,7 @@ def test_init_homepage_and_license_are_optional():
|
|
|
2acc408 |
ti = init.TerminalIniter(td)
|
|
|
2acc408 |
ti.initialise()
|
|
|
2acc408 |
with Path(td, 'pyproject.toml').open() as f:
|
|
|
2acc408 |
- data = pytoml.load(f)
|
|
|
2acc408 |
+ data = toml.load(f)
|
|
|
2acc408 |
assert not Path(td, 'LICENSE').exists()
|
|
|
2acc408 |
metadata = data['tool']['flit']['metadata']
|
|
|
2acc408 |
assert metadata == {
|
|
|
2acc408 |
@@ -154,7 +154,7 @@ def test_init_homepage_validator():
|
|
|
2acc408 |
ti = init.TerminalIniter(td)
|
|
|
2acc408 |
ti.initialise()
|
|
|
2acc408 |
with Path(td, 'pyproject.toml').open() as f:
|
|
|
2acc408 |
- data = pytoml.load(f)
|
|
|
2acc408 |
+ data = toml.load(f)
|
|
|
2acc408 |
metadata = data['tool']['flit']['metadata']
|
|
|
2acc408 |
assert metadata == {
|
|
|
2acc408 |
'author': 'Test Author',
|
|
|
2acc408 |
@@ -176,7 +176,7 @@ def test_author_email_field_is_optional():
|
|
|
2acc408 |
ti = init.TerminalIniter(td)
|
|
|
2acc408 |
ti.initialise()
|
|
|
2acc408 |
with Path(td, 'pyproject.toml').open() as f:
|
|
|
2acc408 |
- data = pytoml.load(f)
|
|
|
2acc408 |
+ data = toml.load(f)
|
|
|
2acc408 |
assert not Path(td, 'LICENSE').exists()
|
|
|
2acc408 |
metadata = data['tool']['flit']['metadata']
|
|
|
2acc408 |
assert metadata == {
|
|
|
2acc408 |
@@ -216,7 +216,7 @@ def test_init_readme_found_yes_choosen():
|
|
|
2acc408 |
ti = init.TerminalIniter(td)
|
|
|
2acc408 |
ti.initialise()
|
|
|
2acc408 |
with Path(td, 'pyproject.toml').open() as f:
|
|
|
2acc408 |
- data = pytoml.load(f)
|
|
|
2acc408 |
+ data = toml.load(f)
|
|
|
2acc408 |
|
|
|
2acc408 |
metadata = data['tool']['flit']['metadata']
|
|
|
2acc408 |
assert metadata == {
|
|
|
2acc408 |
diff --git a/tests/test_tomlify.py b/tests/test_tomlify.py
|
|
|
2acc408 |
index 2bd75dc..a7b7978 100644
|
|
|
2acc408 |
--- a/tests/test_tomlify.py
|
|
|
2acc408 |
+++ b/tests/test_tomlify.py
|
|
|
2acc408 |
@@ -1,6 +1,6 @@
|
|
|
2acc408 |
import os
|
|
|
2acc408 |
from pathlib import Path
|
|
|
2acc408 |
-import pytoml
|
|
|
2acc408 |
+import toml
|
|
|
2acc408 |
from shutil import copy
|
|
|
2acc408 |
from testpath import assert_isfile
|
|
|
2acc408 |
|
|
|
2acc408 |
@@ -18,7 +18,7 @@ def test_tomlify(copy_sample, monkeypatch):
|
|
|
2acc408 |
assert_isfile(pyproject_toml)
|
|
|
2acc408 |
|
|
|
2acc408 |
with pyproject_toml.open(encoding='utf-8') as f:
|
|
|
2acc408 |
- content = pytoml.load(f)
|
|
|
2acc408 |
+ content = toml.load(f)
|
|
|
2acc408 |
|
|
|
2acc408 |
assert 'build-system' in content
|
|
|
2acc408 |
assert 'tool' in content
|
|
|
2acc408 |
diff --git a/tox.ini b/tox.ini
|
|
|
2acc408 |
index 08ce1bf..d1025e1 100644
|
|
|
2acc408 |
--- a/tox.ini
|
|
|
2acc408 |
+++ b/tox.ini
|
|
|
2acc408 |
@@ -18,7 +18,7 @@ deps =
|
|
|
2acc408 |
testpath
|
|
|
2acc408 |
responses
|
|
|
2acc408 |
docutils
|
|
|
2acc408 |
- pytoml
|
|
|
2acc408 |
+ toml
|
|
|
2acc408 |
pytest>=2.7.3
|
|
|
2acc408 |
pytest-cov
|
|
|
2acc408 |
|