Skip to content

Programming Interface

Chris Meyer edited this page Aug 28, 2020 · 3 revisions

The programming interface (API) allows users and developers to extend the functionality using Python.

The application may evolve and the API needs to be designed with that evolution in mind.

As much as possible the API should use standard Python practices.

The API may be split into modules representing different types of functionality.

  • Library API for manipulating library items and relationships between library items.
  • User Interface API for presenting user interfaces.
  • Interactive API for presenting interactive or procedural scripts.
  • Data API for manipulating data and calibrations (based on NumPy/SciPy).

In addition to the API provided by the application itself, extensions and plug-ins may themselves provide additional APIs.

The library should be accessed and manipulated from the main thread and always be fast.

The UI should always run on the main thread and always be fast.

Data processing should be run on a thread and can be time consuming.

The API should provide straightforward mechanisms for ensuring proper thread usage.

Processing Components

Processing components are meant to be isolated extensions implementing processing variations.

Some guidelines:

  • Processing may need to support partial updating, cancellation, progress reporting, and parallelization.

  • A component should be extendible, handle missing methods, and easy for component implementors.

  • The component itself it shared between instances. So an instance of the component could be representing by a dict.

  • Optional methods could return False if they are not implemented; or they could just not be implemented.

  • Facilitate future arguments by accepting **kwargs at the end of each function.