Skip to content

Typing fix: use float instead of int for lifespan and timeout #1068

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nikitagashkov
Copy link

This MR updates the type hints for lifespan and timeout parameters from int to float in JWKSetCache and PyJWKClient.

Timeouts are commonly specified as floats to allow for sub-second precision (e.g., timeout=0.5). Updating the type hints avoids unnecessary type checker warnings when float values are passed.

This change is backwards compatible since in the type system floats allow ints to be accepted and it is actually considered a best bractice.

@@ -20,9 +20,9 @@ def __init__(
cache_keys: bool = False,
max_cached_keys: int = 16,
cache_jwk_set: bool = True,
lifespan: int = 300,
lifespan: float = 300,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 300 a int or float?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still an int 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why using float here?

@nikitagashkov nikitagashkov requested a review from auvipy June 12, 2025 18:50
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 this pull request may close these issues.

2 participants