Skip to content

fix deprecation warnings in python3.8 and above#94

Open
Rogalek wants to merge 1 commit into
sontek:masterfrom
Rogalek:fix_deprecation_warnings_py3.8
Open

fix deprecation warnings in python3.8 and above#94
Rogalek wants to merge 1 commit into
sontek:masterfrom
Rogalek:fix_deprecation_warnings_py3.8

Conversation

@Rogalek

@Rogalek Rogalek commented Apr 28, 2021

Copy link
Copy Markdown

Hello,

I want to fix deprecation warnings in pyramid_celery, which cause my project an error:

/usr/local/lib/python3.8/site-packages/pyramid_celery/loaders.py:99: in __init__
    self.parser = self.ConfigParser()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <configparser.SafeConfigParser object at 0x7fada6845580>, args = (), kwargs = {}
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
>       warnings.warn(
            "The SafeConfigParser class has been renamed to ConfigParser "
            "in Python 3.2. This alias will be removed in future versions."
            " Use ConfigParser directly instead.",
            DeprecationWarning, stacklevel=2
        )
E       DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.

Also, I have found two minor things to change.

PEP 8: E124 closing bracket does not match visual indentation in your setup.py file

  /home/rogal/Documents/repo/pyramid_celery/venv/lib/python3.8/site-packages/_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
    self.issue_config_time_warning(
-- Docs: https://docs.pytest.org/en/stable/warnings.html

Run all your tests by tox:

______________________________________________________________________________________________________________________________________________________________________________ summary ______________________________________________________________________________________________________________________________________________________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  py39: commands succeeded
  pypy3: commands succeeded
  flake8: commands succeeded
  celery4: commands succeeded
  celery5: commands succeeded
  congratulations :)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 95.031% when pulling d062aee on Rogalek:fix_deprecation_warnings_py3.8 into cf8aa80 on sontek:master.

@fmigneault

Copy link
Copy Markdown

@sontek
Is it possible to include this fix and provide a new patch release?
With Python 3.12, this is not a warning anymore, but an error:

    import pyramid_celery
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyramid_celery/__init__.py", line 6, in <module>
    from pyramid_celery.loaders import INILoader
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyramid_celery/loaders.py", line 94, in <module>
    class INILoader(celery.loaders.base.BaseLoader):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyramid_celery/loaders.py", line 95, in INILoader
    ConfigParser = configparser.SafeConfigParser
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

See https://docs.python.org/3/whatsnew/3.12.html#configparser

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.

3 participants