Skip to main content

smarter-types

A project of The Smarter Project Release codecov PyPI Python License: AGPL v3 Docs

The plain-Python type definitions that the Smarter platform and the Smarter Python SDK (pip install smarter-api) share.

from smarter_types import SAMKinds

SAMKinds.str_to_kind("sqlplugin")         # "SqlPlugin"
SAMKinds.plural(SAMKinds.API_CONNECTION)  # "ApiConnections"

# apply a set of manifests so that each resource comes after the ones it names.
manifests = [{"kind": "SqlPlugin"}, {"kind": "SqlConnection"}, {"kind": "Secret"}]
manifests.sort(key=lambda m: SAMKinds.apply_rank(m["kind"]))
[m["kind"] for m in manifests]            # ["Secret", "SqlConnection", "SqlPlugin"]

Documentation: https://docs.smarter-types.smarter.sh/

Why it exists

The platform (a Django application) and the SDK (which runs without Django) must agree on which kinds of manifest exist, which verbs the /api/v1/cli/ api has, and what the journal records. When each defined them itself, the copies drifted: a kind added to the platform was rejected by the SDK until someone copied it there. smarter-types defines them once, and both depend on it. Each re-exports the classes from the modules that used to define them, so their own imports don't change.

What's in it

  • smarter_types.kinds.SAMKinds: every SAM kind, and the single source of truth for which kinds exist. str_to_kind(), plural(), all_plugins(), all_connections(), and the apply order: apply_order() and apply_rank().
  • smarter_types.journal: SmarterJournalThings (the things the Smarter Journal records; each kind's value comes from SAMKinds), SmarterJournalCliCommands (the verbs of /api/v1/cli/), and the keys of the cli api's responses.
  • smarter_types.enum.SmarterEnumAbstract: the base class of these enumerations, with all(), list_all(), the url slugs and from_url().
  • smarter_types.exceptions: SmarterTypesError, and SmarterTypesValueError, which is also a ValueError.

Plain Python: no Django, no Pydantic. Its only dependency is inflection. Typed (py.typed).

Installation

pip install smarter-types

It needs Python 3.10 or newer. The Smarter platform and the Smarter Python SDK install it for you.

Development

make            # list every command
make init       # create venv/ from requirements/local.txt, install the package and the git hooks
make test       # run the tests
make coverage   # run the tests with a coverage report (at least 95%)
make typecheck  # check the type annotations with mypy
make lint       # run the pre-commit hooks on every file
make sphinx-build   # build the Sphinx docs into docs/build/html
make sphinx-publish # publish them to docs.smarter-types.smarter.sh (releases do it themselves)
make build      # build the sdist and wheel, and check them
make python-requirements  # recompile the pinned requirements/*.txt

CI runs the hooks, mypy and the tests on every supported Python version, the docs build, and a package build, on every pull request, and on every push to main, alpha and beta as the first step of the Release workflow. Coverage is reported to Codecov. When CI passes, the Release workflow releases with semantic-release, from the conventional commit messages, and publishes to PyPI from main (or to TestPyPI from alpha and beta). Once PyPI has a release from main, the same workflow publishes its documentation to docs.smarter-types.smarter.sh. make release-dry-run shows the next version.

Adding a kind

  1. Add the member to SAMKinds, and give it a place in apply_order(): after every kind its manifests may name, and before every kind that may name it. Add it to SmarterJournalThings too, with its value taken from SAMKinds.
  2. Release it, with a feat commit.
  3. Raise the minimum version of smarter-types in the platform and the SDK, and add the kind's broker and models there.

Contributing

Bug reports, questions and pull requests are welcome. Please open an issue before starting on a larger change, so that its design can be agreed first.

  1. Fork the repository, and branch from main.
  2. Run make init. It also installs the pre-commit hooks, which are the lint standard (black, flake8, isort, pyupgrade, codespell, bandit, Prettier) and check each commit message.
  3. Make your change with its tests. make coverage must stay at 95% or more.
  4. Write conventional commits, e.g. feat(kinds): add the Orchestrator kind. Releases are versioned from them: fix makes a patch release, feat a minor one.
  5. Open a pull request that says what changed and why, and links its issue.

Removing or renaming a member, or changing a value, breaks the platform, the SDK and manifests already written, so it needs a major release.

Governance of the Smarter projects is described in smarter-sh/community. Everyone who takes part is expected to follow the code of conduct.

License

AGPL-3.0-or-later

Metadata

Release files for smarter-types 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smarter-types 0.1.0
File Size Uploaded Provenance
smarter_types-0.1.0.tar.gz 25.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for smarter-types 0.1.0
File Interpreter ABI Platform
smarter_types-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / smarter_types-0.1.0.tar.gz

Download URL smarter_types-0.1.0.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a013adc456083215cef63a1fa771bc1fcb16bd1583d6d7363f5370c7704d9ef7
BLAKE2b-256 checksum
How to use checksums
0597b37a7caec3153a08841566a71ca96eac1b8d12b5326aff854e9a618cee3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / smarter_types-0.1.0-py3-none-any.whl

Download URL smarter_types-0.1.0-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1013a83a3d3fefe665cc5454ca97eef5a739759712f90cf2f565bc9dc66a0d42
BLAKE2b-256 checksum
How to use checksums
dff8c25cef623546a07d5407cd30a3fa58f2ed4e075a0d4607e289e5f0516311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for smarter-types 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smarter_types-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page