cms-nanoAOD / correctionlib

A generic correction library
https://cms-nanoaod.github.io/correctionlib/
BSD 3-Clause "New" or "Revised" License
16 stars 22 forks source link

Migrate away from deprecated `pkg_resources` #211

Closed eguiraud closed 9 months ago

eguiraud commented 1 year ago

The pkg_resources module is deprecated and the deprecation message can show up in the CI of correctionlib dependencies, breaking them (e.g. https://github.com/eguiraud/correctionlib-gradients/actions/runs/6462426199/job/17544003250 ):

tests\test_base.py:6: in <module>
    from correctionlib import schemav2
        __builtins__ = <builtins>
        __cached__ = 'D:\\a\\correctionlib-gradients\\correctionlib-gradients\\tests\\__pycache__\\test_base.cpython-311.pyc'
        __doc__    = None
        __file__   = 'D:\\a\\correctionlib-gradients\\correctionlib-gradients\\tests\\test_base.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x000002963FE9F490>
        __name__   = 'test_base'
        __package__ = ''
        __spec__   = ModuleSpec(name='test_base', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x000002963FE9F490>, origin='D:\\a\\correctionlib-gradients\\correctionlib-gradients\\tests\\test_base.py')
        math       = <module 'math' (built-in)>
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\correctionlib-gradients\JRNUVH8J\correctionlib-gradients\Lib\site-packages\correctionlib\__init__.py:7: in <module>
    import pkg_resources
        __builtins__ = <builtins>
        __cached__ = 'C:\\Users\\runneradmin\\AppData\\Local\\hatch\\env\\virtual\\correctionlib-gradients\\JRNUVH8J\\correctionlib-gradients\\Lib\\site-packages\\correctionlib\\__pycache__\\__init__.cpython-311.pyc'
        __doc__    = None
        __file__   = 'C:\\Users\\runneradmin\\AppData\\Local\\hatch\\env\\virtual\\correctionlib-gradients\\JRNUVH8J\\correctionlib-gradients\\Lib\\site-packages\\correctionlib\\__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x000002963FF07650>
        __name__   = 'correctionlib'
        __package__ = 'correctionlib'
        __path__   = ['C:\\Users\\runneradmin\\AppData\\Local\\hatch\\env\\virtual\\correctionlib-gradients\\JRNUVH8J\\correctionlib-gradients\\Lib\\site-packages\\correctionlib']
        __spec__   = ModuleSpec(name='correctionlib', loader=<_frozen_importlib_external.SourceFileLoader object at 0x000002963FF07650>, or...\\hatch\\env\\virtual\\correctionlib-gradients\\JRNUVH8J\\correctionlib-gradients\\Lib\\site-packages\\correctionlib'])
        __warningregistry__ = {'version': 12}
        ctypes     = <module 'ctypes' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.5\\x64\\Lib\\ctypes\\__init__.py'>
        os         = <module 'os' (frozen)>
        sys        = <module 'sys' (built-in)>
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\correctionlib-gradients\JRNUVH8J\correctionlib-gradients\Lib\site-packages\pkg_resources\__init__.py:118: in <module>
    warnings.warn(
E   DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

A step towards migration is done in https://github.com/cms-nanoAOD/correctionlib/pull/210.

nsmith- commented 9 months ago

I think this is fixed.