Skip to content

Commit

Permalink
Merge branch 'main' into disallow-blanket-suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Oct 17, 2024
2 parents 91c7ce2 + 89b4401 commit 4453962
Show file tree
Hide file tree
Showing 99 changed files with 3,776 additions and 7,669 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 74.0.0
current_version = 75.2.0
commit = True
tag = True

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
matrix:
python:
- "3.8"
- "3.12"
- "3.13"
platform:
- ubuntu-latest
- macos-latest
Expand All @@ -55,6 +55,10 @@ jobs:
platform: ubuntu-latest
- python: "3.11"
platform: ubuntu-latest
- python: "3.12"
platform: ubuntu-latest
- python: "3.14"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
distutils: stdlib
Expand All @@ -68,7 +72,7 @@ jobs:
exclude:
- {python: "3.8", platform: "macos-latest"}
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.13' }}
continue-on-error: ${{ matrix.python == '3.14' }}
env:
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }}
timeout-minutes: 75
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- gh-readonly-queue/**
tags:
# required if branches-ignore is supplied (jaraco/skeleton#103)
- '**'
- "**"
pull_request:
workflow_dispatch:

Expand All @@ -24,15 +24,17 @@ env:
# pin pyright version so a new version doesn't suddenly cause the CI to fail,
# until types-setuptools is removed from typeshed.
# For help with static-typing issues, or pyright update, ping @Avasam
#
# An exact version from https://github.com/microsoft/pyright/releases or "latest"
PYRIGHT_VERSION: "1.1.377"

# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
PIP_DISABLE_PIP_VERSION_CHECK: "true"
PIP_NO_PYTHON_VERSION_WARNING: "true"
PIP_NO_WARN_SCRIPT_LOCATION: "true"

jobs:
pyright:
Expand Down Expand Up @@ -65,7 +67,7 @@ jobs:
else
echo '> pip install pyright==${{ env.PYRIGHT_VERSION }}'
fi
echo 'pyright --threads'
echo '> pyright --threads'
shell: bash
- name: Run pyright
uses: jakebailey/pyright-action@v2
Expand Down
106 changes: 106 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,109 @@
v75.2.0
=======

Features
--------

- Made errors when parsing ``Distribution`` data more explicit about the expected type (``tuple[str, ...] | list[str]``) -- by :user:`Avasam` (#4578)


Bugfixes
--------

- Fix a `TypeError` when a ``Distribution``'s old included attribute was a `tuple` -- by :user:`Avasam` (#4578)
- Add workaround for ``bdist_wheel --dist-info-dir`` errors
when customisation does not inherit from setuptools. (#4684)


v75.1.1
=======

Bugfixes
--------

- Re-use pre-existing ``.dist-info`` dir when creating wheels via the build backend APIs (PEP 517) and the ``metadata_directory`` argument is passed -- by :user:`pelson`. (#1825)
- Changed ``egg_info`` command to avoid adding an empty ``.egg-info`` directory
while iterating over entry-points.
This avoids triggering integration problems with ``importlib.metadata``/``importlib_metadata``
(reference: pypa/pyproject-hooks#206). (#4680)


v75.1.0
=======

Features
--------

- Deprecated ``bdist_wheel.universal`` configuration. (#4617)


Bugfixes
--------

- Removed reference to upload_docs module in entry points. (#4650)


v75.0.0
=======

Features
--------

- Declare also the dependencies used by distutils (adds jaraco.collections).


Deprecations and Removals
-------------------------

- Removed upload_docs command. (#2971)
- Merge with pypa/distutils@7283751. Removed the register and upload commands and the config module that backs them (pypa/distutils#294). Removed the borland compiler. Replaced vendored dependencies with natural dependencies. Cygwin C compiler now gets compilers from sysconfig (pypa/distutils#296). (#4649)


v74.1.3
=======

Bugfixes
--------

- Fix cross-platform compilation using ``distutils._msvccompiler.MSVCCompiler`` -- by :user:`saschanaz` and :user:`Avasam` (#4648)


v74.1.2
=======

Bugfixes
--------

- Fixed TypeError in sdist filelist processing by adding support for pathlib Paths for the build_base. (#4615)
- Removed degraded and deprecated ``test_integration`` (easy_install) from the test suite. (#4632)


v74.1.1
=======

Bugfixes
--------

- Fixed TypeError in ``msvc.EnvironmentInfo.return_env`` when no runtime redistributables are installed. (#1902)


v74.1.0
=======

Features
--------

- Added support for defining ``ext-modules`` via ``pyproject.toml``
(**EXPERIMENTAL**, may change in future releases). (#4568)


Bugfixes
--------

- Merge with pypa/distutils@3dcdf8567, removing the duplicate vendored copy of packaging. (#4622)
- Restored ``setuptools.msvc.Environmentinfo`` as it is used externally. (#4625)


v74.0.0
=======

Expand Down
7 changes: 7 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import platform
import sys

import pytest
Expand Down Expand Up @@ -67,3 +68,9 @@ def conditional_skip(request):
pytest.skip("running integration tests only")
if not running_integration_tests and is_integration_test:
pytest.skip("skipping integration tests")


@pytest.fixture
def windows_only():
if platform.system() != 'Windows':
pytest.skip("Windows only")
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
# Allow linking objects on other Sphinx sites seamlessly:
intersphinx_mapping.update(
# python=('https://docs.python.org/3', None),
python=('https://docs.python.org/3.11/', None),
python=('https://docs.python.org/3.11', None),
# ^-- Python 3.11 is required because it still contains `distutils`.
# Just leaving it as `3` would imply 3.12+, but that causes an
# error with the cross references to distutils functions.
Expand Down Expand Up @@ -237,9 +237,9 @@
intersphinx_mapping.update({
'pip': ('https://pip.pypa.io/en/latest', None),
'build': ('https://build.pypa.io/en/latest', None),
'PyPUG': ('https://packaging.python.org/en/latest/', None),
'packaging': ('https://packaging.pypa.io/en/latest/', None),
'twine': ('https://twine.readthedocs.io/en/stable/', None),
'PyPUG': ('https://packaging.python.org/en/latest', None),
'packaging': ('https://packaging.pypa.io/en/latest', None),
'twine': ('https://twine.readthedocs.io/en/stable', None),
'importlib-resources': (
'https://importlib-resources.readthedocs.io/en/latest',
None,
Expand Down
2 changes: 1 addition & 1 deletion docs/development/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Code conventions and other practices
------------------------------------

Setuptools utilizes the `skeleton <https://github.com/jaraco/skeleton>`_
framework as a foundation for sharing re-usable maintenance tasks
framework as a foundation for sharing reusable maintenance tasks
across different projects in the ecosystem.

This also means that the project adheres to the same coding conventions
Expand Down
96 changes: 68 additions & 28 deletions docs/userguide/datafiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Data Files Support
====================

In the Python ecosystem, the term "data files" is used in various complex scenarios
and can have nuanced meanings. For the purposes of this documentation,
we define "data files" as non-Python files that are installed alongside Python
modules and packages on the user's machine when they install a
:term:`distribution <Distribution Package>` via :term:`wheel <Wheel>`.

These files are typically intended for use at **runtime** by the package itself or
to influence the behavior of other packages or systems.

Old packaging installation methods in the Python ecosystem
have traditionally allowed installation of "data files", which
are placed in a platform-specific location. However, the most common use case
Expand All @@ -19,10 +28,11 @@ Configuration Options

.. _include-package-data:

include_package_data
--------------------
1. ``include_package_data``
---------------------------

First, you can use the ``include_package_data`` keyword.

For example, if the package tree looks like this::

project_root_directory
Expand All @@ -35,16 +45,34 @@ For example, if the package tree looks like this::
├── data1.txt
└── data2.txt

and you supply this configuration:
When **at least one** of the following conditions are met:

1. These files are included via the :ref:`MANIFEST.in <Using MANIFEST.in>` file,
like so::

include src/mypkg/*.txt
include src/mypkg/*.rst

2. They are being tracked by a revision control system such as Git, Mercurial
or SVN, **AND** you have configured an appropriate plugin such as
:pypi:`setuptools-scm` or :pypi:`setuptools-svn`.
(See the section below on :ref:`Adding Support for Revision
Control Systems` for information on how to configure such plugins.)

then all the ``.txt`` and ``.rst`` files will be included into
the source distribution.

To further include them into the ``wheels``, you can use the
``include_package_data`` keyword:

.. tab:: pyproject.toml

.. code-block:: toml
[tool.setuptools]
# ...
# By default, include-package-data is true in pyproject.toml, so you do
# NOT have to specify this line.
# By default, include-package-data is true in pyproject.toml,
# so you do NOT have to specify this line.
include-package-data = true
[tool.setuptools.packages.find]
Expand Down Expand Up @@ -76,33 +104,18 @@ and you supply this configuration:
include_package_data=True
)
then all the ``.txt`` and ``.rst`` files will be automatically installed with
your package, provided:

1. These files are included via the :ref:`MANIFEST.in <Using MANIFEST.in>` file,
like so::

include src/mypkg/*.txt
include src/mypkg/*.rst

2. OR, they are being tracked by a revision control system such as Git, Mercurial
or SVN, and you have configured an appropriate plugin such as
:pypi:`setuptools-scm` or :pypi:`setuptools-svn`.
(See the section below on :ref:`Adding Support for Revision
Control Systems` for information on how to write such plugins.)

.. note::
.. versionadded:: v61.0.0
The default value for ``tool.setuptools.include-package-data`` is ``True``
The default value for ``tool.setuptools.include-package-data`` is ``true``
when projects are configured via ``pyproject.toml``.
This behaviour differs from ``setup.cfg`` and ``setup.py``
(where ``include_package_data=False`` by default), which was not changed
(where ``include_package_data`` is ``False`` by default), which was not changed
to ensure backwards compatibility with existing projects.

.. _package-data:

package_data
------------
2. ``package_data``
-------------------

By default, ``include_package_data`` considers **all** non ``.py`` files found inside
the package directory (``src/mypkg`` in this case) as data files, and includes those that
Expand Down Expand Up @@ -172,7 +185,7 @@ file, nor require to be added by a revision control system plugin.

.. note::
If your glob patterns use paths, you *must* use a forward slash (``/``) as
the path separator, even if you are on Windows. Setuptools automatically
the path separator, even if you are on Windows. ``setuptools`` automatically
converts slashes to appropriate platform-specific separators at build time.

.. important::
Expand Down Expand Up @@ -271,8 +284,8 @@ we specify that ``data1.rst`` from ``mypkg1`` alone should be captured as well.

.. _exclude-package-data:

exclude_package_data
--------------------
3. ``exclude_package_data``
---------------------------

Sometimes, the ``include_package_data`` or ``package_data`` options alone
aren't sufficient to precisely define what files you want included. For example,
Expand Down Expand Up @@ -337,6 +350,33 @@ Any files that match these patterns will be *excluded* from installation,
even if they were listed in ``package_data`` or were included as a result of using
``include_package_data``.

.. _interplay_package_data_keywords:

Interplay between these keywords
--------------------------------

Meanwhile, to further clarify the interplay between these three keywords,
to include certain data file into the source distribution, the following
logic condition has to be met::

MANIFEST.in or (package-data and not exclude-package-data)

In plain language, the file should be either:

1. included in ``MANIFEST.in``; or

2. selected by ``package-data`` AND not excluded by ``exclude-package-data``.

To include some data file into the ``.whl``::

(not exclude-package-data) and ((include-package-data and MANIFEST.in) or package-data)

In other words, the file should not be excluded by ``exclude-package-data``
(highest priority), AND should be either:

1. selected by ``package-data``; or

2. selected by ``MANIFEST.in`` AND use ``include-package-data = true``.

Summary
-------
Expand Down Expand Up @@ -450,7 +490,7 @@ With :ref:`package-data`, the configuration might look like this:
}
)
In other words, we allow Setuptools to scan for namespace packages in the ``src`` directory,
In other words, we allow ``setuptools`` to scan for namespace packages in the ``src`` directory,
which enables the ``data`` directory to be identified, and then, we separately specify data
files for the root package ``mypkg``, and the namespace package ``data`` under the package
``mypkg``.
Expand Down
Loading

0 comments on commit 4453962

Please sign in to comment.