bmcfee / resampy

Efficient sample rate conversion in python
https://resampy.readthedocs.io
ISC License
253 stars 36 forks source link

filters: use importlib_resources API to avoid deprecation warning #117

Closed polariton closed 7 months ago

polariton commented 10 months ago

Fix deprecation warning "pkg_resources is deprecated as an API"

bmcfee commented 10 months ago

Thanks - looks like you need to add importlib_resources to the dependencies to get CI working though.

polariton commented 9 months ago

OK, added importlib_resources to CI.

bmcfee commented 9 months ago

This should be done via package requirements, not by changing the test environment script.

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.22%. Comparing base (1d1a08a) to head (0eddd89).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #117 +/- ## ======================================= Coverage 75.22% 75.22% ======================================= Files 4 4 Lines 113 113 ======================================= Hits 85 85 Misses 28 28 ``` | [Flag](https://app.codecov.io/gh/bmcfee/resampy/pull/117/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/bmcfee/resampy/pull/117/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee) | `75.22% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

takenori-y commented 7 months ago

@bmcfee Sorry to jump in, but will this PR be merged in the near future?

bmcfee commented 7 months ago

Sorry, this fell off my radar. It looks like the tests are failing with this PR, but I'm not sure why they're not showing up in the GH actions checks here.

bmcfee commented 7 months ago

https://pipelinesghubeus26.actions.githubusercontent.com/bUxMb2yqtuvB2RTCARL2QpDTvLpo5Yf3UEj1GdiJq0K3dNEhMw/_apis/pipelines/1/runs/8/signedlogcontent/3?urlExpires=2024-03-04T19%3A26%3A50.4934762Z&urlSigningMethod=HMACV1&urlSignature=wFq6a%2F9ay5mg0BrMgePItMgMpWkGm0bjH2TKOSBowcM%3D is the failed build log on 3.6. (Not that I'm too fussed with maintaining for 3.6, but if we're going to put out a release to support newer python, we shouldn't break the old version if we don't have to.)

Failures on 3.10+ environments were due to codecov being flakey and nothing with our test suite directly.

takenori-y commented 7 months ago

I could not see the log, but the variable __name__ seems to be different in python 3.6 and 3.7 and later. How is this?

if filter_name not in FILTER_CACHE:
    package = __name__.split(".")[0]  # or simply 'resampy'
    fname = importlib_resources.files(package).joinpath(
        'data', os.path.extsep.join([filter_name, 'npz'])
    )
bmcfee commented 7 months ago

I just did the simple thing and hacked the package name directly in. Let's see if this makes CI happy.

bmcfee commented 7 months ago

Alright, good enough. I think we still need to do a bit of tweaking on the package setup.cfg, but this is functional for now. I'll try to put a release out this week.