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

Remove imp package to prevent Warning deprecation message #62

Closed
wants to merge 1 commit into from

Conversation

ipeluffo
Copy link

@ipeluffo ipeluffo commented Jul 2, 2019

Remove imp package to prevent getting deprecation warning message.

When importing venusian, it imports imp which reports some deprecation warning messages:

venusian/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

@ipeluffo ipeluffo marked this pull request as ready for review July 2, 2019 09:39
@@ -12,6 +11,9 @@

ATTACH_ATTR = '__venusian_callbacks__'
LIFTONLY_ATTR = '__venusian_liftonly_callbacks__'
IMP_PY_SOURCE = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these magic numbers documented?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bertjwregeer , I took the values from the imp source code:
https://github.com/python/cpython/blob/master/Lib/imp.py#L35-L45

Having said that, in this case I think they could be any value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these should be hard coded. According to https://docs.python.org/3/library/imp.html?highlight=imp#imp.get_magic the value may be different for each Python version. It also says which value to use from importlib instead: https://docs.python.org/3/library/importlib.html#module-importlib.machinery I haven't figured out the full mapping yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go Python 3 only, we can ignore the whole "source file" vs ".pyc" file issue entirely, because .pyc files are not stored in the same path as source files, and we would potentially want to import .pyc files.

@ipeluffo
Copy link
Author

Any update on this? Thanks

@ipeluffo ipeluffo deleted the imp-package-warning-fix branch November 5, 2019 13:02
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.

None yet

3 participants