The Extension’s pyproject.toml
An Extension describes itself in the pyproject.toml at the root of its archive. It is not a
SAM manifest: it is a standard
Python project file:
Smarter reads its [project] table, and its own [tool.smarter] table. It is
validated by ExtensionManifest when the
Extension is validated, packaged, published and installed.
[project]
Field |
Required |
Meaning |
|---|---|---|
|
Yes |
The distribution’s name, by convention |
|
Yes |
The version, a PEP 440 version such as |
|
No |
One line, shown in the admin console and the registry. |
|
No |
|
|
No |
An SPDX expression, e.g. |
|
No |
The Python versions it works with, e.g. |
|
No |
The libraries it imports, as PEP 508 requirements, e.g. |
|
No |
|
Other [project] fields are allowed, and ignored.
[tool.smarter]
Field |
Required |
Meaning |
|---|---|---|
|
Yes |
The Extension’s permanent identifier: at most 32 lowercase letters and digits, in words
separated by single hyphens, e.g. |
|
Yes |
The Python package, at the archive’s root, that holds the code, e.g. |
|
No |
The name shown to people. Defaults to the slug in title case. |
|
No |
The Smarter versions it works with, e.g. |
|
Yes |
The tools’ classes, as |
|
No |
The class of its lifecycle hooks, as |
|
No |
Seconds that a tool call may run, from 1 to 300. Defaults to 30. |
|
No |
The path of its icon, relative to the package, e.g. |
|
No |
The settings that an administrator configures: see below. |
|
No |
The waffle switches that it owns: see The Extension Lifecycle. |
Settings
Each [[tool.smarter.settings]] table declares one setting:
[[tool.smarter.settings]]
name = "weather_api_url"
type = "url"
default = "https://api.open-meteo.com/v1/forecast"
description = "The Open-Meteo forecast api."
Field |
Meaning |
|---|---|
|
A Python identifier. The tool reads the setting as |
|
|
|
Shown to the administrator, in the settings form. |
|
The value when none is configured. A secret has no default. |
|
Whether the Extension can’t be enabled until the setting has a value or a default. |
|
The allowed values of a |
A secret setting’s value is a Smarter Secret, encrypted at rest. It reaches the tool as a
pydantic.SecretStr. A setting that has neither a value nor a default is None.
By convention, name a secret setting after the platform Secret that it would naturally use, such
as google_maps_api_key: manage.py add_builtin_extensions configures an official
Extension’s unset secret settings from the platform administrator’s Secrets of the same names.
The Archive
An archive is a zip file that holds the pyproject.toml and the package, at its root, or all in
one top-level directory, as GitHub’s source archives are. manage.py package_extension builds
one, with the README, LICENSE and CHANGELOG, if any, and without caches. An archive may be at most
10 MB, expand to at most 50 MB, and hold at most 2000 files, and may not contain links or paths
that leave its directory.
The package may hold:
Path |
Purpose |
|---|---|
|
Required. Its module docstring, in reStructuredText, is the Extension’s documentation. |
|
SAM manifests that the Extension applies when it is installed. See The Extension Lifecycle. |
|
Assets, such as its icon. |
|
More documentation pages. |