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

Avoid UserWarnings emitted when calling into distutils.dist.Distribution #29

Closed
ghost opened this issue Jul 2, 2013 · 5 comments
Closed

Comments

@ghost
Copy link

ghost commented Jul 2, 2013

Originally reported by: ncoghlan (Bitbucket: ncoghlan, GitHub: ncoghlan)


Currently setuptools.dist.Distribution passes the unfiltered collection of keyword arguments up to distutils.core.Distribution. This results in lots of scary looking "UserWarning" messages when you actually use the setuptools-only options (see http://stackoverflow.com/questions/8295644/pypi-userwarning-unknown-distribution-option-install-requires)

It also makes it look like you're calling distutils rather than setuptools, since the stack trace (showing that this is a call up into setuptools) isn't visible.

For example, cleaning coverage.py for devinabox looks like this:

[ncoghlan@lancre coveragepy]$ ../cpython/python setup.py clean/home/ncoghlan/devel/devinabox/cpython/Lib/distutils/dist.py:257: UserWarning: Unknown distribution option: 'entry_points'
  warnings.warn(msg)
/home/ncoghlan/devel/devinabox/cpython/Lib/distutils/dist.py:257: UserWarning: Unknown distribution option: 'use_2to3'
  warnings.warn(msg)
/home/ncoghlan/devel/devinabox/cpython/Lib/distutils/dist.py:257: UserWarning: Unknown distribution option: 'zip_safe'
  warnings.warn(msg)
running clean

But if we make those errors, we see that it is picking up the symlinked setuptools correctly:

[ncoghlan@lancre coveragepy]$ ../cpython/python -W error::UserWarning setup.py cleanTraceback (most recent call last):
  File "setup.py", line 199, in <module>
    main()
  File "setup.py", line 188, in main
    setup(**setup_args)
  File "/home/ncoghlan/devel/devinabox/cpython/Lib/distutils/core.py", line 109, in setup
    _setup_distribution = dist = klass(attrs)
  File "/home/ncoghlan/devel/devinabox/coveragepy/setuptools/dist.py", line 269, in __init__
    _Distribution.__init__(self,attrs)
  File "/home/ncoghlan/devel/devinabox/cpython/Lib/distutils/dist.py", line 257, in __init__
    warnings.warn(msg)
UserWarning: Unknown distribution option: 'use_2to3'

@ghost
Copy link
Author

ghost commented Jul 2, 2013

Original comment by ncoghlan (Bitbucket: ncoghlan, GitHub: ncoghlan):


More simply, we know it's seeing the setuptools install, because the unconditional "import setuptools" in coverage.py's setup.py is working :)

@ghost
Copy link
Author

ghost commented Aug 25, 2013

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Indeed, setuptools just passes the attributes through directly through to Distribution. It will be somewhat challenging for setuptools to track which attributes might be valid for a distutils Distribution. Or perhaps setuptools can simply suppress that warning around the call to the superclass.

@ghost
Copy link
Author

ghost commented Jan 9, 2015

Original comment by sorin (Bitbucket: sorin, GitHub: sorin):


Is there a way to disable these warnings from inside the setup.py file? I get very annoying false warnings like:

/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'home_page'
  warnings.warn(msg)

@ghost
Copy link
Author

ghost commented Jan 22, 2015

Original comment by stefanholek (Bitbucket: stefanholek, GitHub: stefanholek):


Perhaps you are looking for https://docs.python.org/3/library/warnings.html#warning-filter

@ghost
Copy link
Author

ghost commented Jan 23, 2015

Original comment by sorin (Bitbucket: sorin, GitHub: sorin):


Isn't this a problem with setuptools itself, that it should just ignore unknown distribution options? Otherwise it would be impossible to hide these messages and it will alienate all users.

Is exactly the opposite of an deprecated warning: you are notifying the users about something that is newer than his tools. Obviously there is nothing they can do about it.

@ghost ghost added major bug labels Mar 29, 2016
jaraco added a commit that referenced this issue Mar 29, 2016
ENH: use #!/usr/bin/env python for the shebang instead of non-working on POSIX systems plain #!python
@jaraco jaraco closed this as completed in 8698127 May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants