-
Notifications
You must be signed in to change notification settings - Fork 0
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
Removing pkg_resources #65
Conversation
Alright there's something I'm missing here @standage. I've removed the
What am I missing? |
I think |
I'll look into it. It's weird it's popping up with |
Any luck? |
It looks like updating to version 3.8.0 should work- although when I try to do this I run into errors with Python versions and macOS versions?
|
If I'm upgrading the Python version in a Conda environment, it's almost always easier to just rebuild the environment from scratch. |
Upgrading to python 3.10 and Matplotlib 3.8 seems to get rid of this issue. I'm going to close the PR and open a new one. |
So... |
This is probably ready for merging, no? |
setup.py
Outdated
@@ -45,6 +45,7 @@ | |||
"snakemake>=7.22.0", | |||
"pyyaml>=6.0", | |||
"matplotlib>=3.5.3", | |||
"importlib_resources", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary. The importlib.resources
module is part of the Python standard library starting with version 3.7. The importlib_resources
package is only required for compatibility with older versions of Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to conda install it into my current environment with Python 3.10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everywhere you have import importlib_resources
you should replace with import importlib.resources
, and then the function calls as well. I missed that in my review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh okay! I will fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fixed.
lusSTR/scripts/filter_settings.py
Outdated
return resource_filename("lusSTR", "data/filters.json") | ||
return importlib_resources.files("lusSTR") / "data/filters.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's worth going back at this point, but if you're always using this Path
object as a string, you could wrap it with str
here instead of every single place you use it in the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here or in __init__.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, wrong function. I meant to comment on the data_file
function in test/__init__.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll leave it as is for now. Maybe in the future will change it.
Clicking the |
And of course all this requires the higher Python versions.... |
I keep running into various warnings about package deprecation for
pkg_resources
. This will remove pkg_resources from lusSTR and replace withimportlib_resources
.