Open ecly opened 1 month ago
@ecly thank you for preparing the PR! Agree with you that we should probably bump version number to 0.2.0 to highlight the breaking change. inspect
could do, if it's not running on every request, I think it's quite an expensive call, if I recall correctly.
@ecly thank you for preparing the PR! Agree with you that we should probably bump version number to 0.2.0 to highlight the breaking change.
inspect
could do, if it's not running on every request, I think it's quite an expensive call, if I recall correctly.
Looking at it closer, I'm actually not even sure if it should be considered backwards incompatible.
The limit.is_exempt
is already checking whether the provided function accepts a request
(computed with inspect on init).
The only way in which it would break anything is if a User subclasses Limit
and overrides is_exempt
without the request
parameter, since __evaluate_limits
would call it with a request
paramter.
I've added code to __evaluate_limits
that can handle this, but of course any subclass that doesn't implement the request
parameter would essentially be breaking the contract.
So probably 3 options:
Limit
subclasses without request
param for is_exempt
overrides still work.Limit
class, if we consider the Limit
part of the public API.Limit.is_exempt
part of public API.Let me know which you prefer @laurentS then I'll prepare it.
This PR prepares the 0.1.10 release. Added notes for all remaining distinct commits since 0.1.9.
Not sure 0.2.0 would be more appropriate given the breaking changes. Another option could be to change the implementation from #160 to be backwards compatible using
inspect
. Let me know what you think @laurentS then I'd be happy to help.As per: https://github.com/laurentS/slowapi/pull/160#issuecomment-2298372438