New Feature Checklist
This checklist is intended to help you, a Smarter developer contributor, ensure that any new feature you’re working on is fully integrated into the Smarter framework and is ready for production deployment. Smarter provides a wide range of base classes, helper mixins, and subsystems that you must utilize to ensure your feature’s compatibility and maintainability within the Smarter ecosystem. Plus, following these rules will save you time and improve the quality of your code.
Django Checklist
Register your Django app in smarter.settings.base.INSTALLED_APPS.
Add your app’s top-level urls.py to smarter/urls/.
Ensure that your Django models inherit from smarter.lib.django.models.
Include database migrations for any new models.
Include serializers for all models
Add API views and viewsets, and ensure they cover all models
Add Django admin classes for all models using smarter.apps.dashboard.admin.SmarterCustomerModelAdmin
Add your new settings to
smarter.common.conf.settings.SmarterSettingsand include sensible defaults and documentation for each setting.Include a tasks module
Include a management commands module
Include signals and receivers modules.
Smarter / SAM Checklist
- Use Smarter’s base and helper classes and subsystems where relevant, especially the following:
smarter.apps.account.tests.mixins.TestAccountMixinsmarter.lib.cache.cache_results()decoratorsmarter.lib.drf.serializers.SmarterCamelCaseSerializerandsmarter.apps.account.serializers.MetaDataWithOwnershipModelSerializerget_cached_object() and get_cached_objects() class methods on SAM ORM models
Ensure that your unit test coverage ratio is at least 85% for any new code you add.
Include SAM models and brokers for each relevant ORM model.
Add new Smarter resource kinds to
smarter.apps.api.v1.manifests.enum.SAMKindsAdd waffle logging and feature switches as necessary to
smarter.lib.django.waffle.SmarterWaffleSwitchesEnsure that your UI includes anchors as necessary in
smarter/templates/dashboard/authenticated.htmlEnsure that exceptions are properly handled and that you have inherited from
smarter.common.exceptions.SmarterExceptionAdd your feature’s JSON schema view to smarter.apps.docs.views.json_schema and register it in smarter.apps.docs.urls
Add your feature’s example manifest view to smarter.apps.docs.views.manifest and register it in smarter.apps.docs.urls
Add your feature’s Broker to smarter.apps.api.v1.cli.brokers.Brokers
Style Guide Checklist
Run pre-commit hooks prior to pushing your code
Add your documentation to docs/source and test with make sphinx-docs
Ensure that your logging entries conform to the Smarter logging style guidelines
Ensure that all classes and functions have Sphinx-compatible docstrings.
Ensure that your code adheres to PEP 8 style guidelines.