smarter-types
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()andapply_rank().smarter_types.journal:SmarterJournalThings(the things the Smarter Journal records; each kind's value comes fromSAMKinds),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, withall(),list_all(), the url slugs andfrom_url().smarter_types.exceptions:SmarterTypesError, andSmarterTypesValueError, which is also aValueError.
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
- Add the member to
SAMKinds, and give it a place inapply_order(): after every kind its manifests may name, and before every kind that may name it. Add it toSmarterJournalThingstoo, with its value taken fromSAMKinds. - Release it, with a
featcommit. - Raise the minimum version of
smarter-typesin 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.
- Fork the repository, and branch from
main. - 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. - Make your change with its tests.
make coveragemust stay at 95% or more. - Write conventional commits, e.g.
feat(kinds): add the Orchestrator kind. Releases are versioned from them:fixmakes a patch release,feata minor one. - 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
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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| smarter_types-0.1.0.tar.gz | 25.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.