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

Setup.cfg - add support for trailing comments #3322

Closed
neutrinoceros opened this issue May 17, 2022 · 10 comments
Closed

Setup.cfg - add support for trailing comments #3322

neutrinoceros opened this issue May 17, 2022 · 10 comments

Comments

@neutrinoceros
Copy link

neutrinoceros commented May 17, 2022

setuptools version

62.3.0 to 62.3.1

Python version

3.7 to 3.10

OS

Linux, MacOS, Windows

Additional environment information

No response

Description

I can't build wheels for yt since the 62.3.0 release. 62.3.1 didn't solve it either.

I'm seeing this on yt's regular wheel building jobs (for all major platforms, from Python 3.7 to 3.10)
https://github.com/yt-project/yt/runs/6467399046?check_suite_focus=true

I assume this problem isn't specific to yt and affects other projects as well, but I haven't found any duplicate so far.

Expected behavior

I expect the build to complete

How to Reproduce

python -m venv .env
source .env/bin/activate
python -m pip install --upgrade setuptools
python -m pip install git+https://github.com/yt-project/yt.git

Output

  WARNING: Built wheel for yt is invalid: Metadata 1.2 mandates PEP 440 version, but '4.1.dev0..-.keep.in.sync.with.yt-version.-version-' is not
Failed to build yt
ERROR: Could not build wheels for yt, which is required to install pyproject.toml-based projects

The actual version string embedded in yt's source code is '4.1.dev0', which I believe is PEP 440 compliant.

@neutrinoceros neutrinoceros added bug Needs Triage Issues that need to be evaluated for severity and status. labels May 17, 2022
@abravalheri
Copy link
Contributor

abravalheri commented May 17, 2022

Thank you very much @neutrinoceros. I am busy this morning/afternoon, but I will try to have a look as soon as possible.

This is probably related to the fact we updated the version of pyparsing... I don't see other changes influencing here. It might be the case previously when parsing version the inline comment was ignored, but now it is not... I have to investigate it better.

@neutrinoceros
Copy link
Author

Thank you ! FYI there is no rush on our side, removing the badly-parsed comment resolved the immediate issue.

@abravalheri
Copy link
Contributor

abravalheri commented May 17, 2022

On a first glance I feel like

parser = ConfigParser()
should include inline_comment_prefixes=(" #",), but that requires discussing the idea with the team...

On the other hand, setuptools never needed that, why did things change since then? I am still puzzled about what changed from 62.2.0 to 62.3.0 that might possibly have caused this problem... I will need some time to investigate.

@abravalheri
Copy link
Contributor

Just for the sake of documenting the main changes between 62.2 and 62.3:

git diff v62.2.0 v62.3.0 -- ':!setuptools/_vendor' ':!setuptools/_distutils' ':!chang*' ':!.bump*' ':!CHANGE*' ':!docs' ':!pkg_resources/_vendor' ':!setuptools/tests'
diff --git a/setup.cfg b/setup.cfg
index 0dec946b..a4b0333d 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 62.2.0
+version = 62.3.0
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
@@ -93,6 +93,7 @@ docs =
 	pygments-github-lexers==0.0.5
 	sphinx-favicon
 	sphinx-inline-tabs
+	sphinx-reredirects
 	sphinxcontrib-towncrier
 	furo
 
diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py
index c1ac137e..819bf5d3 100644
--- a/setuptools/_importlib.py
+++ b/setuptools/_importlib.py
@@ -12,6 +12,17 @@ def disable_importlib_metadata_finder(metadata):
         import importlib_metadata
     except ImportError:
         return
+    except AttributeError:
+        import warnings
+
+        msg = (
+            "`importlib-metadata` version is incompatible with `setuptools`.\n"
+            "This problem is likely to be solved by installing an updated version of "
+            "`importlib-metadata`."
+        )
+        warnings.warn(msg)  # Ensure a descriptive message is shown.
+        raise  # This exception can be suppressed by _distutils_hack
+
     if importlib_metadata is metadata:
         return
     to_remove = [
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index c3fdc092..91f47416 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -1,3 +1,4 @@
+from functools import partial
 from glob import glob
 from distutils.util import convert_path
 import distutils.command.build_py as orig
@@ -8,6 +9,9 @@ import io
 import distutils.errors
 import itertools
 import stat
+import warnings
+from pathlib import Path
+from setuptools._deprecation_warning import SetuptoolsDeprecationWarning
 from setuptools.extern.more_itertools import unique_everseen
 
 
@@ -98,7 +102,7 @@ class build_py(orig.build_py):
             package,
             src_dir,
         )
-        globs_expanded = map(glob, patterns)
+        globs_expanded = map(partial(glob, recursive=True), patterns)
         # flatten the expanded globs into an iterable of matches
         globs_matches = itertools.chain.from_iterable(globs_expanded)
         glob_files = filter(os.path.isfile, globs_matches)
@@ -129,6 +133,7 @@ class build_py(orig.build_py):
             src_dirs[assert_relative(self.get_package_dir(package))] = package
 
         self.run_command('egg_info')
+        check = _IncludePackageDataAbuse()
         ei_cmd = self.get_finalized_command('egg_info')
         for path in ei_cmd.filelist.files:
             d, f = os.path.split(assert_relative(path))
@@ -139,8 +144,13 @@ class build_py(orig.build_py):
                 d, df = os.path.split(d)
                 f = os.path.join(df, f)
             if d in src_dirs:
-                if path.endswith('.py') and f == oldf:
-                    continue  # it's a module, not data
+                if f == oldf:
+                    if check.is_module(f):
+                        continue  # it's a module, not data
+                else:
+                    importable = check.importable_subpackage(src_dirs[d], f)
+                    if importable:
+                        check.warn(importable)
                 mf.setdefault(src_dirs[d], []).append(path)
 
     def get_data_files(self):
@@ -240,3 +250,44 @@ def assert_relative(path):
         % path
     )
     raise DistutilsSetupError(msg)
+
+
+class _IncludePackageDataAbuse:
+    """Inform users that package or module is included as 'data file'"""
+
+    MESSAGE = """\
+    !!\n\n
+    ############################
+    # Package would be ignored #
+    ############################
+    Python recognizes {importable!r} as an importable package, however it is
+    included in the distribution as "data".
+    This behavior is likely to change in future versions of setuptools (and
+    therefore is considered deprecated).
+
+    Please make sure that {importable!r} is included as a package by using
+    setuptools' `packages` configuration field or the proper discovery methods.
+
+    You can read more about "package discovery" and "data files" on setuptools
+    documentation page.
+    \n\n!!
+    """
+
+    def __init__(self):
+        self._already_warned = set()
+
+    def is_module(self, file):
+        return file.endswith(".py") and file[:-len(".py")].isidentifier()
+
+    def importable_subpackage(self, parent, file):
+        pkg = Path(file).parent
+        parts = list(itertools.takewhile(str.isidentifier, pkg.parts))
+        if parts:
+            return ".".join([parent, *parts])
+        return None
+
+    def warn(self, importable):
+        if importable not in self._already_warned:
+            msg = textwrap.dedent(self.MESSAGE).format(importable=importable)
+            warnings.warn(msg, SetuptoolsDeprecationWarning, stacklevel=2)
+            self._already_warned.add(importable)
diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index a580b63f..4b4ed9df 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -16,6 +16,8 @@ from types import MappingProxyType
 from typing import (TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple,
                     Type, Union)
 
+from setuptools._deprecation_warning import SetuptoolsDeprecationWarning
+
 if TYPE_CHECKING:
     from setuptools._importlib import metadata  # noqa
     from setuptools.dist import Distribution  # noqa
@@ -75,6 +77,12 @@ def _apply_tool_table(dist: "Distribution", config: dict, filename: _Path):
 
     for field, value in tool_table.items():
         norm_key = json_compatible_key(field)
+
+        if norm_key in TOOL_TABLE_DEPRECATIONS:
+            suggestion = TOOL_TABLE_DEPRECATIONS[norm_key]
+            msg = f"The parameter `{norm_key}` is deprecated, {suggestion}"
+            warnings.warn(msg, SetuptoolsDeprecationWarning)
+
         norm_key = TOOL_TABLE_RENAMES.get(norm_key, norm_key)
         _set_config(dist, norm_key, value)
 
@@ -181,8 +189,10 @@ def _python_requires(dist: "Distribution", val: dict, _root_dir):
 
 
 def _dependencies(dist: "Distribution", val: list, _root_dir):
-    existing = getattr(dist, "install_requires", [])
-    _set_config(dist, "install_requires", existing + val)
+    if getattr(dist, "install_requires", []):
+        msg = "`install_requires` overwritten in `pyproject.toml` (dependencies)"
+        warnings.warn(msg)
+    _set_config(dist, "install_requires", val)
 
 
 def _optional_dependencies(dist: "Distribution", val: dict, _root_dir):
@@ -305,6 +315,9 @@ PYPROJECT_CORRESPONDENCE: Dict[str, _Correspondence] = {
 }
 
 TOOL_TABLE_RENAMES = {"script_files": "scripts"}
+TOOL_TABLE_DEPRECATIONS = {
+    "namespace_packages": "consider using implicit namespaces instead (PEP 420)."
+}
 
 SETUPTOOLS_PATCHES = {"long_description_content_type", "project_urls",
                       "provides_extras", "license_file", "license_files"}
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py
index d485a8bb..b2d5c346 100644
--- a/setuptools/config/setupcfg.py
+++ b/setuptools/config/setupcfg.py
@@ -12,6 +12,7 @@ from typing import (TYPE_CHECKING, Callable, Any, Dict, Generic, Iterable, List,
 from distutils.errors import DistutilsOptionError, DistutilsFileError
 from setuptools.extern.packaging.version import Version, InvalidVersion
 from setuptools.extern.packaging.specifiers import SpecifierSet
+from setuptools._deprecation_warning import SetuptoolsDeprecationWarning
 
 from . import expand
 
@@ -507,7 +508,7 @@ class ConfigMetadataHandler(ConfigHandler["DistributionMetadata"]):
                 parse_list,
                 "The requires parameter is deprecated, please use "
                 "install_requires for runtime dependencies.",
-                DeprecationWarning,
+                SetuptoolsDeprecationWarning,
             ),
             'obsoletes': parse_list,
             'classifiers': self._get_parser_compound(parse_file, parse_list),
@@ -516,7 +517,7 @@ class ConfigMetadataHandler(ConfigHandler["DistributionMetadata"]):
                 exclude_files_parser('license_file'),
                 "The license_file parameter is deprecated, "
                 "use license_files instead.",
-                DeprecationWarning,
+                SetuptoolsDeprecationWarning,
             ),
             'license_files': parse_list,
             'description': parse_file,
@@ -584,7 +585,12 @@ class ConfigOptionsHandler(ConfigHandler["Distribution"]):
             'scripts': parse_list,
             'eager_resources': parse_list,
             'dependency_links': parse_list,
-            'namespace_packages': parse_list,
+            'namespace_packages': self._deprecated_config_handler(
+                parse_list,
+                "The namespace_packages parameter is deprecated, "
+                "consider using implicit namespaces instead (PEP 420).",
+                SetuptoolsDeprecationWarning,
+            ),
             'install_requires': parse_list_semicolon,
             'setup_requires': parse_list_semicolon,
             'tests_require': parse_list_semicolon,
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 5507167d..37021ac7 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -280,6 +280,11 @@ def check_nsp(dist, attr, value):
                 nsp,
                 parent,
             )
+        msg = (
+            "The namespace_packages parameter is deprecated, "
+            "consider using implicit namespaces instead (PEP 420).",
+        )
+        warnings.warn(msg, SetuptoolsDeprecationWarning)
 
 
 def check_extras(dist, attr, value):

This release was mainly about warnings (+ recursive globs for package_data).

That is why I am considering that this might have been caused by the dependency update (pyparsing 2.2.1 => 3.0.8).

@jaraco
Copy link
Member

jaraco commented Jun 12, 2022

I don't trust that v62.3 release is implicated here. In #3330, abravalheri put together a test to capture the failure, but if I apply that test to the release prior to 62.3, the test still fails, suggesting that the issue wasn't caused by the 62.3 release:

setuptools HEAD $ git checkout v62.2.0
Warning: you are leaving 1 commit behind, not connected to
any of your branches:

  5f00abdc Add test with expectations for inline comments in setup.cfg

If you want to keep it by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> 5f00abdc

HEAD is now at 1b25c061 Bump version: 62.1.0 → 62.2.0
setuptools HEAD $ git cherry-pick 60785b4
Auto-merging setuptools/tests/config/test_setupcfg.py
[detached HEAD 61b0d2f7] Add test with expectations for inline comments in setup.cfg
 Author: Anderson Bravalheri <andersonbravalheri@gmail.com>
 Date: Wed May 18 16:54:58 2022 +0100
 1 file changed, 4 insertions(+), 4 deletions(-)
setuptools HEAD $ tox -- -k test_setupcfg -p no:cov
python develop-inst-noop: /Users/jaraco/code/public/pypa/setuptools
python installed: attrs==21.4.0,autocommand==2.2.1,black==22.3.0,build==0.8.0,click==8.1.3,coverage==6.4.1,distlib==0.3.4,docutils==0.18.1,execnet==1.9.0,filelock==3.7.1,flake8==4.0.1,flake8-2020==1.6.1,importlib-metadata==4.11.4,ini2toml==0.10,iniconfig==1.1.1,jaraco.context==4.1.1,jaraco.envs==2.4.0,jaraco.functools==3.5.0,jaraco.path==3.4.0,mccabe==0.6.1,mock==4.0.3,more-itertools==8.13.0,mypy==0.961,mypy-extensions==0.4.3,packaging==21.3,path==16.4.0,pathspec==0.9.0,pep517==0.12.0,pip-run==8.8.0,platformdirs==2.5.2,pluggy==1.0.0,py==1.11.0,pycodestyle==2.8.0,pyflakes==2.4.0,pyobjc==8.5,pyobjc-core==8.5,pyobjc-framework-Accessibility==8.5,pyobjc-framework-Accounts==8.5,pyobjc-framework-AddressBook==8.5,pyobjc-framework-AdServices==8.5,pyobjc-framework-AdSupport==8.5,pyobjc-framework-AppleScriptKit==8.5,pyobjc-framework-AppleScriptObjC==8.5,pyobjc-framework-ApplicationServices==8.5,pyobjc-framework-AppTrackingTransparency==8.5,pyobjc-framework-AudioVideoBridging==8.5,pyobjc-framework-AuthenticationServices==8.5,pyobjc-framework-AutomaticAssessmentConfiguration==8.5,pyobjc-framework-Automator==8.5,pyobjc-framework-AVFoundation==8.5,pyobjc-framework-AVKit==8.5,pyobjc-framework-BusinessChat==8.5,pyobjc-framework-CalendarStore==8.5,pyobjc-framework-CallKit==8.5,pyobjc-framework-CFNetwork==8.5,pyobjc-framework-ClassKit==8.5,pyobjc-framework-CloudKit==8.5,pyobjc-framework-Cocoa==8.5,pyobjc-framework-Collaboration==8.5,pyobjc-framework-ColorSync==8.5,pyobjc-framework-Contacts==8.5,pyobjc-framework-ContactsUI==8.5,pyobjc-framework-CoreAudio==8.5,pyobjc-framework-CoreAudioKit==8.5,pyobjc-framework-CoreBluetooth==8.5,pyobjc-framework-CoreData==8.5,pyobjc-framework-CoreHaptics==8.5,pyobjc-framework-CoreLocation==8.5,pyobjc-framework-CoreMedia==8.5,pyobjc-framework-CoreMediaIO==8.5,pyobjc-framework-CoreMIDI==8.5,pyobjc-framework-CoreML==8.5,pyobjc-framework-CoreMotion==8.5,pyobjc-framework-CoreServices==8.5,pyobjc-framework-CoreSpotlight==8.5,pyobjc-framework-CoreText==8.5,pyobjc-framework-CoreWLAN==8.5,pyobjc-framework-CryptoTokenKit==8.5,pyobjc-framework-DataDetection==8.5,pyobjc-framework-DeviceCheck==8.5,pyobjc-framework-DictionaryServices==8.5,pyobjc-framework-DiscRecording==8.5,pyobjc-framework-DiscRecordingUI==8.5,pyobjc-framework-DiskArbitration==8.5,pyobjc-framework-DVDPlayback==8.5,pyobjc-framework-EventKit==8.5,pyobjc-framework-ExceptionHandling==8.5,pyobjc-framework-ExecutionPolicy==8.5,pyobjc-framework-ExternalAccessory==8.5,pyobjc-framework-FileProvider==8.5,pyobjc-framework-FileProviderUI==8.5,pyobjc-framework-FinderSync==8.5,pyobjc-framework-FSEvents==8.5,pyobjc-framework-GameCenter==8.5,pyobjc-framework-GameController==8.5,pyobjc-framework-GameKit==8.5,pyobjc-framework-GameplayKit==8.5,pyobjc-framework-ImageCaptureCore==8.5,pyobjc-framework-IMServicePlugIn==8.5,pyobjc-framework-InputMethodKit==8.5,pyobjc-framework-InstallerPlugins==8.5,pyobjc-framework-InstantMessage==8.5,pyobjc-framework-Intents==8.5,pyobjc-framework-IntentsUI==8.5,pyobjc-framework-IOSurface==8.5,pyobjc-framework-iTunesLibrary==8.5,pyobjc-framework-KernelManagement==8.5,pyobjc-framework-LatentSemanticMapping==8.5,pyobjc-framework-LaunchServices==8.5,pyobjc-framework-libdispatch==8.5,pyobjc-framework-LinkPresentation==8.5,pyobjc-framework-LocalAuthentication==8.5,pyobjc-framework-LocalAuthenticationEmbeddedUI==8.5,pyobjc-framework-MailKit==8.5,pyobjc-framework-MapKit==8.5,pyobjc-framework-MediaAccessibility==8.5,pyobjc-framework-MediaLibrary==8.5,pyobjc-framework-MediaPlayer==8.5,pyobjc-framework-MediaToolbox==8.5,pyobjc-framework-Metal==8.5,pyobjc-framework-MetalKit==8.5,pyobjc-framework-MetalPerformanceShaders==8.5,pyobjc-framework-MetalPerformanceShadersGraph==8.5,pyobjc-framework-MetricKit==8.5,pyobjc-framework-MLCompute==8.5,pyobjc-framework-ModelIO==8.5,pyobjc-framework-MultipeerConnectivity==8.5,pyobjc-framework-NaturalLanguage==8.5,pyobjc-framework-NetFS==8.5,pyobjc-framework-Network==8.5,pyobjc-framework-NetworkExtension==8.5,pyobjc-framework-NotificationCenter==8.5,pyobjc-framework-OpenDirectory==8.5,pyobjc-framework-OSAKit==8.5,pyobjc-framework-OSLog==8.5,pyobjc-framework-PassKit==8.5,pyobjc-framework-PencilKit==8.5,pyobjc-framework-Photos==8.5,pyobjc-framework-PhotosUI==8.5,pyobjc-framework-PreferencePanes==8.5,pyobjc-framework-PushKit==8.5,pyobjc-framework-Quartz==8.5,pyobjc-framework-QuickLookThumbnailing==8.5,pyobjc-framework-ReplayKit==8.5,pyobjc-framework-SafariServices==8.5,pyobjc-framework-SceneKit==8.5,pyobjc-framework-ScreenCaptureKit==8.5,pyobjc-framework-ScreenSaver==8.5,pyobjc-framework-ScreenTime==8.5,pyobjc-framework-ScriptingBridge==8.5,pyobjc-framework-SearchKit==8.5,pyobjc-framework-Security==8.5,pyobjc-framework-SecurityFoundation==8.5,pyobjc-framework-SecurityInterface==8.5,pyobjc-framework-ServiceManagement==8.5,pyobjc-framework-ShazamKit==8.5,pyobjc-framework-Social==8.5,pyobjc-framework-SoundAnalysis==8.5,pyobjc-framework-Speech==8.5,pyobjc-framework-SpriteKit==8.5,pyobjc-framework-StoreKit==8.5,pyobjc-framework-SyncServices==8.5,pyobjc-framework-SystemConfiguration==8.5,pyobjc-framework-SystemExtensions==8.5,pyobjc-framework-UniformTypeIdentifiers==8.5,pyobjc-framework-UserNotifications==8.5,pyobjc-framework-UserNotificationsUI==8.5,pyobjc-framework-VideoSubscriberAccount==8.5,pyobjc-framework-VideoToolbox==8.5,pyobjc-framework-Virtualization==8.5,pyobjc-framework-Vision==8.5,pyobjc-framework-WebKit==8.5,pyparsing==3.0.9,pytest==7.1.2,pytest-black==0.3.12,pytest-checkdocs==2.7.1,pytest-cov==3.0.0,pytest-enabler==1.2.1,pytest-flake8==1.1.1,pytest-forked==1.4.0,pytest-mypy==0.9.1,pytest-perf==0.12.0,pytest-xdist==2.5.0,pytz==2022.1,setuptools-bootstrap==1.0,six==1.16.0,tempora==5.0.1,toml==0.10.2,tomli==2.0.1,tomli_w==1.0.0,tox==3.25.0,typing_extensions==4.2.0,virtualenv==20.14.1,zipp==3.8.0
python run-test-pre: PYTHONHASHSEED='96411534'
python run-test: commands[0] | pytest -k test_setupcfg -p no:cov
============================================================= test session starts ==============================================================
platform darwin -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
cachedir: .tox/python/.pytest_cache
rootdir: /Users/jaraco/code/public/pypa/setuptools, configfile: pytest.ini
plugins: enabler-1.2.1, xdist-2.5.0, forked-1.4.0, checkdocs-2.7.1, perf-0.12.0, black-0.3.12, flake8-1.1.1, mypy-0.9.1
gw0 [48] / gw1 [48] / gw2 [48] / gw3 [48] / gw4 [48] / gw5 [48] / gw6 [48] / gw7 [48]                                                          
....F...........................................                                                                                         [100%]
=================================================================== FAILURES ===================================================================
___________________________________________________________ TestMetadata.test_basic ____________________________________________________________
[gw6] darwin -- Python 3.10.4 /Users/jaraco/code/public/pypa/setuptools/.tox/python/bin/python

self = <setuptools.tests.config.test_setupcfg.TestMetadata object at 0x1106d91b0>
tmpdir = local('/private/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pytest-of-jaraco/pytest-2/popen-gw6/test_basic0')

    def test_basic(self, tmpdir):
    
        fake_env(
            tmpdir,
            '[metadata]\n'
            'version = 10.1.1  # comment\n'
            'description = Some description\n'
            'long_description_content_type = text/something\n'
            'long_description = file: README\n'
            'name = fake_name\n'
            'keywords = one, two  # comment\n'
            'provides = package, package.sub\n'
            'license = otherlic\n'
            'download_url = http://test.test.com/test/#url-fragment\n'
            'maintainer_email = test@test.com\n',
        )
    
        tmpdir.join('README').write('readme contents\nline2')
    
        meta_initial = {
            # This will be used so `otherlic` won't replace it.
            'license': 'BSD 3-Clause License',
        }
    
        with get_dist(tmpdir, meta_initial) as dist:
            metadata = dist.metadata
    
>           assert metadata.version == '10.1.1'
E           AssertionError: assert '10.1.1  # comment' == '10.1.1'
E             - 10.1.1
E             + 10.1.1  # comment

setuptools/tests/config/test_setupcfg.py:140: AssertionError
=========================================================== short test summary info ============================================================
SKIPPED [1] setuptools/tests/test_msvc.py:17: could not import 'distutils.msvc9compiler': No module named 'winreg'
=================================================== 1 failed, 47 passed, 1 skipped in 3.12s ====================================================
ERROR: InvocationError for command /Users/jaraco/code/public/pypa/setuptools/.tox/python/bin/pytest -k test_setupcfg -p no:cov (exited with code 1)
___________________________________________________________________ summary ____________________________________________________________________
ERROR:   python: commands failed

@jaraco
Copy link
Member

jaraco commented Jun 12, 2022

Trying to replicate the issue using the reported instructions, I'm unable to do so:

draft $ py -m venv venv
draft $ venv/bin/pip install -q --upgrade setuptools pip
draft $ venv/bin/pip install git+https://github.com/yt-project/yt.git
Collecting git+https://github.com/yt-project/yt.git
  Cloning https://github.com/yt-project/yt.git to /private/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-req-build-te_cx0l9
  Running command git clone --filter=blob:none --quiet https://github.com/yt-project/yt.git /private/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-req-build-te_cx0l9
  Resolved https://github.com/yt-project/yt.git to commit db04e772dacf85b80a4b34a329495e725d40b088
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting tomli>=1.2.3
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting pyparsing>0.0
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting tqdm>=3.4.0
  Downloading tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.4/78.4 kB 1.6 MB/s eta 0:00:00
Collecting matplotlib!=3.4.2,>=2.2.3
  Downloading matplotlib-3.5.2-cp310-cp310-macosx_11_0_arm64.whl (7.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.2/7.2 MB 24.9 MB/s eta 0:00:00
Collecting tomli-w>=0.4.0
  Using cached tomli_w-1.0.0-py3-none-any.whl (6.0 kB)
Collecting unyt>=2.8.0
  Downloading unyt-2.8.0-py2.py3-none-any.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.0/99.0 kB 4.2 MB/s eta 0:00:00
Collecting packaging>=20.9
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting numpy>=1.14.5
  Downloading numpy-1.22.4-cp310-cp310-macosx_11_0_arm64.whl (12.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 32.3 MB/s eta 0:00:00
Collecting more-itertools>=8.4
  Using cached more_itertools-8.13.0-py3-none-any.whl (51 kB)
Collecting cmyt>=0.2.2
  Downloading cmyt-1.0.4-py3-none-any.whl (30 kB)
Collecting colorspacious>=1.1.2
  Downloading colorspacious-1.1.2-py2.py3-none-any.whl (37 kB)
Collecting cycler>=0.10
  Downloading cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting pillow>=6.2.0
  Downloading Pillow-9.1.1-cp310-cp310-macosx_11_0_arm64.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 24.0 MB/s eta 0:00:00
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.4.2-cp310-cp310-macosx_11_0_arm64.whl (63 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 kB 2.5 MB/s eta 0:00:00
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting fonttools>=4.22.0
  Downloading fonttools-4.33.3-py3-none-any.whl (930 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 930.9/930.9 kB 22.8 MB/s eta 0:00:00
Collecting sympy>=1.2
  Downloading sympy-1.10.1-py3-none-any.whl (6.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 27.0 MB/s eta 0:00:00
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting mpmath>=0.19
  Downloading mpmath-1.2.1-py3-none-any.whl (532 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.6/532.6 kB 17.8 MB/s eta 0:00:00
Building wheels for collected packages: yt
  Building wheel for yt (pyproject.toml) ... done
  Created wheel for yt: filename=yt-4.1.dev0-cp310-cp310-macosx_12_0_arm64.whl size=13346150 sha256=82a868066a118182364322bbbd9d8824f2d21aa7310d31746acf345fa66f70b7
  Stored in directory: /private/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-ephem-wheel-cache-ewln42u5/wheels/ec/0d/67/5e5420cae6eec28fd0370e1c59482a1e3480c8dee75f226689
Successfully built yt
Installing collected packages: mpmath, tqdm, tomli-w, tomli, sympy, six, pyparsing, pillow, numpy, more-itertools, kiwisolver, fonttools, cycler, unyt, python-dateutil, packaging, colorspacious, matplotlib, cmyt, yt
Successfully installed cmyt-1.0.4 colorspacious-1.1.2 cycler-0.11.0 fonttools-4.33.3 kiwisolver-1.4.2 matplotlib-3.5.2 more-itertools-8.13.0 mpmath-1.2.1 numpy-1.22.4 packaging-21.3 pillow-9.1.1 pyparsing-3.0.9 python-dateutil-2.8.2 six-1.16.0 sympy-1.10.1 tomli-2.0.1 tomli-w-1.0.0 tqdm-4.64.0 unyt-2.8.0 yt-4.1.dev0

Aha. The issue was fixed in main by removing the offending comment in yt-project/yt@e355df7.

I am able to replicate the issue using venv/bin/pip install git+https://github.com/yt-project/yt.git@572e3f64121498f27fd456e44b8f05d945957603.

@jaraco
Copy link
Member

jaraco commented Jun 12, 2022

And digging deeper into the history, I see the comment was added to the setup.cfg in yt-project/yt@d3500c7, so it wasn't a Setuptools regression at all, but the user expecting a behavior that was likely never present.

@jaraco jaraco changed the title [BUG] Setuptools 62.3 breaks yt's build Setuptools 62.3 breaks yt's build Jun 12, 2022
@jaraco jaraco changed the title Setuptools 62.3 breaks yt's build Setup.cfg - add support for trailing comments Jun 12, 2022
@jaraco jaraco added enhancement and removed bug Needs Triage Issues that need to be evaluated for severity and status. labels Jun 12, 2022
@neutrinoceros
Copy link
Author

I see. Sorry for the confusion. I don't really get how my adding a comment there survived CI however, but I can live with it. Thank you for your feedback !

@abravalheri
Copy link
Contributor

Thank you Jason and Clément. Let's leave this aside for now. Ideally we want to try avoiding adding more features to setup.cfg.

@neutrinoceros
Copy link
Author

Perfectly understandable. Good luck to you guys with supporting pyproject.toml, and thank you for your work in general !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants