Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace 'pytoml' with 'toml'. #315

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To get a development installation of Flit itself::

git clone https://github.com/takluyver/flit.git
cd flit
python3 -m pip install docutils requests pytoml
python3 -m pip install docutils requests toml
python3 bootstrap_dev.py

This links Flit into the current Python environment, so you can make changes
Expand Down
2 changes: 1 addition & 1 deletion doc/pyproject_toml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Here's the full metadata section from flit itself:
"requests",
"docutils",
"requests_download",
"pytoml",
"toml",
]
requires-python="3"
description-file="README.rst"
Expand Down
2 changes: 1 addition & 1 deletion flit/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
import re
import sys
import pytoml as toml
import toml

def get_data_dir():
"""Get the directory path for flit user data files.
Expand Down
8 changes: 4 additions & 4 deletions flit/tomlify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import configparser
import os
from pathlib import Path
import pytoml
import toml

from .inifile import metadata_list_fields
from .init import TEMPLATE
Expand Down Expand Up @@ -40,11 +40,11 @@ def convert(path):

written_entrypoints = False
with Path('pyproject.toml').open('w', encoding='utf-8') as f:
f.write(TEMPLATE.format(metadata=pytoml.dumps(metadata)))
f.write(TEMPLATE.format(metadata=toml.dumps(metadata)))

if scripts:
f.write('\n[tool.flit.scripts]\n')
pytoml.dump(scripts, f)
toml.dump(scripts, f)

for groupname, group in entrypoints.items():
if not dict(group):
Expand All @@ -53,7 +53,7 @@ def convert(path):
if '.' in groupname:
groupname = '"{}"'.format(groupname)
f.write('\n[tool.flit.entrypoints.{}]\n'.format(groupname))
pytoml.dump(OrderedDict(group), f)
toml.dump(OrderedDict(group), f)
written_entrypoints = True

print("Written 'pyproject.toml'")
Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/build_thyself.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'summary': ('Distribution-building parts of Flit. '
'See flit package for more information'),
'requires_dist': [
'pytoml',
'toml',
],
'requires_python': '>=2.7, !=3.0, !=3.1, !=3.2, != 3.3',
'classifiers': [
Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/inifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import os
import os.path as osp
import pytoml as toml
import toml
import re
import sys

Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, module, metadata, cfgdir, reqs_by_extra, entrypoints,

@classmethod
def from_ini_path(cls, ini_path):
# Local import so bootstrapping doesn't try to load pytoml
# Local import so bootstrapping doesn't try to load toml
from . import inifile
ini_info = inifile.read_flit_config(ini_path)
srcdir = osp.dirname(ini_path)
Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, directory, module, metadata, entrypoints, target_fp):

@classmethod
def from_ini_path(cls, ini_path, target_fp):
# Local import so bootstrapping doesn't try to load pytoml
# Local import so bootstrapping doesn't try to load toml
from . import inifile
directory = osp.dirname(ini_path)
ini_info = inifile.read_flit_config(ini_path)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires=[
"flit_core>=2.2.0",
"requests",
"docutils",
"pytoml",
"toml",
"zipfile36; python_version in '3.3 3.4 3.5'",
]
requires-python=">=3.5"
Expand Down
10 changes: 5 additions & 5 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from testpath import assert_isfile
from unittest.mock import patch

import pytoml
import toml

from flit import init

Expand Down Expand Up @@ -106,7 +106,7 @@ def test_init():
generated = Path(td) / 'pyproject.toml'
assert_isfile(generated)
with generated.open() as f:
data = pytoml.load(f)
data = toml.load(f)
assert data['tool']['flit']['metadata'][
'author-email'] == "test@example.com"
license = Path(td) / 'LICENSE'
Expand All @@ -130,7 +130,7 @@ def test_init_homepage_and_license_are_optional():
ti = init.TerminalIniter(td)
ti.initialise()
with Path(td, 'pyproject.toml').open() as f:
data = pytoml.load(f)
data = toml.load(f)
assert not Path(td, 'LICENSE').exists()
metadata = data['tool']['flit']['metadata']
assert metadata == {
Expand All @@ -153,7 +153,7 @@ def test_init_homepage_validator():
ti = init.TerminalIniter(td)
ti.initialise()
with Path(td, 'pyproject.toml').open() as f:
data = pytoml.load(f)
data = toml.load(f)
metadata = data['tool']['flit']['metadata']
assert metadata == {
'author': 'Test Author',
Expand All @@ -175,7 +175,7 @@ def test_author_email_field_is_optional():
ti = init.TerminalIniter(td)
ti.initialise()
with Path(td, 'pyproject.toml').open() as f:
data = pytoml.load(f)
data = toml.load(f)
assert not Path(td, 'LICENSE').exists()
metadata = data['tool']['flit']['metadata']
assert metadata == {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_tomlify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from pathlib import Path
import pytoml
import toml
from shutil import copy
from testpath import assert_isfile

Expand All @@ -18,7 +18,7 @@ def test_tomlify(copy_sample, monkeypatch):
assert_isfile(pyproject_toml)

with pyproject_toml.open(encoding='utf-8') as f:
content = pytoml.load(f)
content = toml.load(f)

assert 'build-system' in content
assert 'tool' in content
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deps =
testpath
responses
docutils
pytoml
toml
pytest>=2.7.3
pytest-cov

Expand Down