biosimulators_utils.licensing package — BioSimulators utils 0.1.154 documentation

# biosimulators_utils.licensing package

## Submodules

## biosimulators_utils.licensing.core module

Tool for managing licenses through environment variables

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2021-09-1

Copyright

  2021, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.licensing.core.LicenseManager

  Bases: `contextlib.AbstractContextManager`

  Base singleton class for managing setting up licenses for software packages from environment variables

  abstract property ENV_VAR_PREFIX

    classmethod(function) -> method

    Convert a function to be a class method.

    A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

    > class C:

    >   @classmethod def f(cls, arg1, arg2, …):

    >   > …

    It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

    Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

  __enter__()

    Enter a context

  __exit__(exc_type, exc_value, traceback)

    Exit a context

    Parameters

      - exc_type –

      - exc_value –

      - traceback –

  abstract end()

    Terminate usage of the software package with license keys

  get_keys_from_env_vars()

    Get the license keys for the software package from environment variables

    Returns

      environment license variables for a software package

    Return type

      `dict`

  abstract is_package_available()

    Determine whether the package is installed and available

    Returns

      whether the package is installed and available

    Return type

      `bool`

  abstract start()

    Initialize the usage of the software package with license keys

## biosimulators_utils.licensing.gurobi module

Tool for managing Gurobi licenses through environment variables

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2021-09-1

Copyright

  2021, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.licensing.gurobi.GurobiLicenseManager

  Bases: `biosimulators_utils.licensing.core.LicenseManager`

  Gurobi license manager

  ENV_VAR_PREFIX = 'GRB'
  end()

    Terminate usage of the software package with license keys

  get_keys_from_env_vars()

    Get the license keys for the software package from environment variables

    Returns

      environment license variables for a software package

    Return type

      `dict`

  is_package_available()

    Determine whether the package is installed

    Returns

      whether the package is installed

    Return type

      `bool`

  save_keys_to_license_file(filename='/home/runner/gurobi.lic')

    Save license keys to a file

    Parameters

      filename (`str`) – path to save license

  start()

    Initialize usage of the software package with license keys