Django/Python
API filtering, rate-limiting and file uploads, plus tons of code quality improvements
June 15th, 2023
In this article:
In our relentless pursuit to make your development journey easier, we have rolled out new features and bug fixes that were on our TODO list for a long time!
Let's delve into the details:
-
Extended Functionality for File and Image Fields: Having to base64-encode files or fallback to
multipart/form-data
just sucks, and we wanted to better for a long time. So, now, we've provided an additionalupload
view for models with file and image fields. This allows users to simply PUT the file to be uploaded, making your task easier and more efficient. -
Improved Git Pre-commit Setup: To ensure consistency and quality in your code, we've established a git pre-commit setup for ruff (the new and upcoming Python linter), black (the uncompromising formatter) and isort (import sort formatter). These tools will check and format your code automatically, helping to maintain high standards and reduce bugs.
-
Optional Support for Code Coverage: We've introduced optional support for code coverage, providing you with useful statistics about how much of your code is being tested. For freshly-created projects on API Bakery, you can expect 90%+ code coverage out of the box.
-
Rate-limiting Capabilities: To protect your server from potential overload, we have included optional support for rate-limiting. You can configure your server to limit the requests from both authenticated and anonymous users, enhancing the security and performance of your application.
-
Advanced Filtering in API Calls: When dealing with large collections of models, we understand the need for efficient filtering. Hence, we've incorporated support for optional filtering in API calls to list collections of models, allowing exact or case-insensitive matches. This streamlines your workflow when handling large data sets. We're using
django-filter
which can be easily extended to support as complex filtering cases as you'll ever need. -
Bug Fixes: As always, the enhancement of your experience with API Bakery is our top priority. With this in mind, we have squashed numerous bugs to improve your user experience.
The latest version of API Bakery is available now. We encourage you to explore these enhancements and let us know what you think! We are committed to continually improving our services and would appreciate your valuable feedback.
Happy coding!