Packages¶
- class lsst.base.Packages(packages)¶
- Bases: - object- A table of packages and their versions. - There are a few different types of packages, and their versions are collected in different ways: - Run-time libraries (e.g., cfitsio, fftw): we get their version from interrogating the dynamic library 
- 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.
- 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. 
- 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- gitSHA 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") - Notes - This is essentially a wrapper around a dict with some conveniences. - Attributes Summary - Methods Summary - difference(other)- Get packages in symmetric difference of self and another - Packagesobject.- extra(other)- Get packages in self but not in another - Packagesobject.- fromBytes(data, format)- Construct the object from a byte representation. - Construct a - Packagesby examining the system.- missing(other)- Get packages in another - Packagesobject but missing from self.- read(filename)- Read packages from filename. - toBytes(format)- Convert the object to a serialized bytes form using the specified format. - update(other)- Update packages with contents of another set of packages. - write(filename)- Write to file. - Attributes Documentation - formats = {'.pickle': 'pickle', '.pkl': 'pickle', '.yaml': 'yaml'}¶
 - Methods Documentation - classmethod fromBytes(data, format)¶
- Construct the object from a byte representation. 
 - classmethod fromSystem()¶
- Construct a - Packagesby examining the system.- Determine packages by examining python’s - sys.modules, runtime libraries and EUPS.- Returns:
- packagesPackages
 
- packages
 
 - classmethod read(filename)¶
- Read packages from filename. 
 - toBytes(format)¶
- Convert the object to a serialized bytes form using the specified format.