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

DeprecationWarning on usage of imp in loader.py #675

Closed
milliams opened this issue Oct 10, 2019 · 12 comments
Closed

DeprecationWarning on usage of imp in loader.py #675

milliams opened this issue Oct 10, 2019 · 12 comments
Assignees

Comments

@milliams
Copy link

When running my test suite which uses invoke (via fabric) I see:

======================= warnings summary ========================
venv/lib64/python3.7/site-packages/invoke/loader.py:3
  venv/lib64/python3.7/site-packages/invoke/loader.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

-- Docs: https://docs.pytest.org/en/latest/warnings.html
========== 6 passed, 1 warnings in 1651.00s (0:27:30) ===========

The used parts of the imp module have been deprecated since Python 3.3 and the replacement importlib has been available since Python 3.1.

@SwampFalc
Copy link

For what it's worth, there's a workaround that will suppress that one particular warning. I use it on pytest but I believe it's going to be mostly the same with other test frameworks:

-W ignore::DeprecationWarning:invoke.loader

@rupertnash
Copy link

I have also spotted this - the question is really: which versions of python is invoke committed to supporting? The docs say 2.7 and >=3.4. However, we have now passed 2020-01-01, so the sun has officially gone down on python 2. If I had a vote (which I don't obviously), it would be to drop support for 2.7 and switch this code to importlib

Instead I'm adding a warning filter (https://docs.pytest.org/en/latest/warnings.html#pytest-mark-filterwarnings) and have logged an issue on our project.

@shoriminimoe
Copy link

This issue was brought up again in #829. I would be happy to submit a PR if the team is looking for help.

@neozenith
Copy link

Hi,
I'm starting to help out on issue triage. Invoke (and the Fabric and Paramiko family) are conservative with the supported versions of python.

But yes, very soon Python2 will be dropped clearing out issues such as this.
https://bitprophet.org/projects/#roadmap

@neozenith neozenith self-assigned this Mar 26, 2022
@MarcSkovMadsen
Copy link

Listening in as I also see this warning.

@skapin
Copy link

skapin commented May 24, 2022

2022, still here ...... 🧟

@sodul
Copy link

sodul commented Aug 11, 2022

This will break in python 3.12:

DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses

May I suggest the use of a conditional import based on the python version? This would address the warnings will ensuring forward compatibility with Python 3.12.

I'm not very fond of silencing the warning since it is very legitimate.

@kuwv
Copy link
Contributor

kuwv commented Feb 23, 2023

#919

@bitprophet
Copy link
Member

#919 merged and released in Invoke 2.1.0 today. Thanks!

@kuwv
Copy link
Contributor

kuwv commented Nov 24, 2023

The imp dependency has been replaced. Can you verify what version you are using?

@ibc
Copy link

ibc commented Nov 24, 2023

The imp dependency has been replaced. Can you verify what version you are using?

My fault, sorry, I thought I was using latest version but due to a typo I was using 2.0.0, that's why I have deleted my comment.

@kuwv
Copy link
Contributor

kuwv commented Nov 24, 2023

No worries

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

No branches or pull requests