Table of Contents
Third-Party Library Guideline
Best practices for which library to use and how to choose.
How to choose a library?
Here are some checklist when choosing a new library:
- Check the amount of star in GitHub, the more star the better.
- Check if documentation is available.
- Check how often library getting updates.
- Check when is the latest code update, if the latest update was years ago meaning the library probably not being maintained anymore.
- Check if there are unit tests, usually good code come with unit test.
- You can get more analytics from the Insights tab in GitHub, to see if the community with this library is good enough.
- Check security report in Security tab.
Recommended Libraries
These are the recommended library for each categories. This does not mean that every project must install all the libraries listed here. Only install what you need to use. Best practices is install when you need instead of install from all at once, keep your requirements growing.
Common
- Django: web framework.
- Rest Framework: API Endpoint.
- Simple JWT: authentication with JSON Web Token.
- CORS Header: browser CORS header.
- API Key implementing API Key authorization.
- Filter: filter data from URL parameters.
- Model Controller: keeping track of database record.
- Sequences: sequence generator.
- Redis: connecting to redis server.
Background Worker
- Celery background worker.
Excel
- OpenPyXL: working with Excel
- Excel Tool: validate data from excel
- WeasyPrint: generate PDF from HTML
Development
- Debug Toolbar: optimizing API performance.
- Environ: helper when using environment variable.
- ipdb: extended from pdb for code completion and more.
- DRF Spectacular: generating API Doc for Django REST Framework.
Unit Test
- Test Without Migrations: speed up testing without running database migration and playing around with model design.
- Factory Boy: mocking model data.
- Slow Test: reporting which unit test run too slow.
- Coverage: reporting amount of code that covered by unit test.
- Freezegun: freeze time for testing.
Monitoring
- Sentry-SDK: unhandled exception report