-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
fix deprecated pkg_resources #480
Conversation
@trim21 Many tests failed. Any idea what we can do to fix them? |
I'm looking into it. |
this works fine in my project but doesn't work in hpy testing, not sure why. looks like generated py file is imported in a very strange way. |
Many of the errors seem to come from |
some tests just import package with Just fixed |
should works fine |
ci is still broken, I'll fix this. |
Couldn't you just use the backport on Python < 3.10? |
In that way developers(hpy users) will need to add extra pypi requiremenets to make it work, right? |
However pkg_resources (which is provided by setuptools) has already been an extra requirement. We can't assume setuptools is installed everywhere. |
Yeah, this is just swapping one requirement for another, and you should even make it conditionally installed only on Python < 3.10. |
make sense |
I'm not very familiar with hpy itself, where should I add |
Presumably in |
@@ -264,6 +264,9 @@ def build_libraries(self, libraries): | |||
cmdclass={"build_clib": build_clib_hpy}, | |||
use_scm_version=get_scm_config, | |||
setup_requires=['setuptools_scm'], | |||
install_requires=['setuptools>=64.0'], | |||
install_requires=[ | |||
'setuptools>=64.0', |
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.
Does hpy actually still need setuptools at run time after this?
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 have no idea, should I remove this?
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.
Does the code import either setuptools
or pkg_resources
anywhere in the code base after your changes? If not, you can remove the dependency.
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.
Frankly setuptools
should never be a run-time dependency of any project. Its only legitimate use at the moment is as a build back-end.
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.
looks like hpy.devel
still require setuptools
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.
Is that a separate project?
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.
actually I have no idea what dependency should I have if I use hpy in universal mode........
it require hpy.universal
to load dll, so it looks like I should install hpy.universal
, and
indeed there is a hpy.universal
package in pypi. but it doesn't look right, so I need to include whole hpy, including devel, trace and so on as runtime dependency for my package using hpy in universal mode?
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.
Is hpy.universal
a separate project or is it somehow packaged separately from this project?
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.
Anyway, if setuptools
is directly imported by this project, it should be kept as a run-time dependency. At best it could be moved to extras if it's only used in some edge cases, provided that it's properly documented that way.
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.
Is
hpy.universal
a separate project or is it somehow packaged separately from this project?
I don't know 🧐, didn't even successfully pack my hpy universal mode wheel yet.
I do not have the time to complete this, feel free to cherry-pick. |
pkg_resources
is deprecated.Replace
pkg_resources
withimportlib.resources
, which available on python>=3.10.https://setuptools.pypa.io/en/latest/pkg_resources.html