+v59.0.1
+-------
+
+
+Misc
+^^^^
+* #2880: Removed URL requirement for ``pytest-virtualenv`` in ``setup.cfg``.
+ PyPI rejects packages with dependencies external to itself.
+ Instead the test dependency was overwritten via ``tox.ini``
+
+
+v59.0.0
+-------
+
+
+Deprecations
+^^^^^^^^^^^^
+* #2856: Support for custom commands that inherit directly from ``distutils`` is
+ **deprecated**. Users should extend classes provided by setuptools instead.
+
+Breaking Changes
+^^^^^^^^^^^^^^^^
+* #2870: Started failing on invalid inline description with line breaks :class:`ValueError` -- by :user:`webknjaz`
+
+Changes
+^^^^^^^
+* #2698: Exposed exception classes from ``distutils.errors`` via ``setuptools.errors``.
+* #2866: Incorporate changes from pypa/distutils@f1b0a2b.
+
+Documentation changes
+^^^^^^^^^^^^^^^^^^^^^
+* #2227: Added sphinx theme customisations to display the new logo in the sidebar and
+ use its colours as "accent" in the documentation -- by :user:`abravalheri`
+* #2227: Added new setuptools logo, including editable files and artwork documentation
+ -- by :user:`abravalheri`
+* #2698: Added mentions to ``setuptools.errors`` as a way of handling custom command
+ errors.
+* #2698: Added instructions to migrate from ``distutils.commands`` and
+ ``distutils.errors`` in the porting guide.
+* #2871: Added a note to the docs that it is possible to install
+ ``setup.py``-less projects in editable mode with :doc:`pip v21.1+
+ <pip:index>`, only having ``setup.cfg`` and ``pyproject.toml`` in
+ project root -- by :user:`webknjaz`
+
+
v58.5.3
-------
some confusion.
Add some examples and the version since when ``entry_points`` are
supported in declarative configuration.
- Tried to make the reading flow a bit leaner, gather some informations
+ Tried to make the reading flow a bit leaner, gather some information
that were a bit dispersed.
* Fix test suite with Python 2.6.
* Fix some DeprecationWarnings and ResourceWarnings.
-* Distribute #335: Backed out ``setup_requires`` superceding installed requirements
+* Distribute #335: Backed out ``setup_requires`` superseding installed requirements
until regression can be addressed.
0.6.31
PYTHONIOENCODING=utf8 pip install numpy
* Fix for encoding issue when installing from Windows executable on Python 3.
-* Distribute #323: Allow ``setup_requires`` requirements to supercede installed
+* Distribute #323: Allow ``setup_requires`` requirements to supersede installed
requirements. Added some new keyword arguments to existing pkg_resources
methods. Also had to updated how __path__ is handled for namespace packages
to ensure that when a new egg distribution containing a namespace package is
* If Sphinx is installed, the ``upload_docs`` command now runs ``build_sphinx``
to produce uploadable documentation.
* Distribute #326: ``upload_docs`` provided mangled auth credentials under Python 3.
-* Distribute #320: Fix check for "createable" in distribute_setup.py.
+* Distribute #320: Fix check for "creatable" in distribute_setup.py.
* Distribute #305: Remove a warning that was triggered during normal operations.
* Distribute #311: Print metadata in UTF-8 independent of platform.
* Distribute #303: Read manifest file with UTF-8 encoding under Python 3.
* Distribute #301: Allow to run tests of namespace packages when using 2to3.
* Distribute #304: Prevent import loop in site.py under Python 3.3.
-* Distribute #283: Reenable scanning of ``*.pyc`` / ``*.pyo`` files on Python 3.3.
+* Distribute #283: Re-enable scanning of ``*.pyc`` / ``*.pyo`` files on Python 3.3.
* Distribute #299: The develop command didn't work on Python 3, when using 2to3,
as the egg link would go to the Python 2 source. Linking to the 2to3'd code
in build/lib makes it work, although you will have to rebuild the module
Metadata-Version: 2.1
Name: setuptools
-Version: 58.5.3
+Version: 59.0.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Provides-Extra: certs
License-File: LICENSE
+.. image:: https://raw.githubusercontent.com/pypa/setuptools/main/docs/images/banner-640x320.svg
+ :align: center
+
+|
+
.. image:: https://img.shields.io/pypi/v/setuptools.svg
:target: `PyPI link`_
+.. image:: https://raw.githubusercontent.com/pypa/setuptools/main/docs/images/banner-640x320.svg
+ :align: center
+
+|
+
.. image:: https://img.shields.io/pypi/v/setuptools.svg
:target: `PyPI link`_
# HTML theme
html_theme = 'furo'
+html_logo = "images/logo.png"
+html_favicon = "images/favicon.ico"
+
+html_theme_options = {
+ "sidebar_hide_name": True,
+ "light_css_variables": {
+ "color-brand-primary": "#336790", # "blue"
+ "color-brand-content": "#336790",
+ },
+ "dark_css_variables": {
+ "color-brand-primary": "#E5B62F", # "yellow"
+ "color-brand-content": "#E5B62F",
+ },
+}
# Add support for inline tabs
extensions += ['sphinx_inline_tabs']
towncrier_draft_include_empty = False
extensions += ['jaraco.tidelift']
+
+intersphinx_mapping['pip'] = 'https://pip.pypa.io/en/latest', None
``distutils.cmd.Command`` → ``setuptools.Command``
+``distutils.command.{build_clib,build_ext,build_py,sdist}`` → ``setuptools.command.*``
+
``distutils.log`` → (no replacement yet)
``distutils.version.*`` → ``packaging.version.*``
+``distutils.errors.*`` → ``setuptools.errors.*`` [#errors]_
+
If a project relies on uses of ``distutils`` that do not have a suitable replacement above, please search the `Setuptools issue tracker <https://github.com/pypa/setuptools/issues/>`_ and file a request, describing the use-case so that Setuptools' maintainers can investigate. Please provide enough detail to help the maintainers understand how distutils is used, what value it provides, and why that behavior should be supported.
+
+
+.. [#errors] Please notice errors related to the command line usage of
+ ``setup.py``, such as ``DistutilsArgError``, are intentionally not exposed
+ by setuptools, since this is considered a deprecated practice.
--- /dev/null
+=======
+Artwork
+=======
+
+.. figure:: logo-over-white.svg
+ :align: center
+
+ Setuptools logo, designed in 2021 by `Anderson Bravalheri`_
+
+Elements of Design
+==================
+
+The main colours of the design are a dark pastel azure (``#336790``) and a pale
+orange (``#E5B62F``), referred in this document simply as "blue" and "yellow"
+respectively. The text uses the *Monoid* typeface, an open source webfont that
+was developed by Andreas Larsen and contributors in 2015 and is distributed
+under the MIT or SIL licenses (more information at
+https://github.com/larsenwork/monoid)
+
+
+Usage
+=====
+
+The preferred way of using the setuptools logo is over a white (or light)
+background. Alternatively, the following options can be considered, depending
+on the circumstances:
+
+- *"negative"* design - for dark backgrounds (e.g. website displayed in "dark
+ mode"): the white colour (``#FFFFFF``) of the background and the "blue"
+ (``#336790``) colour of the design can be swapped.
+- *"monochrome"* - when colours are not available (e.g. black and white printed
+ media): a completely black or white version of the logo can also be used.
+- *"banner"* mode: the symbol and text can be used alongside depending on the
+ available space.
+
+The following image illustrate these alternatives:
+
+.. image:: logo-demo-editable-inkscape.png
+ :align: center
+
+Please refer to the SVG files in the `setuptools repository`_ for the specific
+shapes and proportions between the elements of the design.
+
+
+Working with the Design
+=======================
+
+The `setuptools repository`_ contains a series of vector representations of the
+design under the ``docs/images`` directory. These representations can be
+manipulated via any graphic editor that support SVG files,
+however the free and open-source software Inkscape_ is recommended for maximum
+compatibility.
+
+When selecting the right file to work with, file names including
+``editable-inkscape`` indicate "more editable" elements (e.g. editable text),
+while the others prioritise SVG paths for maximum reproducibility.
+
+Also notice that you might have to `install the correct fonts`_ to be able to
+visualise or edit some of the designs.
+
+
+Inspiration
+===========
+
+This design was inspired by :user:`cajhne`'s `original proposal`_ and the
+ancient symbol of the ouroboros_.
+It features a snake moving in a circular trajectory not only as a reference to
+the Python programming language but also to the `wheel package format`_ as one
+of the distribution formats supported by setuptools.
+The shape of the snake also resembles a cog, which together with the hammer is
+a nod to the two words that compose the name of the project.
+
+
+License
+=======
+
+
+This logo, design variations or a modified version may be used by anyone to
+refer to setuptools, but does not indicate endorsement by the project.
+
+Redistribution, usage and derivative works are permitted under the same license
+used by the setuptools software (MIT):
+
+.. code-block:: text
+
+ Copyright (c) Anderson Bravalheri
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+ THE USAGE OF THIS LOGO AND ARTWORK DOES NOT INDICATE ENDORSEMENT BY THE
+ SETUPTOOLS PROJECT.
+
+Whenever possible, please make the image a link to
+https://github.com/pypa/setuptools.
+
+
+.. _Anderson Bravalheri: https://github.com/abravalheri
+.. _Inkscape: https://inkscape.org
+.. _setuptools repository: https://github.com/pypa/setuptools
+.. _install the correct fonts: https://wiki.inkscape.org/wiki/Installing_fonts
+.. _original proposal: https://github.com/pypa/setuptools/issues/2227#issuecomment-653628344
+.. _wheel package format: https://www.python.org/dev/peps/pep-0427/
+.. _ouroboros: https://en.wikipedia.org/wiki/Ouroboros
-setuptools
-==========
+.. image:: images/banner-640x320.svg
+ :align: center
+
+Documentation
+=============
Setuptools is a fully-featured, actively-maintained, and stable library
designed to facilitate packaging Python projects.
build_meta
pkg_resources
references/keywords
- roadmap
setuptools
+
+.. toctree::
+ :caption: Project
+ :maxdepth: 1
+ :hidden:
+
+ roadmap
Development guide <development/index>
Backward compatibility & deprecated practice <deprecated/index>
Changelog <history>
+ Artwork <images/README>
.. tidelift-referral-banner::
how setuptools' own commands are installed: the setuptools project's setup
script defines entry points for them!
+.. note::
+ When creating commands, and specially when defining custom ways of building
+ compiled extensions (for example via ``build_ext``), consider
+ handling exceptions such as ``CompileError``, ``LinkError``, ``LibError``,
+ among others. These exceptions are available in the ``setuptools.errors``
+ module.
+
+
Adding ``setup()`` Arguments
----------------------------
Development mode
================
-``setuptools`` allows you to install a package without copying any files
-to your interpreter directory (e.g. the ``site-packages`` directory). This
-allows you to modify your source code and have the changes take effect without
-you having to rebuild and reinstall. This is currently incompatible with
-PEP 517 and therefore it requires a ``setup.py`` script with the following
-content::
- import setuptools
- setuptools.setup()
+.. tip::
+
+ Prior to :ref:`pip v21.1 <pip:v21-1>`, a ``setup.py`` script was
+ required to be compatible with development mode. With late
+ versions of pip, any project may be installed in this mode.
-Then::
+``setuptools`` allows you to install a package without copying any files
+to your interpreter directory (e.g. the ``site-packages`` directory).
+This allows you to modify your source code and have the changes take
+effect without you having to rebuild and reinstall.
+Here's how to do it::
pip install --editable .
# https://github.com/pypa/setuptools/issues/2497
ignore:.* is an invalid version and will not be supported::pkg_resources
+
+ # https://github.com/pypa/setuptools/pull/2865#issuecomment-965700112
+ # ideally would apply to Python 3.10+ when
+ # SETUPTOOLS_USE_DISTUTILS=stdlib but for
+ # https://github.com/pytest-dev/pytest/discussions/9296
+ ignore:The distutils.sysconfig module is deprecated, use sysconfig instead
+
+ # Workaround for pypa/setuptools#2868
+ # ideally would apply to PyPy only but for
+ # https://github.com/pytest-dev/pytest/discussions/9296
+ ignore:Distutils was imported before setuptools
+ ignore:Setuptools is replacing distutils
[metadata]
name = setuptools
-version = 58.5.3
+version = 59.0.1
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
mock
flake8-2020
virtualenv>=13.0.0
- pytest-virtualenv>=1.2.7
+ pytest-virtualenv>=1.2.7 # TODO: Update once man-group/pytest-plugins#188 is solved
wheel
paver
pip>=19.1 # For proper file:// URLs support.
- jaraco.envs
+ jaraco.envs>=2.2
pytest-xdist
sphinx
jaraco.path>=3.2.0
Metadata-Version: 2.1
Name: setuptools
-Version: 58.5.3
+Version: 59.0.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Provides-Extra: certs
License-File: LICENSE
+.. image:: https://raw.githubusercontent.com/pypa/setuptools/main/docs/images/banner-640x320.svg
+ :align: center
+
+|
+
.. image:: https://img.shields.io/pypi/v/setuptools.svg
:target: `PyPI link`_
docs/development/developer-guide.rst
docs/development/index.rst
docs/development/releases.rst
+docs/images/README.rst
docs/references/keywords.rst
docs/userguide/commands.rst
docs/userguide/datafiles.rst
wheel
paver
pip>=19.1
-jaraco.envs
+jaraco.envs>=2.2
pytest-xdist
sphinx
jaraco.path>=3.2.0
except (LinkError, TypeError):
return False
else:
- os.remove("a.out")
+ os.remove(os.path.join(self.output_dir or '', "a.out"))
finally:
for fn in objects:
os.remove(fn)
INSTALL_SCHEMES = {
'unix_prefix': {
- 'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
- 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
+ 'purelib': '$base/lib/$implementation_lower$py_version_short/site-packages',
+ 'platlib': '$platbase/$platlibdir/$implementation_lower$py_version_short/site-packages',
+ 'headers': '$base/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
- 'purelib': '$base/lib/python',
- 'platlib': '$base/$platlibdir/python',
- 'headers': '$base/include/python/$dist_name',
+ 'purelib': '$base/lib/$implementation_lower',
+ 'platlib': '$base/$platlibdir/$implementation_lower',
+ 'headers': '$base/include/$implementation_lower/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
INSTALL_SCHEMES['nt_user'] = {
'purelib': '$usersite',
'platlib': '$usersite',
- 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
- 'scripts': '$userbase/Python$py_version_nodot/Scripts',
+ 'headers': '$userbase/$implementation$py_version_nodot/Include/$dist_name',
+ 'scripts': '$userbase/$implementation$py_version_nodot/Scripts',
'data' : '$userbase',
}
'purelib': '$usersite',
'platlib': '$usersite',
'headers':
- '$userbase/include/python$py_version_short$abiflags/$dist_name',
+ '$userbase/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'scripts': '$userbase/bin',
'data' : '$userbase',
}
# and to SCHEME_KEYS here.
SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
+def _get_implementation():
+ if hasattr(sys, 'pypy_version_info'):
+ return 'PyPy'
+ else:
+ return 'Python'
+
class install(Command):
'exec_prefix': exec_prefix,
'abiflags': abiflags,
'platlibdir': getattr(sys, 'platlibdir', 'lib'),
+ 'implementation_lower': _get_implementation().lower(),
+ 'implementation': _get_implementation(),
}
if HAS_USER_SITE:
sysconfig.customize_compiler(self.cc)
self.assertEqual(self.cc.linker_so[0], 'my_ld')
+ def test_has_function(self):
+ # Issue https://github.com/pypa/distutils/issues/64:
+ # ensure that setting output_dir does not raise
+ # FileNotFoundError: [Errno 2] No such file or directory: 'a.out'
+ self.cc.output_dir = 'scratch'
+ self.cc.has_function('abort', includes=['stdlib.h'])
+
def test_suite():
return unittest.makeSuite(UnixCCompilerTestCase)
if hasattr(build_py, 'get_data_files_without_manifest'):
return build_py.get_data_files_without_manifest()
- log.warn(
+ warnings.warn(
"Custom 'build_py' does not implement "
"'get_data_files_without_manifest'.\nPlease extend command classes"
- " from setuptools instead of distutils."
+ " from setuptools instead of distutils.",
+ SetuptoolsDeprecationWarning
)
return build_py.get_data_files()
def single_line(val):
- # quick and dirty validation for description pypa/setuptools#1390
+ """Validate that the value does not have line breaks."""
+ # Ref: https://github.com/pypa/setuptools/issues/1390
if '\n' in val:
- # TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")`
- warnings.warn("newlines not allowed and will break in the future")
- val = val.replace('\n', ' ')
+ raise ValueError('Newlines are not allowed')
+
return val
Provides exceptions used by setuptools modules.
"""
+from distutils import errors as _distutils_errors
from distutils.errors import DistutilsError
error is raised if a command exists in ``distutils`` but has been actively
removed in ``setuptools``.
"""
+
+
+# Re-export errors from distutils to facilitate the migration to PEP632
+
+ByteCompileError = _distutils_errors.DistutilsByteCompileError
+CCompilerError = _distutils_errors.CCompilerError
+ClassError = _distutils_errors.DistutilsClassError
+CompileError = _distutils_errors.CompileError
+ExecError = _distutils_errors.DistutilsExecError
+FileError = _distutils_errors.DistutilsFileError
+InternalError = _distutils_errors.DistutilsInternalError
+LibError = _distutils_errors.LibError
+LinkError = _distutils_errors.LinkError
+ModuleError = _distutils_errors.DistutilsModuleError
+OptionError = _distutils_errors.DistutilsOptionError
+PlatformError = _distutils_errors.DistutilsPlatformError
+PreprocessError = _distutils_errors.PreprocessError
+SetupError = _distutils_errors.DistutilsSetupError
+TemplateError = _distutils_errors.DistutilsTemplateError
+UnknownFileError = _distutils_errors.UnknownFileError
+
+# The root error class in the hierarchy
+BaseError = _distutils_errors.DistutilsError
class VirtualEnv(jaraco.envs.VirtualEnv):
name = '.env'
+ # Some version of PyPy will import distutils on startup, implicitly
+ # importing setuptools, and thus leading to BackendInvalid errors
+ # when upgrading Setuptools. Bypass this behavior by avoiding the
+ # early availability and need to upgrade.
+ create_opts = ['--no-setuptools']
def run(self, cmd, *args, **kwargs):
cmd = [self.exe(cmd[0])] + cmd[1:]
import pytest
import pkg_resources
+from setuptools import SetuptoolsDeprecationWarning
from setuptools.command.sdist import sdist
from setuptools.command.egg_info import manifest_maker
from setuptools.dist import Distribution
self.assert_package_data_in_manifest(cmd)
- @mock.patch('setuptools.command.egg_info.log')
- def test_custom_build_py(self, log_stub):
+ def test_custom_build_py(self):
"""
Ensure projects defining custom build_py don't break
when creating sdists (issue #2849)
cmd.distribution.cmdclass = {'build_py': CustomBuildPy}
assert cmd.distribution.get_command_class('build_py') == CustomBuildPy
- with quiet():
+ msg = "setuptools instead of distutils"
+ with quiet(), pytest.warns(SetuptoolsDeprecationWarning, match=msg):
cmd.run()
using_custom_command_guard.assert_called()
self.assert_package_data_in_manifest(cmd)
- warn_stub = log_stub.warn
- warn_stub.assert_called()
- for call in warn_stub.call_args_list:
- args, _kw = call
- if "setuptools instead of distutils" in args[0]:
- return
- else:
- raise AssertionError(
- "The user should have been warned to extend setuptools command"
- " classes instead of distutils",
- warn_stub.call_args_list
- )
-
def test_setup_py_exists(self):
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'foo.py'
return param if network else mark(param, pytest.mark.skip(reason="no network"))
network_versions = [
- mark('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')),
- 'pip==20.0.2',
- 'https://github.com/pypa/pip/archive/main.zip',
+ mark('pip<20', pytest.mark.xfail(reason='pypa/pip#6599')),
+ 'pip<20.1',
+ 'pip<21',
+ 'pip<22',
+ mark(
+ 'https://github.com/pypa/pip/archive/main.zip',
+ pytest.mark.skipif('sys.version_info < (3, 7)'),
+ ),
]
versions = itertools.chain(
return list(versions)
+@pytest.mark.skipif(
+ 'platform.python_implementation() == "PyPy"',
+ reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
+)
@pytest.mark.parametrize('pip_version', _get_pip_versions())
def test_pip_upgrade_from_source(pip_version, tmp_src, virtualenv):
"""
if pip_version is None:
upgrade_pip = ()
else:
- upgrade_pip = ('python -m pip install -U {pip_version} --retries=1',)
+ upgrade_pip = ('python -m pip install -U "{pip_version}" --retries=1',)
virtualenv.run(' && '.join((
'pip uninstall -y setuptools',
'pip install -U wheel',
# workaround for sphinx-doc/sphinx#9562
# TODO: remove after Sphinx>4.1.2 is available.
sphinx@git+https://github.com/sphinx-doc/sphinx; python_version>="3.10"
+ # TODO: remove after man-group/pytest-plugins#188 is solved
+ pytest-virtualenv @ git+https://github.com/jaraco/pytest-plugins@distutils-deprecated#subdirectory=pytest-virtualenv
commands =
pytest {posargs}
usedevelop = True
extras = testing
passenv =
+ SETUPTOOLS_USE_DISTUTILS
windir # required for test_pkg_resources
[testenv:docs]