Skip to content

dependency on past generates warnings in Python 3 #145

@neutrinoceros

Description

@neutrinoceros

uncertainties imports imp via past at import time, but imp is deprecated from the standard library, which means that in the current state, uncertainties will not be compatible with Python 3.12
This is a problem for me as I want to future-proof a package I'm maintaining which depends on uncertainties, so I'd like to treat deprecation warnings as errors, and don't want to ignore the ones coming from uncertainties.
I believe the patch is trivial so I'll give it a go but I wanted to open an issue first for reference.

reproduction:

# t.py
import uncertainties

and running on the command line

python3 -Werror t.py

yields

Traceback (most recent call last):
  File "/Users/robcleme/dev/uncertainties/t.py", line 1, in <module>
    import uncertainties
  File "/Users/robcleme/dev/uncertainties/uncertainties/__init__.py", line 225, in <module>
    from .core import *
  File "/Users/robcleme/dev/uncertainties/uncertainties/core.py", line 22, in <module>
    from past.builtins import basestring
  File "/Users/robcleme/.pyenv/versions/uncertainties-dev/lib/python3.9/site-packages/past/builtins/__init__.py", line 54, in <module>
    from past.builtins.misc import (apply, chr, cmp, execfile, intern, oct,
  File "/Users/robcleme/.pyenv/versions/uncertainties-dev/lib/python3.9/site-packages/past/builtins/misc.py", line 45, in <module>
    from imp import reload
  File "/Users/robcleme/.pyenv/versions/3.9.7/lib/python3.9/imp.py", line 31, in <module>
    warnings.warn("the imp module is deprecated in favour of importlib; "
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions