Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly define public symbols for all modules #630

Merged
merged 7 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions pulser-core/pulser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,58 @@

"""A pulse-level composer for neutral-atom quantum devices."""

from pulser._version import __version__
from pulser._version import __version__ as __version__
from pulser.waveforms import (
CompositeWaveform,
CustomWaveform,
ConstantWaveform,
RampWaveform,
BlackmanWaveform,
InterpolatedWaveform,
KaiserWaveform,
)
from pulser.pulse import Pulse
from pulser.register import Register, Register3D
from pulser.devices import AnalogDevice, DigitalAnalogDevice, MockDevice
from pulser.sequence import Sequence
from pulser.backend import (
EmulatorConfig,
NoiseModel,
QPUBackend,
)

from pulser.backend import QPUBackend # isort: skip
# Exposing relevant submodules
from pulser import (
waveforms as waveforms,
channels as channels,
register as register,
devices as devices,
sampler as sampler,
backend as backend,
)

__all__ = [
# pulser.waveforms
"CompositeWaveform",
"CustomWaveform",
"ConstantWaveform",
"RampWaveform",
"BlackmanWaveform",
"InterpolatedWaveform",
"KaiserWaveform",
# pulser.pulse
"Pulse",
# pulser.register
"Register",
"Register3D",
# pulser.devices
"AnalogDevice",
"DigitalAnalogDevice",
"MockDevice",
# pulser.sequence
"Sequence",
# pulser.backends
"EmulatorConfig",
"NoiseModel",
"QPUBackend",
]
2 changes: 2 additions & 0 deletions pulser-core/pulser/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
from pulser.backend.config import EmulatorConfig
from pulser.backend.noise_model import NoiseModel
from pulser.backend.qpu import QPUBackend

__all__ = ["EmulatorConfig", "NoiseModel", "QPUBackend"]
2 changes: 2 additions & 0 deletions pulser-core/pulser/channels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

from pulser.channels.channels import Microwave, Raman, Rydberg
from pulser.channels.dmm import DMM

__all__ = ["Microwave", "Raman", "Rydberg", "DMM"]
10 changes: 10 additions & 0 deletions pulser-core/pulser/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@
AnalogDevice,
DigitalAnalogDevice,
)

__all__ = [
"Device",
"VirtualDevice",
"AnalogDevice",
"DigitalAnalogDevice",
"MockDevice",
"Chadoq2",
"IroiseMVP",
]
2 changes: 2 additions & 0 deletions pulser-core/pulser/parametrized/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
from pulser.parametrized.paramabc import Parametrized
from pulser.parametrized.paramobj import ParamObj
from pulser.parametrized.variable import Variable

__all__ = ["Parametrized", "ParamObj", "Variable"]
2 changes: 2 additions & 0 deletions pulser-core/pulser/pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
if TYPE_CHECKING:
from pulser.channels.base_channel import Channel

__all__ = ["Pulse"]


@dataclass(init=False, repr=False, frozen=True)
class Pulse:
Expand Down
14 changes: 14 additions & 0 deletions pulser-core/pulser/register/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@
from pulser.register.base_register import QubitId
from pulser.register.register import Register
from pulser.register.register3d import Register3D
from pulser.register.register_layout import RegisterLayout
from pulser.register.special_layouts import (
SquareLatticeLayout,
TriangularLatticeLayout,
)

__all__ = [
"QubitId",
"Register",
"Register3D",
"RegisterLayout",
"SquareLatticeLayout",
"TriangularLatticeLayout",
]
2 changes: 2 additions & 0 deletions pulser-core/pulser/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

from pulser.register import QubitId

__all__ = ["Result", "SampledResult", "Results", "ResultType"]


@dataclass
class Result(ABC):
Expand Down
2 changes: 1 addition & 1 deletion pulser-core/pulser/sampler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
The samples of a sequence are organized in channels and are used for
plotting and simulation.
"""
from pulser.sampler.sampler import sample
from pulser.sampler.sampler import sample as sample
2 changes: 1 addition & 1 deletion pulser-core/pulser/sequence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
"""Module containing the sequence class definition."""

from pulser.sequence.sequence import Sequence
from pulser.sequence.sequence import Sequence as Sequence
11 changes: 11 additions & 0 deletions pulser-core/pulser/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
if TYPE_CHECKING:
from pulser.channels.base_channel import Channel

__all__ = [
"Waveform",
"CompositeWaveform",
"CustomWaveform",
"ConstantWaveform",
"RampWaveform",
"BlackmanWaveform",
"InterpolatedWaveform",
"KaiserWaveform",
]


class Waveform(ABC):
"""The abstract class for a pulse's waveform."""
Expand Down
4 changes: 3 additions & 1 deletion pulser-pasqal/pulser_pasqal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

from pasqal_cloud import BaseConfig, EmulatorType, Endpoints

from pulser_pasqal._version import __version__
from pulser_pasqal._version import __version__ as __version__
from pulser_pasqal.backends import EmuFreeBackend, EmuTNBackend
from pulser_pasqal.pasqal_cloud import PasqalCloud

__all__ = ["EmuFreeBackend", "EmuTNBackend", "PasqalCloud"]
12 changes: 11 additions & 1 deletion pulser-simulation/pulser_simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
# limitations under the License.
"""Classes for classical emulation of a Sequence."""

from pulser_simulation._version import __version__
from pulser.backend import EmulatorConfig, NoiseModel

from pulser_simulation._version import __version__ as __version__
from pulser_simulation.qutip_backend import QutipBackend
from pulser_simulation.simconfig import SimConfig
from pulser_simulation.simulation import QutipEmulator, Simulation

__all__ = [
"EmulatorConfig",
"NoiseModel",
"QutipBackend",
"QutipEmulator",
"SimConfig",
]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ line-length = 79
[tool.isort]
profile = "black"
line_length = 79
skip = "__venv__"
skip = ["__venv__", "__init__.py"]
src_paths = ["pulser-core", "pulser-simulation", "pulser-pasqal"]

[tool.pytest.ini_options]
Expand Down