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 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:
  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 SAMKinds in smarter-types, which defines which kinds exist, then release it and raise its version here. smarter.apps.api.v1.manifests.enum re-exports it. See Smarter Types.

  5. Add waffle logging and feature switches as necessary to smarter.lib.django.waffle.SmarterWaffleSwitches

  6. Ensure that the web console’s sidebar links to your feature’s page: add its url to smarter.apps.dashboard.context_processors.sidebar_context() and to the session’s smarter.apps.api.web.session.contract.ConsoleSidebar, and its item to the console’s packages/smarter-console/src/lib/sidebar.ts, in smarter-console

  7. Ensure that exceptions are properly handled and that you have inherited from smarter.common.exceptions.SmarterException

  8. Add your feature’s Broker to smarter.apps.api.v1.cli.brokers.Brokers. The docs pages, /docs/manifest/<kind>/ and /docs/json-schema/<kind>/, then show the new kind’s example manifest and JSON Schema: they list every kind in SAMKinds, and read both from the cli api.

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

  4. Ensure that all classes and functions have Sphinx-compatible docstrings.

  5. Ensure that your code adheres to PEP 8 style guidelines.