Conversation
… sync and async support - Added `RateLimiter` and `AsyncRateLimiter` classes for synchronous and asynchronous rate limiting, respectively. - Introduced `PersistentQuotaCache` for persistent storage of quota usage across sessions. - Implemented decorators `rate_limit` and `async_rate_limit` for easy integration of rate limiting in functions. - Enhanced error handling with `RateLimitError` and `RateLimitDelayExceeded` exceptions. - Updated documentation to include detailed descriptions of rate limiting features and usage examples. - Added extensive tests for rate limiting functionality, including concurrency and cache behavior.
- Added semantic release configuration to `pyproject.toml` for automated versioning and changelog generation. - Removed deprecated `.releaserc` file and integrated release process into GitHub Actions. - Updated CI workflows for PR checks, quality checks, and documentation builds to use the latest actions and improve efficiency. - Enhanced Sphinx documentation workflow to include artifact uploads and conditional deployments to GitHub Pages. - Refactored Python version setup in workflows to support multiple versions and improve caching. - Removed version retrieval logic from `__init__.py` to streamline version management.
Test Results (Python 3.13)250 tests 250 ✅ 4s ⏱️ Results for commit 5edd9f8. ♻️ This comment has been updated with latest results. |
Test Results (Python 3.12)250 tests 250 ✅ 4s ⏱️ Results for commit 5edd9f8. ♻️ This comment has been updated with latest results. |
Test Results (Python 3.11)250 tests 250 ✅ 4s ⏱️ Results for commit 5edd9f8. ♻️ This comment has been updated with latest results. |
- Streamlined test discovery settings in pytest, specifying test file patterns and directories. - Enhanced overall structure and readability of the configuration file.
- Removed unused imports from `__init__.py` to streamline the module. - Cleaned up whitespace in `quota_cache.py`, `rate_limiter_async.py`, and `rate_limiter_sync.py` for improved readability and consistency.
Test Results250 tests 250 ✅ 4s ⏱️ Results for commit 2f67421. |
1 similar comment
Test Results250 tests 250 ✅ 4s ⏱️ Results for commit 2f67421. |
Test Results250 tests 250 ✅ 4s ⏱️ Results for commit 5edd9f8. ♻️ This comment has been updated with latest results. |
- Added a new `docs` target in the Makefile for building documentation with Sphinx. - Changed code block syntax in `rate_limiting.rst` from Python to text for better clarity. - Enhanced docstring examples in `rate_limiter_decorators.py` to use proper formatting for `**limiter_kwargs` and added example block formatting.
- Created a new .gitkeep file in the _static directory to ensure it is tracked in git. - This file allows Sphinx to utilize the _static directory for custom static files if needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Summary
This PR introduces a sophisticated rate limiting system for the pyLDB library, automatically enforcing GUS BDL API quotas to prevent limit violations. The implementation provides both synchronous and asynchronous rate limiting with persistent quota tracking, ensuring reliable API usage across different execution contexts and process restarts.
🎯 Purpose & Context
The GUS BDL API enforces strict quota limits based on user registration status (anonymous vs registered users). Without proper rate limiting, users could easily exceed these limits, resulting in API errors and service disruptions. This implementation addresses the critical need for automatic quota management while maintaining high performance and flexibility.
Key business value:
🔧 Changes Made
Core Rate Limiting Infrastructure
@rate_limitand@async_rate_limitfor function-level quota managementAPI Integration
Quota Management
Testing & Quality Assurance
Documentation & Configuration
rate_limiting.rstdocumentation with examples and best practicesCI/CD Improvements
✅ Testing
Test Coverage:
Manual Testing Steps:
Test Results: All 224 tests passing with comprehensive coverage of new functionality.
🚨 Breaking Changes & Migration Notes
No breaking changes - All existing API usage continues to work unchanged. Rate limiting is automatically applied and transparent to existing users.
New optional features:
LDBConfig.custom_quotasLDBConfig.quota_cache_enabledLDB_QUOTAS)🔍 Review Focus Areas
Critical areas for review:
Performance considerations:
📦 Dependencies & Side Effects
New dependencies:
pytest-xdist>=3.8.0(dev): Parallel test execution for faster CINo production dependencies added - Rate limiting uses only standard library components.
Side effects:
.cache/pyldb/directory🚀 Deployment Notes
Zero deployment impact - Rate limiting is opt-in through configuration and backward compatible.
Environment considerations:
Monitoring recommendations: