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

Deprecation: Add stacklevel=2 to make calling code clear #3440

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Jul 12, 2022

Summary of changes

Before

Points to deprecation itself in setuptools, /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/config/__init__.py:

================================================================== warnings summary ==================================================================
pyroma/tests.py::RatingsTest::test_only_config
  /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
  `setuptools.config.read_configuration` became deprecated.

  For the time being, you can use the `setuptools.config.setupcfg` module
  to access a backward compatible API, but this module is provisional
  and might be removed in the future.

    warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================== 12 passed, 1 warning in 3.83s ============================================================

After

Points to caller of deprecation in user's project, for example /private/tmp/pyroma/pyroma/projectdata.py:

================================================================== warnings summary ==================================================================
pyroma/tests.py::RatingsTest::test_only_config
  /private/tmp/pyroma/pyroma/projectdata.py:50: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
  `setuptools.config.read_configuration` became deprecated.

  For the time being, you can use the `setuptools.config.setupcfg` module
  to access a backward compatible API, but this module is provisional
  and might be removed in the future.

    data = config.read_configuration("setup.cfg")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================== 12 passed, 1 warning in 3.73s ============================================================

Docs: https://docs.python.org/3/library/warnings.html#available-functions

Pull Request Checklist

@abravalheri abravalheri merged commit 8b675a1 into pypa:main Jul 12, 2022
@abravalheri
Copy link
Contributor

Thank you very much @hugovk.

@hugovk hugovk deleted the patch-2 branch July 12, 2022 11:38
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

Successfully merging this pull request may close these issues.

2 participants