Skip to content

Commit

Permalink
Merging v0.7.2 hotfix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri committed Nov 22, 2022
2 parents bc9d9f0 + 541a985 commit 890b3ff
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Pulser from PyPI
timeout-minutes: 5
shell: bash
run: |
python -m pip install --upgrade pip
pip install pulser
version="$(head -1 VERSION.txt)"
until pip install pulser==$version
do
echo "Failed to install from PyPI, will wait for upload and retry."
sleep 30
done
- name: Test the installation
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8dev2
0.8dev3
1 change: 1 addition & 0 deletions pulser-core/pulser/json/supported.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"KaiserWaveform",
),
"pulser.sequence.sequence": ("Sequence",),
"pulser.sequence": ("Sequence",),
"pulser.parametrized.variable": ("Variable",),
"pulser.parametrized.paramobj": ("ParamObj",),
}
Expand Down
7 changes: 6 additions & 1 deletion pulser-core/pulser/sequence/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,12 @@ def _phase_shift(
self._basis_ref[basis][qubit].increment_phase(phi)

def _to_dict(self) -> dict[str, Any]:
d = obj_to_dict(self, *self._calls[0].args, **self._calls[0].kwargs)
d = obj_to_dict(
self,
*self._calls[0].args,
_module="pulser.sequence",
**self._calls[0].kwargs,
)
d["__version__"] = pulser.__version__
d["calls"] = self._calls[1:]
d["vars"] = self._variables
Expand Down
18 changes: 18 additions & 0 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,21 @@ def test_support():
match="No serialization support for 'pulser.waveforms.from_max_val'",
):
validate_serialization(wf_obj_dict)


def test_sequence_module():
# Check that the sequence module is backwards compatible after refactoring
seq = Sequence(Register.square(2), Chadoq2)

obj_dict = json.loads(seq.serialize())
assert obj_dict["__module__"] == "pulser.sequence"

# Defensively check that the standard format runs
Sequence.deserialize(seq.serialize())

# Use module being used in v0.7.0-0.7.2.0
obj_dict["__module__"] == "pulser.sequence.sequence"

# Check that it also works
s = json.dumps(obj_dict)
Sequence.deserialize(s)

0 comments on commit 890b3ff

Please sign in to comment.