{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7963","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7963/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7963/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7963/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/7963","id":193111938,"number":7963,"title":"module-level deprecation warnings should point to import, not to the module itself","user":{"login":"kmike","id":107893,"avatar_url":"https://avatars.githubusercontent.com/u/107893?v=3","gravatar_id":"","url":"https://api.github.com/users/kmike","html_url":"https://github.com/kmike","followers_url":"https://api.github.com/users/kmike/followers","following_url":"https://api.github.com/users/kmike/following{/other_user}","gists_url":"https://api.github.com/users/kmike/gists{/gist_id}","starred_url":"https://api.github.com/users/kmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmike/subscriptions","organizations_url":"https://api.github.com/users/kmike/orgs","repos_url":"https://api.github.com/users/kmike/repos","events_url":"https://api.github.com/users/kmike/events{/privacy}","received_events_url":"https://api.github.com/users/kmike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-02T13:06:13Z","updated_at":"2016-12-04T01:52:24Z","closed_at":null,"body":"What do you think about adding ~~stacklevel=1~~ stacklevel=2 to module-level deprecation warnings like [this](https://github.com/scikit-learn/scikit-learn/blob/67a85b8ed842612d59187e5fdc81a8b86eb50afd/sklearn/cross_validation.py#L40)? Currently the warning points to cross_validation.py file and not to the offending import, which makes it hard to debug:\r\n\r\n> /...snip.../python3.5/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.\r\n  \"This module will be removed in 0.20.\", DeprecationWarning)\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/264678756","html_url":"https://github.com/scikit-learn/scikit-learn/issues/7963#issuecomment-264678756","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/7963","id":264678756,"user":{"login":"jnothman","id":78827,"avatar_url":"https://avatars.githubusercontent.com/u/78827?v=3","gravatar_id":"","url":"https://api.github.com/users/jnothman","html_url":"https://github.com/jnothman","followers_url":"https://api.github.com/users/jnothman/followers","following_url":"https://api.github.com/users/jnothman/following{/other_user}","gists_url":"https://api.github.com/users/jnothman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnothman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnothman/subscriptions","organizations_url":"https://api.github.com/users/jnothman/orgs","repos_url":"https://api.github.com/users/jnothman/repos","events_url":"https://api.github.com/users/jnothman/events{/privacy}","received_events_url":"https://api.github.com/users/jnothman/received_events","type":"User","site_admin":false},"created_at":"2016-12-04T01:52:24Z","updated_at":"2016-12-04T01:52:24Z","body":"> Another issue is that sklearn.__init__ allows DeprecationWarnings only\nfrom sklearn, but with stacklevel=2 they are no longer from sklearn, so\nthey are not shown by default.\n\nYes, another reason I'm -1 for such tweaks. We really need this warning\nraised loud and clear.\n\nOn 4 December 2016 at 09:29, Mikhail Korobov <notifications@github.com>\nwrote:\n\n> I did a quick experiment; t seems I got stacklevel wrong:\n>\n>    1. with stacklevel=1 nothing changes, it is a default value, so I\n>    meant stacklevel=2;\n>    2. with stacklevel=2 third-party imports show a better warning\n>    message, BUT a direct import (e.g. from a notebook) may show a confusing\n>    warning like this (it mentions line of code, but not what 'This module'\n>    means):\n>\n> /..snip../bin/ipython:1: DeprecationWarning: This module was deprecated in\n> version 0.18 in favor of the model_selection module into which all the\n> refactored classes and functions are moved. Also note that the interface of\n> the new CV iterators are different from that of this module. This module\n> will be removed in 0.20.\n> #!/Users/kmike/envs/deepdeep/bin/python3.5\n>\n> If we go with that I think it is better to replace \"This module\" in error\n> messages with concrete module names, e.g. sklearn.cross_validation.\n>\n> Another issue is that sklearn.__init__ allows DeprecationWarnings only\n> from sklearn, but with stacklevel=2 they are no longer from sklearn, so\n> they are not shown by default.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/scikit-learn/scikit-learn/issues/7963#issuecomment-264669893>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AAEz6zrPGn0T74hakaHgvyG5hhUc9nmSks5rEe0wgaJpZM4LCiET>\n> .\n>\n"}}
{"actor":{"display_login":"jnothman"}}