Skip to content

Commit

Permalink
Splitting pulser into pulser-core and pulser-simulation. (#362)
Browse files Browse the repository at this point in the history
* Moving unit tests out of `pulser`

* Moving pulser.simulation files to pulser_simulation

* Setting up `pulser_simulation` as  a separate package

* Moving all contents of `pulser` to `pulser-core`

* Setting up 'pulser', 'pulser-core' and 'pulser-simulation'

* Updating the docs
  • Loading branch information
HGSilveri authored Apr 13, 2022
1 parent 4f684f3 commit b23ff22
Show file tree
Hide file tree
Showing 96 changed files with 758 additions and 64 deletions.
10 changes: 9 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ exclude_lines =
# Don't test pass statements
pass

omit = pulser/tests/*
omit =
tests/*
setup.py


show_missing = True

[run]
source =
pulser-core/pulser/
pulser-simulation/pulser_simulation/
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ per-file-ignores =
# D100 Missing docstring in public module
# D103 Missing docstring in public function
# F401 Module imported but unused
pulser/tests/*: D100, D103
tests/*: D100, D103
__init__.py: F401
setup.py: D100
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation
pip install -r requirements.txt
- name: Lint with flake8
run: flake8
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation
pip install -r requirements.txt
- name: Check import sorting with isort
run: isort --check-only --diff .
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation
pip install -r requirements.txt
- name: Type check with mypy
run: mypy
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation
pip install -r requirements.txt
- name: Run the unit tests & generate coverage report
run: pytest --cov --cov-fail-under=100 pulser
run: pytest --cov --cov-fail-under=100
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ docs/build/
dist/
env*
pulser.egg-info/
pulser_simulation.egg-info/
pulser_core.egg-info/
4 changes: 2 additions & 2 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
files = pulser
files = pulser-core/pulser, pulser-simulation/pulser_simulation, tests
python_version = 3.8
warn_return_any = True
warn_redundant_casts = True
Expand All @@ -11,5 +11,5 @@ disallow_untyped_defs = True
follow_imports = silent
ignore_missing_imports = true

[mypy-pulser.tests.*]
[mypy-tests.*]
disallow_untyped_defs = False
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
- method: setuptools
path: .
- requirements: pulser-core/rtd_requirements.txt
- requirements: pulser-simulation/rtd_requirements.txt
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.md
include requirements.txt
include LICENSE
include pulser/devices/interaction_coefficients/C6_coeffs.json
include VERSION
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and also allows the creation of **analog** quantum simulations, outside of the
scope of traditional quantum circuit approaches. Whatever the type of experiment
or paradigm, if it can be done on the device, it can be done with Pulser.

Additionally, Pulser features built-in tools for classical simulation (using [QuTiP][qutip] libraries) to aid in the development and testing of new pulse sequences.
Additionally, the ``pulser_simulation`` extension provides tools for classical simulation (using [QuTiP][qutip] libraries) to aid in the development and testing of new pulse sequences.

For a comprehensive overview of Pulser, check out [Pulser's arXiv preprint](https://arxiv.org/abs/2104.15044).

Expand All @@ -27,11 +27,21 @@ To install the latest release of ``pulser``, have Python 3.7.0 or higher install
pip install pulser
```

The standard ``pulser`` distribution will install the core ``pulser`` package
and the ``pulser_simulation`` extension package, which is required if you want
to access the emulation features.

If you wish to install only the core ``pulser`` features, you can instead run:

```bash
pip install pulser-core
```

If you wish to **install the development version of Pulser from source** instead, do the following from within this repository after cloning it:

```bash
git checkout develop
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation
```

Bear in mind that this installation will track the contents of your local
Expand All @@ -49,7 +59,7 @@ pip install -r requirements.txt
Then, you can do the following to run the test suite and report test coverage:

```bash
pytest --cov pulser
pytest --cov
```

## Contributing
Expand Down
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5.1.dev
11 changes: 7 additions & 4 deletions docs/source/apidoc/emulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
Classical Simulation
*********************

Since version 0.6.0, all simulation classes (previously under the ``pulser.simulation`` module)
are in the ``pulser-simulation`` extension and should be imported from ``pulser_simulation``.

Simulation
----------------------

.. automodule:: pulser.simulation.simulation
.. automodule:: pulser_simulation.simulation
:members:

SimConfig
----------------------

.. automodule:: pulser.simulation.simconfig
.. automodule:: pulser_simulation.simconfig
:members:

Simulation Results
Expand All @@ -29,14 +32,14 @@ within them.
CoherentResults
^^^^^^^^^^^^^^^^

.. autoclass:: pulser.simulation.simresults.CoherentResults
.. autoclass:: pulser_simulation.simresults.CoherentResults
:members:
:inherited-members:


NoisyResults
^^^^^^^^^^^^^^^^

.. autoclass:: pulser.simulation.simresults.NoisyResults
.. autoclass:: pulser_simulation.simresults.NoisyResults
:members:
:inherited-members:
8 changes: 4 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import os
import sys

sys.path.insert(0, os.path.abspath("../../pulser"))
sys.path.insert(0, os.path.abspath("../../"))

__version__ = ""
exec(open("../../pulser/_version.py").read())
with open("../../VERSION.txt", "r") as f:
__version__ = f.read().strip()

# -- Project information -----------------------------------------------------

project = "Pulser"
copyright = "2020, Pulser Development Team"
copyright = "2022, Pulser Development Team"
author = "Pulser Development Team"

# The full version, including alpha/beta/rc tags
Expand Down
10 changes: 9 additions & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ installed, then use ``pip``: ::

pip install pulser

The standard ``pulser`` distribution will install the core ``pulser`` package
and the ``pulser_simulation`` extension package, which is required if you want
to access the :doc:`apidoc/emulation` features.

If you wish to install only the core ``pulser`` features, you can instead run: ::

pip install pulser-core


Latest version
---------------
Expand All @@ -18,7 +26,7 @@ the ``develop`` branch - which holds the latest (unstable) version of Pulser -
and install from source by running: ::

git checkout develop
pip install -e .
pip install -e ./pulser-core -e ./pulser-simulation

Bear in mind that your installation will track the contents of your local
Pulser repository folder, so if you checkout a different branch (e.g. ``master``),
Expand Down
2 changes: 1 addition & 1 deletion docs/source/intro_rydberg_blockade.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
],
"source": [
"import matplotlib.pyplot as plt\n",
"from pulser.simulation import Simulation\n",
"from pulser_simulation import Simulation\n",
"\n",
"data = []\n",
"distances = np.linspace(6.5, 14, 7)\n",
Expand Down
Loading

0 comments on commit b23ff22

Please sign in to comment.