A Python Starter Template
Each connector, like a Terraform provider, forms an adapter to some specific remote API or service. The config file autoschematic.ron is used to specify which connectors are enabled in an Autoschematic repository. A connector is always instantiated under some prefix; a prefix is just a top-level folder used to organize connectors & their resource & output files, whether by environment, team, or any other division within a repo.
To get started with building your own Autoschematic connector in Python, you can first clone autoschematic-sh/autoschematic-connector-template-python.
By starting from the template, you can implement this protocol with some straightforward boilerplate, and hopefully end up with a usable connector for your target API or service.
The reference Python connector for this guide set is the Grafana example in autoschematic-sdk-python/examples/grafana.py. In autoschematic.ron, a local Python connector is enabled with PythonLocal:
A Python connector is just a Python program that subclasses autoschematic_sdk.Connector and hands control to connector_main():
(Note: init() in Rust is called new(), and init() was chosen as the second stage initialization step, hence the confusing naming...)
__init__()should just do basic initialization, and not do any config validation or longer setup.init()is where you read config, validate credentials etc, and build e.g. client or session objects for later use.- Store
prefixon the connector. All connector methods receive repo-relative addresses such asgrafana/dashboards/adm7jzw.json, notprefix/grafana/.... - Keep reusable API state on
self, such as anaiohttp.ClientSession, database pool, or authenticated SDK client.
Reference files:

