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

Support pyproject.toml-style configuration (PEP 621) - Round 2 #2970

Merged
merged 63 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
49b7a60
Rename `config` to `config.setupcfg`
abravalheri Dec 1, 2021
f866876
Extract post-processing functions from config
abravalheri Dec 2, 2021
7d9ecc0
Allow root_dir to be explicit in config.expand functions
abravalheri Dec 2, 2021
8330040
Allow single strings in config.expand.read_files
abravalheri Dec 3, 2021
a148c33
Adequate test_setupcfg to latest changes in setupcfg
abravalheri Dec 22, 2021
d96e8bf
Add news fragment
abravalheri Feb 1, 2022
61a416b
Make __all__ immutable in setuptools.config
abravalheri Feb 9, 2022
ec2071a
Split complex generator expression in setuptools.config.expand
abravalheri Feb 9, 2022
25612c5
Adopt review suggestions
abravalheri Feb 9, 2022
81c3faa
Replace pushd with monkeypatch.chdir in test_expand
abravalheri Feb 9, 2022
82779f9
Ensure proper exception matching in test_expand
abravalheri Feb 9, 2022
e5d2bc8
Parametrize test_expand.test_find_packages
abravalheri Feb 9, 2022
099ac60
Add `tomli` as vendorised dependency
abravalheri Dec 2, 2021
771488d
Add `validate-pyproject` as a vendored dependency
abravalheri Dec 3, 2021
78dc278
Add news fragment
abravalheri Feb 1, 2022
7371508
Make comment in setuptools/_vendor/vendored.txt more clear
abravalheri Feb 1, 2022
ccd2f07
Ensure relative imports for vendorised tomli
abravalheri Feb 4, 2022
e0d61d4
Update vendored tomli to 2.0.1
abravalheri Feb 8, 2022
74c7341
Improve custom vendoring logic for validate-pyproject
abravalheri Feb 9, 2022
e2f07dc
Update vendored validate-pyproject to 0.4
abravalheri Feb 10, 2022
7f68bb4
Update vendored validate-pyproject to 0.5.2
abravalheri Mar 5, 2022
af187e8
Implement read_configuration from pyproject.toml
abravalheri Dec 3, 2021
8826dc1
Expand dynamic entry_points from pyproject.toml
abravalheri Dec 9, 2021
a8112d9
Make include_package_data=True for `pyproject.toml` configs
abravalheri Dec 22, 2021
9672a48
Add means of applying config read from pyproject.toml to dist
abravalheri Dec 23, 2021
d7363d5
Add the apply_configuration API to setuptools.config.setupcfg
abravalheri Dec 23, 2021
26a9264
Test pyproject.toml config has the same effect as setup.cfg
abravalheri Dec 23, 2021
051b825
Fix pyproject config when tool table is not present
abravalheri Feb 4, 2022
c927227
Remove no longer needed tomli import workaround
abravalheri Feb 4, 2022
905eed7
Update version of test dependency 'ini2toml'
abravalheri Feb 7, 2022
b426b2b
Prevent resource warnings in test_apply_pyprojecttoml
abravalheri Feb 9, 2022
e91969a
Add a 'uses_network' marker to tests that require connectivity
abravalheri Feb 9, 2022
9ee2697
Update test dependency ini2toml to 0.8
abravalheri Feb 10, 2022
e5c5519
Avoid failing due to 3rd party config in pyproject.toml
abravalheri Feb 18, 2022
5d4457e
Add tests against "empty" pyproject.toml
abravalheri Feb 18, 2022
cf32acb
Avoid using pkg_resources for entry points
abravalheri Feb 18, 2022
a4b474e
Back-fill Description-Content-Type according to readme suffix
abravalheri Feb 23, 2022
0497954
Update test dependency ini2toml to 0.9
abravalheri Mar 5, 2022
d385330
Add pyproject.toml to dist.parse_config_files
abravalheri Dec 24, 2021
dea4be5
Add deprecation notice for config.{read,parse}_configuration
abravalheri Dec 25, 2021
2b333e9
Add backend test with pyproject.toml-based configs
abravalheri Dec 23, 2021
09f784f
Test editable installs with pyproject.toml metadata
abravalheri Dec 24, 2021
9e8e3d3
Replace skip in editable install test with xfail
abravalheri Jan 13, 2022
aab5899
Add news fragment
abravalheri Feb 1, 2022
c9cf0da
Ensure build_meta don't have problems with instructions after setup()
abravalheri Feb 11, 2022
98c8edb
Test if not-zip-safe file is being generated with project metadata
abravalheri Feb 11, 2022
86e6a10
Test static metadata in pyproject.toml is not overwritten by setup.py
abravalheri Feb 12, 2022
854969d
Explicitly inform users that pyproject.toml config is experimental
abravalheri Feb 18, 2022
e9c1a32
Rely on validate-pyproject default errors
abravalheri Mar 5, 2022
0cc7478
Show significant error messages to user and avoid traceback pollution
abravalheri Mar 5, 2022
298e745
Removed unused import
abravalheri Mar 5, 2022
b44c648
Separate setup.cfg parsing and extract common post-processing functio…
abravalheri Mar 5, 2022
088d467
Add vendored deps: tomli and validate-pyproject (#3066)
abravalheri Mar 5, 2022
2cfcf0e
Add means to apply configuration from pyproject.toml (#3067)
abravalheri Mar 5, 2022
96adc4f
Fix variable name error
abravalheri Mar 5, 2022
1bb0021
Add some type hints to config.setupcfg
abravalheri Dec 25, 2021
441a1fa
Add some type hints to config.pyprojecttoml
abravalheri Dec 25, 2021
d3e62b1
Add some type hints to config.expand
abravalheri Dec 25, 2021
54f6180
Find namespaces by default when using config in 'pyproject.toml'
abravalheri Feb 19, 2022
5c334b3
Add news fragment
abravalheri Feb 19, 2022
f54e2d9
Integrate pyproject.toml configuration into existing classes (#3068)
abravalheri Mar 5, 2022
dd75299
Add some type hints to the setuptools.config subpackage (#3069)
abravalheri Mar 5, 2022
64386ba
Adopt namespaces by default when discovering packages (#3125)
abravalheri Mar 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/3065.misc.rst
@@ -0,0 +1,4 @@
Refactored ``setuptools.config`` by separating configuration parsing (specific
to the configuration file format, e.g. ``setup.cfg``) and post-processing
(which includes directives such as ``file:`` that can be used across different
configuration formats).
3 changes: 3 additions & 0 deletions changelog.d/3066.change.rst
@@ -0,0 +1,3 @@
Added vendored dependencies for :pypi:`tomli`, :pypi:`validate-pyproject`.

These dependencies are used to read ``pyproject.toml`` files and validate them.
13 changes: 13 additions & 0 deletions changelog.d/3068.change.rst
@@ -0,0 +1,13 @@
Added **experimental** support for ``pyproject.toml`` configuration
(as introduced by :pep:`621`). Configuration parameters not covered by
standards are handled in the ``[tool.setuptools]`` sub-table.

In the future, existing ``setup.cfg`` configuration
may be automatically converted into the ``pyproject.toml`` equivalent before taking effect
(as proposed in :issue:`1688`). Meanwhile users can use automated tools like
:pypi:`ini2toml` to help in the transition.

Please note that the legacy backend is not guaranteed to work with
``pyproject.toml`` configuration.

-- by :user:`abravalheri`
8 changes: 8 additions & 0 deletions changelog.d/3068.deprecation.rst
@@ -0,0 +1,8 @@
Deprecated ``setuptools.config.read_configuration``,
``setuptools.config.parse_configuration`` and other functions or classes
from ``setuptools.config``.

Users that still need to parse and process configuration from ``setup.cfg`` can
import a direct replacement from ``setuptools.config.setupcfg``, however this
module is transitional and might be removed in the future
(the ``setup.cfg`` configuration format itself is likely to be deprecated in the future).
10 changes: 10 additions & 0 deletions changelog.d/3125.change.rst
@@ -0,0 +1,10 @@
Implicit namespaces (as introduced in :pep:`420`) are now considered by default
during :doc:`package discovery </userguide/package_discovery>`, when
``setuptools`` configuration and project metadata are added to the
``pyproject.toml`` file.

To disable this behaviour, use ``namespaces = False`` when explicitly setting
the ``[tool.setuptools.packages.find]`` section in ``pyproject.toml``.

This change is backwards compatible and does not affect the behaviour of
configuration done in ``setup.cfg`` or ``setup.py``.
1 change: 1 addition & 0 deletions conftest.py
Expand Up @@ -19,6 +19,7 @@ def pytest_addoption(parser):

def pytest_configure(config):
config.addinivalue_line("markers", "integration: integration tests")
config.addinivalue_line("markers", "uses_network: tests may try to download files")


collect_ignore = [
Expand Down
8 changes: 7 additions & 1 deletion docs/conf.py
Expand Up @@ -93,10 +93,16 @@

# Add support for linking usernames
github_url = 'https://github.com'
github_repo_org = 'pypa'
github_repo_name = 'setuptools'
github_repo_slug = f'{github_repo_org}/{github_repo_name}'
github_repo_url = f'{github_url}/{github_repo_slug}'
github_sponsors_url = f'{github_url}/sponsors'
extlinks = {
'issue': (f'{github_repo_url}/issues/%s', 'issue #%s'), # noqa: WPS323
'pr': (f'{github_repo_url}/pull/%s', 'PR #%s'), # noqa: WPS323
'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323
'pypi': ('https://pypi.org/project/%s', '%s'),
'pypi': ('https://pypi.org/project/%s', '%s'), # noqa: WPS323
}
extensions += ['sphinx.ext.extlinks']

Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Expand Up @@ -58,3 +58,5 @@ filterwarnings=
# https://github.com/pytest-dev/pytest/discussions/9296
ignore:Distutils was imported before setuptools
ignore:Setuptools is replacing distutils

ignore:Support for project metadata in .pyproject.toml. is still experimental
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -67,6 +67,7 @@ testing =
build[virtualenv]
filelock>=3.4.0
pip_run>=8.8
ini2toml[lite]>=0.9

testing-integration =
pytest
Expand All @@ -80,7 +81,6 @@ testing-integration =
build[virtualenv]
filelock>=3.4.0


docs =
# upstream
sphinx
Expand Down