Skip to content

Instantly share code, notes, and snippets.

@bskinn
Created January 10, 2018 16:20
Show Gist options
  • Save bskinn/1a443fdec09805c3900a163cc61ba31c to your computer and use it in GitHub Desktop.
Save bskinn/1a443fdec09805c3900a163cc61ba31c to your computer and use it in GitHub Desktop.
attr DeprecationWarning shown at direct class instantiation, but not when used in an imported module

Environment (Windows 10)

$ pip list
alabaster (0.7.10)
attrs (17.4.0)
Babel (2.5.1)
certifi (2017.11.5)
chardet (3.0.4)
colorama (0.3.9)
coverage (4.4.2)
decorator (4.1.2)
docutils (0.14)
flake8 (3.4.1)
flake8-docstrings (1.1.0)
flake8-polyfill (1.0.2)
fuzzywuzzy (0.16.0)
idna (2.6)
imagesize (0.7.1)
ipython (6.2.1)
ipython-genutils (0.2.0)
jedi (0.11.1)
Jinja2 (2.10)
jsonschema (2.6.0)
MarkupSafe (1.0)
mccabe (0.6.1)
parso (0.1.1)
pickleshare (0.7.4)
pip (9.0.1)
prompt-toolkit (1.0.15)
pycodestyle (2.3.1)
pydocstyle (2.1.1)
pyflakes (1.5.0)
Pygments (2.2.0)
pytz (2017.3)
requests (2.18.4)
setuptools (38.4.0)
simplegeneric (0.8.1)
six (1.11.0)
snowballstemmer (1.2.1)
Sphinx (1.6.5)
sphinx-rtd-theme (0.2.4)
sphinxcontrib-websupport (1.0.1)
traitlets (4.3.2)
urllib3 (1.22)
wcwidth (0.1.7)
wget (3.2)
wheel (0.30.0)
win-unicode-console (0.5)

$ python --version
Python 3.5.4

Testing without explicit warnings-always filter

$ ipython
In [1]: import sphobjinv

In [2]: import attr

In [3]: @attr.s()
   ...: class tester():
   ...:     x = attr.ib(convert=float)
   ...:
 C:\Temp\git\sphobjinv\env\Scripts\ipython:3: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.

In [4]: exit

Testing with explicit warnings-always filter

$ ipython
In [1]: import warnings

In [2]: warnings.filterwarnings('always')

In [3]: import sphobjinv
C:\Temp\git\sphobjinv\sphobjinv\data.py:211: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  name = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:212: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  domain = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:213: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  role = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:214: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  priority = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:215: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  uri = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:216: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  dispname = attr.ib(convert=_utf8_decode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:248: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  name = attr.ib(convert=_utf8_encode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:249: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  domain = attr.ib(convert=_utf8_encode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:250: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  role = attr.ib(convert=_utf8_encode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:251: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  priority = attr.ib(convert=_utf8_encode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:252: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  uri = attr.ib(convert=_utf8_encode)
C:\Temp\git\sphobjinv\sphobjinv\data.py:253: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
  dispname = attr.ib(convert=_utf8_encode)

In [4]: import attr

In [5]: @attr.s()
   ...: class tester():
   ...:     x = attr.ib(convert=float)
   ...:
C:\Temp\git\sphobjinv\env\Scripts\ipython:3: DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment