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

RFE: Replace use of pkg_resources with importlib.metadata #1973

Closed
kloczek opened this issue Jul 17, 2022 · 5 comments · Fixed by #1993
Closed

RFE: Replace use of pkg_resources with importlib.metadata #1973

kloczek opened this issue Jul 17, 2022 · 5 comments · Fixed by #1993

Comments

@kloczek
Copy link

kloczek commented Jul 17, 2022

See discussions:
astropy/astropy#11091
pypa/pip#7413

[tkloczko@devel-g2v cherrypy-18.7.0]$ grep pkg_resources -r
cherrypy/__init__.py:    import pkg_resources
cherrypy/__init__.py:    __version__ = pkg_resources.require('cherrypy')[0].version
cherrypy/test/helper.py:         import pkg_resources, re, sys; \
cherrypy/test/helper.py:            pkg_resources.load_entry_point(\
docs/conf.py:import pkg_resources
docs/conf.py:prj_dist = pkg_resources.get_distribution('cherrypy')
build/lib/cherrypy/__init__.py:    import pkg_resources
build/lib/cherrypy/__init__.py:    __version__ = pkg_resources.require('cherrypy')[0].version
build/lib/cherrypy/test/helper.py:         import pkg_resources, re, sys; \
build/lib/cherrypy/test/helper.py:            pkg_resources.load_entry_point(\
@Safihre
Copy link
Contributor

Safihre commented Nov 30, 2022

@webknjaz Did you notice that these lines:

try:
    __version__ = pkg_resources.require('cherrypy')[0].version
except Exception:
    __version__ = 'unknown'

actually take ages?
It goes off and does all kind of logic to figure out the depency structure of cherrypy and seems to parse all installed modules..
Hopefully this can be simplified by using importlib.metadat.

@webknjaz
Copy link
Member

@Safihre you're right. This should've been done long ago.

radez added a commit to radez/cherrypy that referenced this issue Apr 4, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
radez added a commit to radez/cherrypy that referenced this issue Apr 4, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
radez added a commit to radez/cherrypy that referenced this issue Apr 4, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
hswong3i added a commit to alvistack/cherrypy-cherrypy that referenced this issue May 9, 2023
    git clean -xdf
    tar zcvf ../python-cherrypy_18.8.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-cherrypy.spec ../python-cherrypy_18.8.0-1.spec
    mv ../python*-cherrypy*18.8.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/cherrypy-cherrypy-18.8.0/
    rm -rf ../python*-cherrypy*18.8.0*.*

See cherrypy#1973

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
hswong3i added a commit to alvistack/cherrypy-cherrypy that referenced this issue May 9, 2023
    git clean -xdf
    tar zcvf ../python-cherrypy_18.8.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-cherrypy.spec ../python-cherrypy_18.8.0-1.spec
    mv ../python*-cherrypy*18.8.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/cherrypy-cherrypy-18.8.0/
    rm -rf ../python*-cherrypy*18.8.0*.*

See cherrypy#1973

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
radez added a commit to radez/cherrypy that referenced this issue Dec 14, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
radez added a commit to radez/cherrypy that referenced this issue Dec 21, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
webknjaz pushed a commit to radez/cherrypy that referenced this issue Dec 21, 2023
…portlib.metadata

Replaces references to pkg_resources with importlib.metadata
Latest setuptools reports: DeprecationWarning: pkg_resources is deprecated as an API
@Safihre
Copy link
Contributor

Safihre commented Dec 22, 2023

Great @webknjaz 👍👍 now let's not wait another year to release it 🤣

@webknjaz
Copy link
Member

@Safihre I identified a few incompatible changes post-merge: #1993 (review). Once they're addressed — why not.

@webknjaz
Copy link
Member

And another one: https://github.com/cherrypy/cherrypy/pull/2006/files#r1435574215.

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 a pull request may close this issue.

3 participants