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 ----------------- 1. Register your Django app in `smarter.settings.base.INSTALLED_APPS`. 2. Add your app's top-level urls.py to smarter/urls/. 3. Ensure that your Django models inherit from smarter.lib.django.models. 4. Include database migrations for any new models. 5. Include serializers for all models 6. Add API views and viewsets, and ensure they cover all models 7. Add Django admin classes for all models using smarter.apps.dashboard.admin.SmarterCustomerModelAdmin 8. Add your new settings to :class:`smarter.common.conf.settings.SmarterSettings` and include sensible defaults and documentation for each setting. 9. Include a tasks module 10. Include a management commands module 11. Include signals and receivers modules. Smarter / SAM Checklist ----------------------------------- 1. Use Smarter's base and helper classes and subsystems where relevant, especially the following: - :class:`smarter.apps.account.mixins.AccountMixin` - :class:`smarter.apps.account.tests.mixins.TestAccountMixin` - :class:`smarter.common.mixins.SmarterHelperMixin` - :func:`smarter.lib.cache.cache_results` decorator - :class:`smarter.lib.django.request.SmarterRequestMixin` - :class:`smarter.lib.django.validators.SmarterValidator` - :class:`smarter.lib.drf.serializers.SmarterCamelCaseSerializer` and :class:`smarter.apps.account.serializers.MetaDataWithOwnershipModelSerializer` - :class:`smarter.lib.manifest.broker.AbstractBroker` - :class:`smarter.lib.manifest.models.AbstractSAMBase` - get_cached_object() and get_cached_objects() class methods on SAM ORM models 2. Ensure that your unit test coverage ratio is at least 85% for any new code you add. 3. Include SAM models and brokers for each relevant ORM model. 4. Add new Smarter resource kinds to :class:`smarter.apps.api.v1.manifests.enum.SAMKinds` 5. Add waffle logging and feature switches as necessary to :class:`smarter.lib.django.waffle.SmarterWaffleSwitches` 6. Ensure that your UI includes anchors as necessary in :file:`smarter/templates/dashboard/authenticated.html` 7. Ensure that exceptions are properly handled and that you have inherited from :class:`smarter.common.exceptions.SmarterException` 8. Add your feature's JSON schema view to smarter.apps.docs.views.json_schema and register it in smarter.apps.docs.urls 9. Add your feature's example manifest view to smarter.apps.docs.views.manifest and register it in smarter.apps.docs.urls 10. Add your feature's Broker to smarter.apps.api.v1.cli.brokers.Brokers Style Guide Checklist --------------------- 1. Run pre-commit hooks prior to pushing your code 2. Add your documentation to docs/source and test with make sphinx-docs 3. Ensure that your logging entries conform to the `Smarter logging style guidelines <../lib/logging.html>`__ 4. Ensure that all classes and functions have Sphinx-compatible docstrings. 5. Ensure that your code adheres to PEP 8 style guidelines.