Skip to content

Commit

Permalink
Speed up pyarts startup when all you need is XYZ
Browse files Browse the repository at this point in the history
  • Loading branch information
riclarsson committed Jan 14, 2025
1 parent b8e91c5 commit ff8c427
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions python/src/pyarts/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# -*- coding: utf-8 -*-
"""This module contains functions to interact with ARTS."""

from pyarts import xml # noqa
from pyarts import arts # noqa
from pyarts import data # noqa
from pyarts import plots # noqa
from pyarts import workspace # noqa
from pyarts import hitran # noqa
from pyarts import fields # noqa
from pyarts import recipe # noqa
from pyarts.workspace import Workspace, arts_agenda # noqa
from pyarts.workspace.callback import callback_operator # noqa

def __getattr__(attr):
if attr == "xml":
import pyarts.xml as xml
return xml
elif attr == "data":
import pyarts.data as data
return data
elif attr == "plots":
import pyarts.plots as plots
return plots
elif attr == "workspace":
import pyarts.workspace as workspace
return workspace
elif attr == "hitran":
import pyarts.hitran as hitran
return hitran
elif attr == "fields":
import pyarts.fields as fields
return fields
elif attr == "recipe":
import pyarts.recipe as recipe
return recipe

raise AttributeError("module {!r} has no attribute "
"{!r}".format(__name__, attr))

__all__ = [s for s in dir() if not s.startswith("_")]
__version__ = "@ARTS_VERSION@"
version = __version__

0 comments on commit ff8c427

Please sign in to comment.