← All tasks
pythonlaurents/slowapi #156Not a task: not reproduced

slowapi uses limits==2.8.0 which contains usage of deprecated pkg_resources

envgap__laurents__slowapi-156

01 / FAILURE SIGNATURE

As reported upstream

Please note that this error is not happening on all our devs machines so I suspect other people may have some particular setting which is suppressing these warnings. The problem is that we can't find what it is.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
8f8fc7c65a57fd8fcfd476ff1e782bd37f4eed8f
Manifest
pyproject.toml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

laurents/slowapi #156 · read the original issue
**Describe the bug**



Our application uses `slowapi==0.1.7` which makes use of `limits==2.8.0`



The problem is `limits==2.8.0` uses `pkg_resources` which is deprecated and when we run tests they fail with:



```python

src/common/limiter.py:1: in <module>

    from slowapi.extension import Limiter

.nox/test-3-10-item/lib/python3.10/site-packages/slowapi/__init__.py:1: in <module>

    from .extension import Limiter, _rate_limit_exceeded_handler

.nox/test-3-10-item/lib/python3.10/site-packages/slowapi/extension.py:25: in <module>

    from limits import RateLimitItem  # type: ignore

.nox/test-3-10-item/lib/python3.10/site-packages/limits/__init__.py:5: in <module>

    from . import _version, aio, storage, strategies

.nox/test-3-10-item/lib/python3.10/site-packages/limits/aio/__init__.py:1: in <module>

    from . import storage, strategies

.nox/test-3-10-item/lib/python3.10/site-packages/limits/aio/storage/__init__.py:6: in <module>

    from .base import MovingWindowSupport, Storage

.nox/test-3-10-item/lib/python3.10/site-packages/limits/aio/storage/base.py:5: in <module>

    from limits.storage.registry import StorageRegistry

.nox/test-3-10-item/lib/python3.10/site-packages/limits/storage/__init__.py:12: in <module>

    from .base import MovingWindowSupport, Storage

.nox/test-3-10-item/lib/python3.10/site-packages/limits/storage/base.py:6: in <module>

    from limits.util import LazyDependency

.nox/test-3-10-item/lib/python3.10/site-packages/limits/util.py:11: in <module>

    import pkg_resources

.nox/test-3-10-item/lib/python3.10/site-packages/pkg_resources/__init__.py:121: in <module>

    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

E   DeprecationWarning: pkg_resources is deprecated as an API

```



I tried to manually edit `.nox/test-3-10-item/lib/python3.10/site-packages/limits/util.py` and apply the fix (Remove deprecated use of pkg_resources and switch to importlib_resource) and we don't get the warning anymore.



**To Reproduce**



On Python 3.10 we get this warning when running tests through nox



**Expected behavior**



`limits` fixed the issue in 3.3.0 https://github.com/alisaifee/limits/blob/master/HISTORY.rst#v330



`slowapi` should use a more updated version of `limits`



**Screenshots**



(none)



**Your app (please complete the following information):**



Deps used:



```python

fastapi==0.95.0

limits==2.8.0

slowapi==0.1.7

```



**Python**: Python 3.10.9



**Additional context**



The best would be if `slowapi` could move to `limits>=3.3.0` so this problem would be solved.



In alternative, a way to suppress `E   DeprecationWarning: pkg_resources is deprecated as an API` could work as well.

Please note that this error is not happening on all our devs machines so I suspect other people may have some particular setting which is suppressing these warnings. The problem is that we can't find what it is.



Thanks
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]