photons package

Console script entry points.

photons.version_info = (0, 1, 0, 'dev0')

Contains the version information as a (major, minor, micro, releaselevel) tuple.

Type:

namedtuple

photons.cli_parser(*args)[source]

Parse the command line arguments.

Return type:

Namespace

photons.main(*args)[source]

Main console script entry point.

Run photons --help for more details.

Parameters:

args (str) – Command-line arguments.

Return type:

None

Examples

  • Start the main application using the default configuration path
    photons
  • Start the main application using the specified configuration file
    photons my_config.xml
  • Start an equipment Service (using the default configuration path)
    photons --alias shutter
  • Start an equipment Service using the specified configuration file
    photons my_config.xml --alias shutter
  • Start a registered Service and specify kwargs
    photons --name MyService --kwargs "{\"host\":\"localhost\", \"port\":1876}"
  • Start a JupyterLab web server
    photons --jupyter
  • Find equipment
    photons --find
  • Find equipment (with a 5-second timeout for network devices)
    photons --find 5
photons.start_app(config, no_user)[source]

Start the main application instance.

Parameters:
  • config (Optional[str]) – The path to a configuration file.

  • no_user (bool) – Whether to call input(‘Press <Enter> to exit… ‘) if there was an error.

Return type:

int

Returns:

The exit code (0 for success, 1 for error).

photons.start_service(*, alias=None, config=None, name=None, kwargs=None, no_user=False, **ignored)[source]

Start a Service.

Parameters:
  • alias (str) – The alias of an EquipmentRecord to start a generic equipment Service.

  • config (str) – The path to a configuration file. Not required if name is specified.

  • name (str) – The name of a registered Service to start.

  • kwargs (str) – The keyword arguments from the command line.

  • no_user (bool) – Whether to call input(‘Press <Enter> to exit… ‘) if there was an error.

  • ignored – All other keyword arguments are ignored.

Return type:

int

Returns:

The exit code (0 for success, 1 for error).

photons.start_jupyter(config, no_user)[source]

Start a Jupyter web server.

Parameters:
  • config (Optional[str]) – The path to a configuration file.

  • no_user (bool) – Whether to call input(‘Press <Enter> to exit… ‘) if there was an error.

Return type:

int

Returns:

The exit code (0 for success, 1 for error).

Subpackages

Submodules