diff --git a/artiq/coredevice/__init__.py b/artiq/coredevice/__init__.py index e69de29bb..7f0bf3d38 100644 --- a/artiq/coredevice/__init__.py +++ b/artiq/coredevice/__init__.py @@ -0,0 +1,10 @@ +from artiq.coredevice import exceptions, dds +from artiq.coredevice.exceptions import (RTIOUnderflow, RTIOSequenceError, + RTIOCollisionError) +from artiq.coredevice.dds import (PHASE_MODE_CONTINUOUS, PHASE_MODE_ABSOLUTE, + PHASE_MODE_TRACKING) + +__all__ = [] +__all__ += ["RTIOUnderflow", "RTIOSequenceError", "RTIOCollisionError"] +__all__ += ["PHASE_MODE_CONTINUOUS", "PHASE_MODE_ABSOLUTE", + "PHASE_MODE_TRACKING"] diff --git a/artiq/experiment.py b/artiq/experiment.py new file mode 100644 index 000000000..30138c6e3 --- /dev/null +++ b/artiq/experiment.py @@ -0,0 +1,7 @@ +from artiq import language, coredevice +from artiq.language import * +from artiq.coredevice import * + +__all__ = [] +__all__.extend(language.__all__) +__all__.extend(coredevice.__all__) diff --git a/artiq/language/__init__.py b/artiq/language/__init__.py index e3d9df9e0..e5433d3b0 100644 --- a/artiq/language/__init__.py +++ b/artiq/language/__init__.py @@ -5,14 +5,9 @@ from artiq.language.environment import * from artiq.language.units import * from artiq.language.scan import * -from artiq.coredevice.dds import (PHASE_MODE_CONTINUOUS, PHASE_MODE_ABSOLUTE, - PHASE_MODE_TRACKING) - __all__ = [] __all__.extend(core.__all__) __all__.extend(types.__all__) __all__.extend(environment.__all__) __all__.extend(units.__all__) __all__.extend(scan.__all__) -__all__ += ["PHASE_MODE_CONTINUOUS", "PHASE_MODE_ABSOLUTE", - "PHASE_MODE_TRACKING"] diff --git a/artiq/language/core.py b/artiq/language/core.py index a374562a9..10eb3dcef 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -6,9 +6,6 @@ import os, linecache, re from collections import namedtuple from functools import wraps -# for runtime files in backtraces -from artiq.coredevice.runtime import source_loader - __all__ = ["host_int", "int", "host_round", "round", "kernel", "portable", "syscall", "host_only", @@ -390,6 +387,8 @@ class ARTIQException: self.traceback = list(traceback) def __str__(self): + # lazy import this + from artiq.coredevice.runtime import source_loader lines = [] lines.append("Core Device Traceback (most recent call last):") for (filename, line, column, function, address) in self.traceback: diff --git a/artiq/test/coredevice/analyzer.py b/artiq/test/coredevice/analyzer.py index fc0650fbe..b607ecc36 100644 --- a/artiq/test/coredevice/analyzer.py +++ b/artiq/test/coredevice/analyzer.py @@ -1,4 +1,4 @@ -from artiq.language import * +from artiq.experiment import * from artiq.coredevice.analyzer import decode_dump, OutputMessage, InputMessage from artiq.test.hardware_testbench import ExperimentCase diff --git a/artiq/test/coredevice/cache.py b/artiq/test/coredevice/cache.py index 68033b142..a81950e00 100644 --- a/artiq/test/coredevice/cache.py +++ b/artiq/test/coredevice/cache.py @@ -1,5 +1,4 @@ -from artiq.language import * -from artiq.coredevice.exceptions import * +from artiq.experiment import * from artiq.test.hardware_testbench import ExperimentCase diff --git a/artiq/test/coredevice/embedding.py b/artiq/test/coredevice/embedding.py index 190ec23b9..5debdb2cf 100644 --- a/artiq/test/coredevice/embedding.py +++ b/artiq/test/coredevice/embedding.py @@ -1,4 +1,4 @@ -from artiq.language import * +from artiq.experiment import * from artiq.test.hardware_testbench import ExperimentCase diff --git a/artiq/test/coredevice/portability.py b/artiq/test/coredevice/portability.py index 752ded674..c1bce293b 100644 --- a/artiq/test/coredevice/portability.py +++ b/artiq/test/coredevice/portability.py @@ -1,7 +1,7 @@ from operator import itemgetter from fractions import Fraction -from artiq.language import * +from artiq.experiment import * from artiq.sim import devices as sim_devices from artiq.test.hardware_testbench import ExperimentCase diff --git a/artiq/test/coredevice/rtio.py b/artiq/test/coredevice/rtio.py index 60e059c17..b99a2ecb0 100644 --- a/artiq/test/coredevice/rtio.py +++ b/artiq/test/coredevice/rtio.py @@ -3,10 +3,8 @@ from math import sqrt -from artiq.language import * +from artiq.experiment import * from artiq.test.hardware_testbench import ExperimentCase -from artiq.coredevice.exceptions import (RTIOUnderflow, RTIOSequenceError, - RTIOCollisionError) class RTT(EnvExperiment): diff --git a/artiq/test/hardware_testbench.py b/artiq/test/hardware_testbench.py index 65d35d2e8..aa6c9d39e 100644 --- a/artiq/test/hardware_testbench.py +++ b/artiq/test/hardware_testbench.py @@ -6,7 +6,7 @@ import sys import unittest import logging -from artiq.language import * +from artiq.experiment import * from artiq.master.databases import DeviceDB, DatasetDB from artiq.master.worker_db import DeviceManager, DatasetManager from artiq.coredevice.core import CompileError diff --git a/artiq/test/scheduler.py b/artiq/test/scheduler.py index 75522ad21..4c0f8fa5e 100644 --- a/artiq/test/scheduler.py +++ b/artiq/test/scheduler.py @@ -5,7 +5,7 @@ import sys import os from time import time, sleep -from artiq.language import * +from artiq.experiment import * from artiq.master.scheduler import Scheduler diff --git a/artiq/test/worker.py b/artiq/test/worker.py index 8a02907c0..94c7d8897 100644 --- a/artiq/test/worker.py +++ b/artiq/test/worker.py @@ -5,7 +5,7 @@ import sys import os from time import sleep -from artiq.language import * +from artiq.experiment import * from artiq.master.worker import * diff --git a/doc/manual/core_language_reference.rst b/doc/manual/core_language_reference.rst index 66fe50411..8982f9231 100644 --- a/doc/manual/core_language_reference.rst +++ b/doc/manual/core_language_reference.rst @@ -1,7 +1,7 @@ Core language reference ======================= -The most commonly used features from those modules can be imported with ``from artiq.language import *``. +The most commonly used features from the ARTIQ language modules and from the core device modules are bundled together in ``artiq.experiment`` and can be imported with ``from artiq.experiment import *``. :mod:`artiq.language.core` module --------------------------------- diff --git a/doc/manual/getting_started_core.rst b/doc/manual/getting_started_core.rst index 85e7d2e24..aefc29a5b 100644 --- a/doc/manual/getting_started_core.rst +++ b/doc/manual/getting_started_core.rst @@ -8,7 +8,7 @@ Connecting to the core device As a very first step, we will turn on a LED on the core device. Create a file ``led.py`` containing the following: :: - from artiq.language import * + from artiq.experiment import * class LED(EnvExperiment): @@ -93,7 +93,7 @@ The point of running code on the core device is the ability to meet demanding re Create a new file ``rtio.py`` containing the following: :: - from artiq.language import * + from artiq.experiment import * class Tutorial(EnvExperiment): diff --git a/doc/manual/getting_started_mgmt.rst b/doc/manual/getting_started_mgmt.rst index 41d5305bf..bf31c0e6f 100644 --- a/doc/manual/getting_started_mgmt.rst +++ b/doc/manual/getting_started_mgmt.rst @@ -16,7 +16,7 @@ Then create a ``~/artiq-master/repository`` sub-folder to contain experiments. T Create a very simple experiment in ``~/artiq-master/repository`` and save it as ``mgmt_tutorial.py``: :: - from artiq.language import * + from artiq.experiment import * class MgmtTutorial(EnvExperiment):