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

SpecifierSet has no attribute split #1869

Closed
jaraco opened this issue Oct 9, 2019 · 5 comments
Closed

SpecifierSet has no attribute split #1869

jaraco opened this issue Oct 9, 2019 · 5 comments

Comments

@jaraco
Copy link
Member

jaraco commented Oct 9, 2019

Running the tests on cheroot, I'm seeing this error:

  Installing backend dependencies: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /Users/jaraco/code/public/cherrypy/cheroot/.tox/python/bin/python /Users/jaraco/code/public/cherrypy/cheroot/.tox/python/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/tmpkxgh82j6
         cwd: /Users/jaraco/code/public/cherrypy/cheroot
    Complete output (28 lines):
    Traceback (most recent call last):
      File "/Users/jaraco/code/public/cherrypy/cheroot/.tox/python/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
        main()
      File "/Users/jaraco/code/public/cherrypy/cheroot/.tox/python/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/Users/jaraco/code/public/cherrypy/cheroot/.tox/python/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 138, in <module>
        __name__ == '__main__' and setuptools.setup(**setup_params)
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 446, in __init__
        _Distribution.__init__(self, {
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 735, in finalize_options
        ep.load()(self, ep.name, value)
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 291, in check_specifier
        packaging.specifiers.SpecifierSet(value)
      File "/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-build-env-2krlo7y7/overlay/lib/python3.8/site-packages/setuptools/_vendor/packaging/specifiers.py", line 594, in __init__
        specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
    AttributeError: 'SpecifierSet' object has no attribute 'split'

I suspect this issue is brought about by #1847, and what's happening is the declarative config python_requires is transforming the value and later the value is parsed again. This code illustrates how the same error is elicited by a double construction:

>>> packaging.specifiers.SpecifierSet(packaging.specifiers.SpecifierSet('>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jaraco/code/public/pypa/setuptools/setuptools/_vendor/packaging/specifiers.py", line 594, in __init__
    specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
AttributeError: 'SpecifierSet' object has no attribute 'split'
@jaraco
Copy link
Member Author

jaraco commented Oct 9, 2019

But wait - if 'check_specifier' is called when a declarative 'python_requires' is indicated, then how is it that invalid specifiers were allowed in the bug (#1787)?

@jaraco
Copy link
Member Author

jaraco commented Oct 9, 2019

Oh, nevermind. It looks like cheroot is doing something weird in its setup.py.

@ssbarnea
Copy link

Please reopen this, we need a workaround as it break lots and lots of projects.

@webknjaz
Copy link
Member

@ssbarnea it only breaks hacks

@jaraco
Copy link
Member Author

jaraco commented Oct 16, 2019

Indeed, I'm extremely reluctant to support projects that wish to read declarative config on their own. I suggest if you wish to continue to read declarative config and pass it into setup(), then you'll need to support that interface and (conditionally) normalize any contents before passing into setup(). Maybe it makes sense for setuptools to support accepting a SpecifierSet for python_requires. I'd probably accept a patch for that, though I'd say it is something of a feature request.

felddy added a commit to cisagov/skeleton-python-library that referenced this issue Oct 17, 2019
dgelessus added a commit to dgelessus/kaitai_struct_python_runtime that referenced this issue Apr 27, 2020
Manually parsing setup.cfg and passing the parsed data into the setup
function is not officially supported by setuptools (see
pypa/setuptools#1869) and is also unnecessary, because the setup
function will automatically read the relevant data from setup.cfg.
dgelessus added a commit to dgelessus/kaitai_fs that referenced this issue Jun 30, 2020
Reading setup.cfg manually is not supported by setuptools and causes
errors with some setup.cfg features (see pypa/setuptools#1869).
The supported way to use setup.cfg is to call setup() with no arguments
and let setuptools read and parse setup.cfg itself.
aloftus23 pushed a commit to cisagov/pe-reports that referenced this issue Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants