[bumpversion]
-current_version = 54.0.0
+current_version = 54.1.0
commit = True
tag = True
+v54.1.0
+-------
+
+
+Changes
+^^^^^^^
+* #1608: Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li`
+
+
v54.0.0
-------
),
}
+intersphinx_mapping = {
+ 'pypa-build': ('https://pypa-build.readthedocs.io/en/latest/', None)
+}
# Add support for linking usernames
github_url = 'https://github.com'
extlinks = {
'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323
}
-extensions += ['sphinx.ext.extlinks']
+extensions += ['sphinx.ext.extlinks', 'sphinx.ext.intersphinx']
# Be strict about any broken references:
nitpicky = True
setup.cfg
mypackage/__init__.py
-Then, you need an installer, such as `pep517 <https://pypi.org/project/pep517/>`_
-which you can obtain via ``pip install pep517``. After downloading it, invoke
-the installer::
+Then, you need an builder, such as :std:doc:`PyPA build <pypa-build:index>`
+which you can obtain via ``pip install build``. After downloading it, invoke
+the builder::
- python -m pep517.build .
+ python -m build
You now have your distribution ready (e.g. a ``tar.gz`` file and a ``.whl``
file in the ``dist`` directory), which you can upload to PyPI!
license_files =
LICENSE
name = setuptools
-version = 54.0.0
+version = 54.1.0
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
for key, val in ei_opts.items():
if key not in fetch_directives:
continue
- fetch_options[key.replace('_', '-')] = val[1]
+ fetch_options[key] = val[1]
# create a settings dictionary suitable for `edit_config`
settings = dict(easy_install=fetch_options)
cfg_filename = os.path.join(base, 'setup.cfg')
continue
val = parser.get(section, opt)
- opt = opt.replace('-', '_')
+ opt = self.dash_to_underscore_warning(opt, section)
opt_dict[opt] = (filename, val)
# Make the ConfigParser forget everything (so we retain
except ValueError as e:
raise DistutilsOptionError(e) from e
+ def dash_to_underscore_warning(self, opt, section):
+ if section in (
+ 'options.extras_require', 'options.data_files',
+ ):
+ return opt
+ underscore_opt = opt.replace('-', '_')
+ if '-' in opt:
+ warnings.warn(
+ "Usage of dash-separated '%s' will not be supported in future "
+ "versions. Please use the underscore name '%s' instead"
+ % (opt, underscore_opt))
+ return underscore_opt
+
# FIXME: 'Distribution._set_command_options' is too complex (14)
def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
"""
'setup.cfg': DALS(
"""
[build]
- build-base = foo_build
+ build_base = foo_build
"""),
}
path.build(files)
fake_env(
tmpdir,
'[metadata]\n'
- 'author-email = test@test.com\n'
- 'home-page = http://test.test.com/test/\n'
+ 'author_email = test@test.com\n'
+ 'home_page = http://test.test.com/test/\n'
'summary = Short summary\n'
'platform = a, b\n'
'classifier =\n'
with get_dist(tmpdir):
pass
+ def test_dash_to_underscore_warning(self, tmpdir):
+ # dash_to_underscore_warning() is a method in setuptools.dist
+ # remove this test and method when dash convert to underscore in setup.cfg
+ # is no longer supported
+ fake_env(
+ tmpdir,
+ '[metadata]\n'
+ 'author-email = test@test.com\n'
+ 'maintainer_email = foo@foo.com\n'
+ )
+ msg = ("Usage of dash-separated 'author-email' will not be supported "
+ "in future versions. "
+ "Please use the underscore name 'author_email' instead")
+ with pytest.warns(UserWarning, match=msg):
+ with get_dist(tmpdir) as dist:
+ metadata = dist.metadata
+ assert metadata.author_email == 'test@test.com'
+ assert metadata.maintainer_email == 'foo@foo.com'
+
class TestOptions:
}
assert dist.metadata.provides_extras == set(['pdf', 'rest'])
+ def test_dash_preserved_extras_require(self, tmpdir):
+ fake_env(
+ tmpdir,
+ '[options.extras_require]\n'
+ 'foo-a = foo\n'
+ 'foo_b = test\n'
+ )
+
+ with get_dist(tmpdir) as dist:
+ assert dist.extras_require == {
+ 'foo-a': ['foo'],
+ 'foo_b': ['test']
+ }
+
def test_entry_points(self, tmpdir):
_, config = fake_env(
tmpdir,