contrib Packages#

Law contains a collection of so-called contrib packages that can be loaded manually when needed instead of being automatically loaded on each import law call.

The following example shows how a package (e.g. the docker package for working with containers) is loaded via load().

import law

law.contrib.load("docker")
law.docker.DockerSandbox(...)

# the following is similar but does not add the law.docker shorthand
import law.contrib.docker
law.contrib.docker.DockerSandbox(...)
available_packages = ['numpy', 'dropbox', 'git', 'glite', 'pyarrow', 'keras', 'singularity', 'coffea', 'ipython', 'lsf', 'root', 'wlcg', 'gfal', 'htcondor', 'tensorflow', 'telegram', 'slurm', 'hdf5', 'docker', 'tasks', 'mercurial', 'matplotlib', 'awkward', 'rich', 'cms', 'profiling', 'arc', 'slack']#

List of names of available contrib packages.

loaded_packages = {'arc': <module 'law.contrib.arc' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/arc/__init__.py'>, 'awkward': <module 'law.contrib.awkward' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/awkward/__init__.py'>, 'cms': <module 'law.contrib.cms' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/cms/__init__.py'>, 'coffea': <module 'law.contrib.coffea' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/coffea/__init__.py'>, 'docker': <module 'law.contrib.docker' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/docker/__init__.py'>, 'dropbox': <module 'law.contrib.dropbox' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/dropbox/__init__.py'>, 'gfal': <module 'law.contrib.gfal' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/gfal/__init__.py'>, 'git': <module 'law.contrib.git' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/git/__init__.py'>, 'glite': <module 'law.contrib.glite' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/glite/__init__.py'>, 'hdf5': <module 'law.contrib.hdf5' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/hdf5/__init__.py'>, 'htcondor': <module 'law.contrib.htcondor' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/htcondor/__init__.py'>, 'ipython': <module 'law.contrib.ipython' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/ipython/__init__.py'>, 'keras': <module 'law.contrib.keras' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/keras/__init__.py'>, 'lsf': <module 'law.contrib.lsf' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/lsf/__init__.py'>, 'matplotlib': <module 'law.contrib.matplotlib' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/matplotlib/__init__.py'>, 'mercurial': <module 'law.contrib.mercurial' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/mercurial/__init__.py'>, 'numpy': <module 'law.contrib.numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/numpy/__init__.py'>, 'profiling': <module 'law.contrib.profiling' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/profiling/__init__.py'>, 'pyarrow': <module 'law.contrib.pyarrow' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/pyarrow/__init__.py'>, 'rich': <module 'law.contrib.rich' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/rich/__init__.py'>, 'root': <module 'law.contrib.root' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/root/__init__.py'>, 'singularity': <module 'law.contrib.singularity' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/singularity/__init__.py'>, 'slack': <module 'law.contrib.slack' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/slack/__init__.py'>, 'slurm': <module 'law.contrib.slurm' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/slurm/__init__.py'>, 'tasks': <module 'law.contrib.tasks' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/tasks/__init__.py'>, 'telegram': <module 'law.contrib.telegram' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/telegram/__init__.py'>, 'tensorflow': <module 'law.contrib.tensorflow' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/tensorflow/__init__.py'>, 'wlcg': <module 'law.contrib.wlcg' from '/home/docs/checkouts/readthedocs.org/user_builds/law/checkouts/latest/law/contrib/wlcg/__init__.py'>}#

Dictionary of names to modules of already loaded contrib packages.

load(*packages)[source]#

Loads contrib packages and adds them to the law namespace. Example:

import law
law.contrib.load("docker")

law.docker.DockerSandbox(...)

It is ensured that packages are loaded only once.

load_all()[source]#

Loads all available contrib packages via load(). A package is skipped when an ImportError was raised. The list of names of loaded packages is returned.

Available pacakges: