UniteLabs
Reference

Naming Conventions

How to name connector projects, files, features, endpoints, and parameters.

Names show up in three places: the repository, the Python code, and the SiLA interface that clients see. The CDK derives the SiLA identifiers from your Python names, so a naming choice in code becomes part of the public interface.

For the reasoning behind feature boundaries and vendor terminology, see Designing Features.

Project and package names

The Connector Factory derives every name from the display name you enter.

NameCookiecutter variableCaseExample
Display nameconnector_nameTitle Case with spacesAgilent Microplate Centrifuge
Project nameproject_namehyphen-caseagilent-microplate-centrifuge
Package namepackage_namesnake_caseagilent_microplate_centrifuge, imported as unitelabs.agilent_microplate_centrifuge
  • The display name is also the GitLab project title.
  • The project name is the repository path and the top-level directory. Don't use underscores in it.
  • The package name is the import name. Don't use hyphens in it.
  • Don't include unitelabs in the project or package name. The package is already namespaced as unitelabs.<package_name>.
  • Don't rename an existing connector without a migration plan. Renaming the display name also changes the derived package name, so the connector is rebuilt under a new import path that customers can confuse with the old one, and their update path breaks.

File and folder names

RuleUseNot
A feature's folder and module are the snake_case form of its class namerandom_number_provider/random_number_provider.py for RandomNumberProviderrng/provider.py
Keep file names short; don't repeat the connector or package nameerrors.py, units.py, protocol.pyfile_system_errors.py, file_system_protocol.py

Feature names

Name every feature class as a noun plus a role suffix, following the SiLA 2 standard.

SuffixUse forExample
ControllerA feature with any control capability. It can still expose properties.TemperatureController controls the device and exposes readings
ProviderA feature that only provides information or sensor values, with no controlsDeviceInformationProvider
ServiceA feature that doesn't actively operate the device: meta features of the SiLA server itself, and maintenance features such as teaching, calibration, or settings that configure how the server is usedConnectionConfigurationService, TeachingService, CalibrationService
RuleUseNot
Name the actor that does the work, not the artifact it handlesBarcodeReaderControllerBarcodeController
Don't include the word FeatureTemperatureControllerTemperatureControllerFeature
Don't repeat the connector or package nameFileServiceFileSystemFileService
Don't abbreviateLiquidLevelProviderLLProvider

Before inventing a new feature name, check the SiLA base feature repository for an existing one. Reusing an established name keeps connectors interoperable.

Endpoint names

The CDK derives each endpoint's SiLA identifier from the Python method name.

Endpoint typeConventionMethod nameSiLA identifier
Unobservable propertyPrefix with get_; the CDK strips itget_serial_numberSerialNumber
Observable propertyPrefix with subscribe_; the CDK strips itsubscribe_temperatureTemperature
CommandStart with an action verb; nothing is strippedstart_rampStartRamp

The get_ and subscribe_ prefixes only signal intent to someone reading the code. A command's verb is kept, so the verb you choose is part of the public identifier.

RuleUseNot
Use full words, not abbreviations or acronymsreset_emergency_stopreset_estop
Don't repeat the feature's context (on TemperatureController)start_ramp, currentstart_temperature_ramp, current_temperature
Don't put a unit in an identifier; use a Unit constraint insteadtimeouttimeout_ms
Use one name for the file, the class, and the public identifierdoor_controller.py, DoorController, DoorControllerlid.py, DoorController, LidController

Acronyms

The derivation only capitalizes the first letter of each word, so get_server_uuid becomes ServerUuid. To keep an acronym uppercase, set name= on the decorator:

@sila.UnobservableCommand(name="Set ID Number")
async def set_id_number(self, id_number: int) -> None:
    """
    Set the identification number of the device.

    Args:
      IdNumber: The new identification number.
    """

This produces the identifier SetIDNumber. Without name=, the identifier is SetIdNumber.

Standard command vocabulary

When the device's operation matches one of these verbs, use it. If an operation is close but not an exact match, still use the standard verb and describe the difference in the docstring rather than inventing a variant.

VerbTypical use
initialize / deinitializeBring the device into or out of an operational state
resetReturn the device to a known state
standbyPut the device into a low-activity state
start / stopBegin or end an action with no natural end point
homeMove axes to their reference position
open / closeDoors, lids, and other access points
extend / retractCarriers, drawers, and linear actuators
lock / unlockLocking mechanisms
sealPlate sealing
decap / recapTube capping
updateApply a change to an existing setting or resource
info, status, errorsReport device information, state, or error lists

Vendor terminology

Rename a vendor-specific term to the closest standard term. A vendor's "drawer", "flap", or "hatch" all become "door" in a UniteLabs connector.

When one mechanism combines two operations, name it after the operation the client cares about. A mechanism that opens a door to present a plate is a PlateCarrier with extend and retract, not a Door with open and close, when presenting the plate is the real intent.

The io/ layer is the exception: there, name commands as the vendor's own documentation does, so the protocol layer stays traceable to the manual. See Project Structure.

Repeated modules

When a device has the same physical module several times, register one parametrized class per instance and inject the index through name=. Put the index before the suffix.

UseNot
Door1ControllerDoorController1
Pipette2ServicePipetteService2

When the instances are interchangeable positions on one resource, such as slots in a centrifuge, use a single feature with a slot parameter instead. See Model Repeated Modules for both patterns.

Last updated