Smarter Types

The platform and the Smarter Python SDK must agree on which kinds of manifest exist, which commands the cli api has, and what the Smarter Journal records. Both take these definitions from one package, smarter-types, which is plain Python, with no Django and no Pydantic, and has its own documentation at docs.smarter-types.smarter.sh. It holds:

  • SAMKinds, every kind of Smarter Application Manifest, and the single definition of which kinds exist. It also gives the order in which manifests of several kinds are applied, apply_order(), so that a Secret exists before the Connection that uses it, and a Connection before its plugin.

  • SmarterJournalThings, the things the journal records, and SmarterJournalCliCommands, the commands of the cli api, with the keys of the cli api’s responses.

  • SmarterEnumAbstract, the base class of these enumerations.

Smarter lists the package in smarter/requirements/in/base.in, and make python-requirements pins its version. Smarter re-exports each class from the module that defined it before the package existed, so platform code imports them as it always has: smarter.apps.api.v1.manifests.enum (SAMKinds), smarter.lib.journal.enum (the journal’s enumerations) and smarter.common.enum (SmarterEnumAbstract).

To add a resource kind, add it to SAMKinds in smarter-types first, with its place in the apply order, and release the package. Then run make python-requirements here to pick up the new version, and give the kind an icon in SAM_KIND_ICONS.