seamm_installer package

Submodules

seamm_installer.apps module

Handle the apps for SEAMM.

seamm_installer.apps.create()[source]

Create the requested apps.

seamm_installer.apps.delete()[source]
seamm_installer.apps.setup(parser)[source]

Define the command-line interface for handling the apps.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.apps.show()[source]
seamm_installer.apps.update()[source]

seamm_installer.cache module

Handle the cache for SEAMM components.

seamm_installer.cache.refresh()[source]
seamm_installer.cache.setup(parser)[source]

Define the command-line interface for installing SEAMM components.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.cli module

seamm_installer.conda module

class seamm_installer.conda.Conda(logger=<Logger seamm_installer.conda (WARNING)>)[source]

Bases: object

Class for handling conda

activate(environment)[source]

Activate the requested environment.

property active_environment

The currently active Conda environment.

create_environment(environment_file, name=None, force=False)[source]

Create a Conda environment.

Parameters:
  • environment_file (str or pathlib.Path) – The name or path to the environment file.

  • name (str = None) – The name of the environment. Defaults to that given in the environment file.

  • force (bool = False) – Whether to overwrite an existing environment.

delete_environment(name)[source]

Delete a Conda environment.

Parameters:

name (str) – The name of the environment.

property environments

The available conda environments.

exists(environment)[source]

Whether an environment exists.

Parameters:

environment (str) – The name of the environment.

Returns:

True if the environment exists, False otherwise.

Return type:

bool

install(package, environment=None, channels=None, override_channels=True, progress=True, newline=True, update=None)[source]

Install a package in an environment..

Parameters:
  • package (strip) – The package to install.

  • environment (str) – The name of the environment to list, defaults to the current.

  • channels ([str] = None) – A list of channels to search. defaults to the list in self.channels.

  • override_channels (bool = True) – Ignore channels configured in .condarc and the default channel.

  • progress (bool = True) – Whether to show progress dots.

  • newline (bool = True) – Whether to print a newline at the end if showing progress

  • update (None or method) – Method to call to e.g. update a progress bar

property is_installed

Whether we have access to conda.

list(environment=None, query=None, fullname=False, update=None)[source]

The contents of an environment.

Parameters:
  • environment (str) – The name of the environment to list, defaults to the current.

  • query (str) – Regexp for package names, default to all packages

  • update (None or method) – Method to call to e.g. update a progress bar

Returns:

A dictionary keyed by the package names.

Return type:

dict

path(environment)[source]

The path for an environment.

Parameters:

environment (str) – The name of the environment to remove.

Returns:

The path to the environment.

Return type:

pathlib.Path

property prefix

The path for the conda root.

remove_environment(environment)[source]

Remove an existing environment.

Parameters:

environment (str) – The name of the environment to remove.

property root_prefix

The root prefix of the conda installation.

search(query=None, channels=None, override_channels=True, progress=True, newline=True, update=None)[source]

Run conda search, returning a dictionary of packages.

Parameters:
  • query (str = None) – The pattern to search, Defaults to None, meaning all packages.

  • channels ([str] = None) – A list of channels to search. defaults to the list in self.channels.

  • override_channels (bool = True) – Ignore channels configured in .condarc and the default channel.

  • progress (bool = True) – Whether to show progress dots.

  • newline (bool = True) – Whether to print a newline at the end if showing progress

  • update (None or method) – Method to call to e.g. update a progress bar

Returns:

A dictionary of packages, with versions for each.

Return type:

dict

show(package)[source]

Show the information for a single package.

Parameters:

package (str) – The name of the package.

uninstall(package, environment=None, channels=None, override_channels=True, progress=True, newline=True, update=None)[source]

Uninstall a package from an environment..

Parameters:
  • package (str) – The package to uninstall install.

  • environment (str) – The name of the environment to list, defaults to the current.

  • channels ([str] = None) – A list of channels to search. defaults to the list in self.channels.

  • override_channels (bool = True) – Ignore channels configured in .condarc and the default channel.

  • progress (bool = True) – Whether to show progress dots.

  • newline (bool = True) – Whether to print a newline at the end if showing progress

  • update (None or method) – Method to call to e.g. update a progress bar

update(package=None, environment=None, channels=None, override_channels=True, progress=True, newline=True, all=False, update=None)[source]

Update a package in an environment..

Parameters:
  • package (strip) – The package to update.

  • environment (str) – The name of the environment to list, defaults to the current.

  • channels ([str] = None) – A list of channels to search. defaults to the list in self.channels.

  • override_channels (bool = True) – Ignore channels configured in .condarc and the default channel.

  • progress (bool = True) – Whether to show progress dots.

  • newline (bool = True) – Whether to print a newline at the end if showing progress

  • all (bool = False) – Fully update the environment.

  • update (None or method) – Method to call to e.g. update a progress bar

update_environment(environment_file, name=None)[source]

Update a Conda environment.

Parameters:
  • environment_file (str or pathlib.Path) – The name or path to the environment file.

  • name (str = None) – The name of the environment. Defaults to the current environment.

seamm_installer.configuration module

A class for reading, updating and writing the configuration file.

This class handles the configuration (.ini) file as text, so that comments in the file are preserved.

class seamm_installer.configuration.Configuration(path=None)[source]

Bases: object

add_prolog(text='', force=False)[source]

Add the prolog to the configuration.

Parameters:
  • text (str = '') – The body of the prolog, which should be just comments.

  • force (bool = True) – Whether to overwrite an existing prolog.

add_section(name, text='', force=False)[source]

Add a new section to the configuration.

Parameters:
  • name (str) – The name of the section.

  • text (str = '') – The body of the section, which must be properly formatted.

  • force (bool = True) – Whether to overwrite an existing section of the same name.

file_exists()[source]

Whether the configuration file exists.

from_string(text)[source]

Replace the contents of the configuration with those from text.

Parameters:

text (str) – The configuration data as text.

get_prolog()[source]

Return the prolog of the file, if any.

Returns:

The prolog of the configuration.

Return type:

str

get_values(section)[source]

Return the values in a section as a dictionary.

Returns an empty dictionary if the section does not exist, or if it does not contain any keyword definitions. Use section_exists to differentiate.

Parameters:

section (str) – The name of the section to retrieve.

Returns:

A dictionary of keyword-value pairs, as strings.

Return type:

dict

property path

The path to the configuration file.

save()[source]

Save the current configuration to disk.

section_exists(section)[source]

Return whether a section exits in the configuration.

Parameters:

section (str) – The name of the section.

Returns:

True if the section exists; False otherwise.

Return type:

bool

sections()[source]

Return a list of sections in the configuration.

Returns:

The list of sections.

Return type:

[str]

set_value(section, key, value, strict=False)[source]

Set the key in a section.

Parameters:
  • section (str) – The section to work with.

  • key (str) – The key to set in the section.

  • value (str) – The value to set the key to.

  • strict (bool = False) – Raise an error is the key does not already exist.

to_string(section=None)[source]

Create the text of a section.

Parameters:

section (str) – The name of the section. Defaults to the entire file.

seamm_installer.datastore module

Handle the datastore for SEAMM.

seamm_installer.datastore.db_version()[source]

Return the version of the database.

seamm_installer.datastore.latest_version()[source]

Show information about the datastore.

seamm_installer.datastore.setup(parser)[source]

Define the command-line interface for handling services.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.datastore.show()[source]

Show information about the datastore.

seamm_installer.datastore.update()[source]

Update the database to the latest version.

seamm_installer.datastore.update_db()[source]

Update the database to the latest version.

seamm_installer.gui module

seamm_installer.install module

seamm_installer.installer_base module

class seamm_installer.installer_base.InstallerBase(ini_file='~/.seamm.d/seamm.ini', logger=<Logger seamm_installer.installer_base (WARNING)>)[source]

Bases: object

A base class for plug-in installers.

This base class provides much of the functionality needed by installers for plug-ins, but not the functionality specific to a given plug-in.

section

The section of the configuration file to use. Defaults to None.

Type:

str

ask_yes_no(text, default=None)[source]

Ask a simple yes/no question, returning True/False.

Parameters:

text (str) – The text of the question.

Returns:

True for yes; False, no

Return type:

bool

check()[source]

Check the installation and fix errors if requested.

If the option yes is present and True, this method will attempt to correct any errors in the configuration file. Use –yes on the command line to enable this.

The information in the configuration file is:

installation

How the executables are installed. One of user, modules or conda

conda-environment

The Conda environment if and only if installation = conda

modules

The environment modules if installation = modules

{self.path_name}

The path where the executables are. Automatically defined if installation is conda or modules, but given by the user is it is user.

Returns:

True if everything is OK, False otherwise. If yes is given as an option, the return value is after fixing the configuration.

Return type:

bool

check_configuration_file()[source]

Checks that the necessary section for the plug-in is in the configuration file.

property conda

The Conda object to use for accessing Conda.

property configuration

The Configuration object for working with the ini file.

property exe_config
executables_in_path()[source]

Check whether the executables are found in the PATH.

Returns:

The path where the executables are, or None.

Return type:

pathlib.Path

have_executables(path)[source]

Check whether the executables are found at the given path.

Parameters:

path (pathlib.Path) – The directory to check.

Returns:

True if all of the executables are found.

Return type:

bool

install()[source]

Install using a Conda environment.

property pip

The Pip object used for working with pip.

run()[source]

Do what the user asks via the commandline.

setup_parser()[source]

Parse the command line into the options.

show()[source]

Show the current installation status.

uninstall()[source]

Uninstall the Conda environment.

update()[source]

Update the installation, if possible.

seamm_installer.linux module

Linux OS specific routines handling unique operations.

  • Installing daemons to handle the Dashboard and JobServer

class seamm_installer.linux.ServiceManager(prefix='')[source]

Bases: object

create(name, exe_path, *args, user_agent=True, user_only=True, stderr_path=None, stdout_path=None, exist_ok=False)[source]

Create a service on Linux.

Linux supports three types of services. This function uses user_agent and user_only to control which is selected.

  1. A user service for a single user, which runs while that user is logged in. (True, True)

  2. A service installed by the admin that is available for all users, and runs when any user is logged in. (True, False)

  3. A system-wide service that runs when the machine is booted. (False, not used)

Parameters:
  • name (str) – The name of the agent

  • exe_path (pathlib.Path or str) – The path to the executable (required). Either a path-like object or string

  • args ([]) – List of arguments for the program.

  • user_agent (bool = True) – Whether to create a per-user agent (True) or system-wide daemon (False)

  • user_only (bool = True) – Whether to install for just the current user (True) or all users (False). Only affects user agents, not daemons which are always system-wide.

  • stderr_path (pathlib.Path or str = None) – The file to direct stderr. Defaults to “~/SEAMM/logs/<name>.out”

  • stdout_path (pathlib.Path or str = None) – The file to direct stdout. Defaults to “~/SEAMM/logs/<name>.out”

  • exist_ok (bool = False) – If True overwrite an existing file.

property data
delete(service, ignore_errors=False)[source]
file_path(service)[source]

Return the path to the unit file for the service.

is_installed(service)[source]
is_running(service)[source]
list()[source]
property paths
restart(service, ignore_errors=False)[source]
start(service, ignore_errors=False)[source]
status(service)[source]
stop(service, ignore_errors=False)[source]
property uid
seamm_installer.linux.create_app(exe_path, *args, name='SEAMM', comment='the Simulation Environment for Atomistic and Molecular Modeling', user_only=False, icons=None, **kwargs)[source]

Create an application bundle for a Linux app.

Parameters:
  • exe_path (pathlib.Path or str) – The path to the executable (required). Either a path-like object or string

  • name (str) – The name of the app

  • comment (str = "the Simulation Environment for Atomistic and Molecular Modeling") – A comment for use in tooltips, etc.

  • user_only (bool = False) – Whether to install for just the current user or all users (default).

  • icons (pathlib.Path or str) – Optional path to the icns files to use.

  • kwargs – Other keywords arguments for compatibility with other OS’s. Ignored

seamm_installer.linux.delete_app(name, missing_ok=False)[source]

Delete the app given.

Parameters:
  • name (str) – The name of the app.

  • missing_ok (bool = False) – Don’t throw an error if the app does not exist.

seamm_installer.linux.get_apps()[source]

Return a list of all user applications.

Returns:

{str – Dictionary of app names and paths to the desktop file.

Return type:

str}

seamm_installer.linux.list_to_dict(lst)[source]
seamm_installer.linux.update_app(name, version, missing_ok=False)[source]

Update the version for a Linux app.

Since the desktop file does not have the version, nothing to do.

Parameters:
  • name (str) – The name of the app

  • version (str) – The version of the app.

  • missing_ok (bool = False) – Don’t throw an error if the app does not exist.

seamm_installer.mac module

Mac OS specific routines handling unique operations.

  • Creating the ‘app’

  • Installing Launch Agents to handle the Dashboard and JobServer

class seamm_installer.mac.ServiceManager(prefix='')[source]

Bases: object

create(name, exe_path, *args, user_agent=True, user_only=True, stderr_path=None, stdout_path=None, exist_ok=False)[source]

Create a service on MacOS.

The Mac supports three types of services. This function uses user_agent and user_only to control which is selected.

  1. A user Launch Agent for a single user, which runs while that user is logged in. (True, True)

  2. A Launch Agent installed by the admin that is available for all users, and runs when any user is logged in. (True, False)

  3. A system-wide service that runs when the machine is booted. (False, not used)

Parameters:
  • name (str) – The name of the agent

  • exe_path (pathlib.Path or str) – The path to the executable (required). Either a path-like object or string

  • args ([]) – List of arguments for the program.

  • user_agent (bool = True) – Whether to create a per-user agent (True) or system-wide daemon (False)

  • user_only (bool = True) – Whether to install for just the current user (True) or all users (False). Only affects user agents, not daemons which are always system-wide.

  • stderr_path (pathlib.Path or str = None) – The file to direct stderr. Defaults to “~/SEAMM/logs/<name>.out”

  • stdout_path (pathlib.Path or str = None) – The file to direct stdout. Defaults to “~/SEAMM/logs/<name>.out”

  • exist_ok (bool = False) – If True overwrite an existing file.

property data
delete(service, ignore_errors=False)[source]
file_path(service)[source]

Return the path to the plist file for the service.

is_installed(service)[source]
is_running(service)[source]
list()[source]
property paths
restart(service, ignore_errors=False)[source]
start(service, ignore_errors=False)[source]
status(service)[source]
stop(service, ignore_errors=False)[source]
property uid
seamm_installer.mac.create_app(exe_path, *args, identifier=None, name='SEAMM', version='0.1.0', user_only=False, icons=None, copyright=None)[source]

Create an application bundle for a Mac app.

Parameters:
  • exe_path (pathlib.Path or str) – The path to the executable (required). Either a path-like object or string

  • identifier (str) – The bundle identifier. If None, is set to ‘org.molssi.seamm.<name>’.

  • name (str) – The name of the app

  • version (str = "0.1.0") – The version of the app.

  • user_only (bool = False) – Whether to install for just the current user. Defaults to all users.

  • icons (pathlib.Path or string) – Optional path to the icns file to use.

  • copyright (str) – The human-readable copyright. Defaults to “Copyright 2017-xxxx MolSSI”

seamm_installer.mac.delete_app(name, missing_ok=False)[source]

Delete the app given.

Parameters:
  • name (str) – The name of the app.

  • missing_ok (bool = False) – Don’t throw an error if the app does not exist.

seamm_installer.mac.get_apps()[source]
seamm_installer.mac.update_app(name, version, missing_ok=False)[source]

Update the version for a Mac app.

Parameters:
  • name (str) – The name of the app

  • version (str) – The version of the app.

  • missing_ok (bool = False) – Don’t throw an error if the app does not exist.

seamm_installer.metadata module

Metadata about packages, etc.

seamm_installer.my module

Global module for passing around objects and constants.

seamm_installer.pip module

class seamm_installer.pip.Pip[source]

Bases: object

Class for handling pip

install(package)[source]

Install the requested package.

Parameters:

package (str) – The package of interest.

list(outdated=False, uptodate=False)[source]

List the installed packages.

Parameters:
  • outdated (bool) – If true, list only the outdated packages. Cannot be used with uptodate.

  • uptodate (bool) – If true, list only the up-to-date packages. Cannot be used with outdated.

search(query=None, framework=None, exact=False, progress=False, newline=True, update=None)[source]

Search PyPi for packages.

Parameters:
  • query (str) – The text of the query, if any.

  • framework (str) – The framework classifier, if any.

  • exact (bool = False) – Whether to only return the exact match, defaults to False.

  • progress (bool = False) – Whether to show progress dots.

  • newline (bool = True) – Whether to print a newline at the end if showing progress

  • update (None or method) – Method to call to e.g. update a progress bar

Returns:

A list of packages matching the query.

Return type:

[str]

show(package)[source]

Return the information for an installed package.

Parameters:

package (str) – The package of interest.

uninstall(package)[source]

Remove the requested package.

Parameters:

package (str) – The package of interest.

update(package)[source]

Update the requested package.

Parameters:

package (str) – The package of interest.

seamm_installer.services module

Handle the services (daemons) for SEAMM.

seamm_installer.services.create()[source]
seamm_installer.services.delete()[source]
seamm_installer.services.restart()[source]
seamm_installer.services.setup(parser)[source]

Define the command-line interface for handling services.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.services.show()[source]
seamm_installer.services.start()[source]
seamm_installer.services.status()[source]
seamm_installer.services.stop()[source]

seamm_installer.show module

Show the status of the SEAMM installation.

seamm_installer.show.setup(parser)[source]

Define the command-line interface for installing SEAMM components.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.show.show()[source]

seamm_installer.uninstall module

Uninstall requested components of SEAMM.

seamm_installer.uninstall.setup(parser)[source]

Define the command-line interface for removing SEAMM components.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.uninstall.uninstall()[source]

Uninstall the requested SEAMM components and plug-ins.

seamm_installer.uninstall.uninstall_packages(to_uninstall)[source]

Uninstall SEAMM components and plug-ins.

seamm_installer.update module

Update requested components of SEAMM.

seamm_installer.update.setup(parser)[source]

Define the command-line interface for updating SEAMM components.

Parameters:

parser (argparse.ArgumentParser) – The main parser for the application.

seamm_installer.update.update()[source]

Update the requested SEAMM components and plug-ins.

seamm_installer.update.update_development_environment()[source]

Update packages needed for development.

seamm_installer.update.update_packages(to_update)[source]

Update SEAMM components and plug-ins.

seamm_installer.util module

Utility methods for the SEAMM installer.

class seamm_installer.util.JSONDecoder[source]

Bases: JSONDecoder

Class for handling the package versions in JSON.

dict_to_object(d)[source]
class seamm_installer.util.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

Class for handling the package versions in JSON.

default(obj)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
seamm_installer.util.find_packages(progress=True, update=None, update_cache=False, cache_valid=1)[source]

Find the Python packages in SEAMM.

Parameters:
  • progress (bool = True) – Whether to print out dots to show progress.

  • update_cache (bool = False) – Update the cache (package db) no matter what.

  • cache_valid (int = 1) – How many days before updating the cache. Defaults to a week.

Returns:

A dictionary with information about the packages.

Return type:

dict(str, str)

seamm_installer.util.get_metadata()[source]

Get the metadata for this installation.

Returns:

{str – A dictionary of the metadata.

Return type:

any}

seamm_installer.util.initialize()[source]
seamm_installer.util.package_info(package, conda_only=False)[source]

Return info on a package

Parameters:

package – The name of the package.

Returns:

The version and channel (pip or conda) for the current installation.

Return type:

(str, str)

seamm_installer.util.run_plugin_installer(package, *args, verbose=True)[source]

Run the plug-in installer with given arguments.

Parameters:
  • package – The package name for the plug-in. Usually xxxx-step.

  • args – Command-line arguments for the plugin installer.

Returns:

The result structure from subprocess.run, or None if there is no installer.

Return type:

xxxx

seamm_installer.util.set_metadata(metadata)[source]

Set the metadata for this installation.

Parameters:

{str (any}) – A dictionary of the metadata.

Module contents

seamm_installer The installer/updater for SEAMM.