lsst.base  13.0-13-g79b6bfd+1
LSST Data Management Base Package
Classes | Functions | Variables
lsst.base.packages Namespace Reference

Classes

class  Packages
 

Functions

def getVersionFromPythonModule (module)
 
def getPythonPackages ()
 
def getEnvironmentPackages ()
 

Variables

 BUILDTIME = set(["boost", "eigen", "tmv"])
 
 PYTHON = set(["galsim"])
 
 ENVIRONMENT = set(["astrometry_net", "astrometry_net_data", "minuit2", "xpa"])
 

Detailed Description

Determine which packages are being used in the system and their versions

There are a few different types of packages, and their versions are collected in different ways:
1. Run-time libraries (e.g., cfitsio, fftw): we get their version from interrogating the dynamic library
2. Python modules (e.g., afw, numpy; galsim is also in this group even though we only use it through the
   library, because no version information is currently provided through the library): we get their version
   from the __version__ module variable. Note that this means that we're only aware of modules that have
   already been imported.
3. Other packages provide no run-time accessible version information (e.g., astrometry_net): we get their
   version from interrogating the environment. Currently, that means EUPS; if EUPS is replaced or dropped then
   we'll need to consider an alternative means of getting this version information.
4. Local versions of packages (a non-installed EUPS package, selected with "setup -r /path/to/package"): we
   identify these through the environment (EUPS again) and use as a version the path supplemented with the
   git SHA and, if the git repo isn't clean, an MD5 of the diff.

These package versions are collected and stored in a Packages object, which provides useful comparison and
persistence features.

Example usage:

    from lsst.base import Packages
    pkgs = Packages.fromSystem()
    print "Current packages:", pkgs
    old = Packages.read("/path/to/packages.pickle")
    print "Old packages:", old
    print "Missing packages compared to before:", pkgs.missing(old)
    print "Extra packages compared to before:", pkgs.extra(old)
    print "Different packages: ", pkgs.difference(old)
    old.update(pkgs)  # Include any new packages in the old
    old.write("/path/to/packages.pickle")

Function Documentation

◆ getEnvironmentPackages()

def lsst.base.packages.getEnvironmentPackages ( )
Provide a dict of products and their versions from the environment

We use EUPS to determine the version of certain products (those that don't provide
a means to determine the version any other way) and to check if uninstalled packages
are being used. We only report the product/version for these packages.

Definition at line 133 of file packages.py.

◆ getPythonPackages()

def lsst.base.packages.getPythonPackages ( )
Return a dict of imported python packages and their versions

We wade through sys.modules and attempt to determine the version for each
module.  Note, therefore, that we can only report on modules that have
*already* been imported.

We don't include any module for which we cannot determine a version.

Definition at line 83 of file packages.py.

◆ getVersionFromPythonModule()

def lsst.base.packages.getVersionFromPythonModule (   module)
Determine the version of a python module

Will raise AttributeError if the __version__ attribute is not set.

We supplement the version with information from the __dependency_versions__
(a specific variable set by LSST's sconsUtils at build time) only for packages
that are typically used only at build-time.

Definition at line 63 of file packages.py.

Variable Documentation

◆ BUILDTIME

lsst.base.packages.BUILDTIME = set(["boost", "eigen", "tmv"])

Definition at line 52 of file packages.py.

◆ ENVIRONMENT

lsst.base.packages.ENVIRONMENT = set(["astrometry_net", "astrometry_net_data", "minuit2", "xpa"])

Definition at line 60 of file packages.py.

◆ PYTHON

lsst.base.packages.PYTHON = set(["galsim"])

Definition at line 56 of file packages.py.