Skip to content

Commit 8889d4f

Browse files
authored
Merge pull request sequence-toolbox#276 from sequence-toolbox/RnD
Merge recent commits from RnD to Master -- version 0.8.2
2 parents 5600eb7 + 24f5a6b commit 8889d4f

92 files changed

Lines changed: 1052 additions & 6056 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/development.yml

Lines changed: 99 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,114 @@ on:
44
push:
55
branches: [RnD]
66
workflow_dispatch:
7+
8+
env:
9+
PYTHON_VERSION: '3.x'
10+
PROD_PYPI_NAME: 'sequence'
11+
TEST_PYPI_NAME: 'ssequence'
12+
713
jobs:
8-
build-test-rnd:
9-
name: Build RnD Development Package
14+
build-rnd:
15+
if: github.repository == 'sequence-toolbox/SeQUeNCe'
16+
name: Build RnD Package
1017
runs-on: ubuntu-latest
18+
outputs:
19+
dev_version: ${{ steps.version.outputs.dev_version }}
20+
commit_hash: ${{ steps.version.outputs.commit_hash }}
21+
22+
strategy:
23+
matrix:
24+
target: [pypi, testpypi]
1125

1226
steps:
13-
- uses: actions/checkout@v5
14-
with:
15-
persist-credentials: 'true'
16-
ref: RnD
17-
18-
- name: Setup Python
19-
uses: actions/setup-python@v6
20-
with:
21-
python-version: '3.x'
22-
23-
- name: Install pypa/build
24-
run: >-
25-
python3 -m
26-
pip install
27-
build
28-
--user
29-
30-
- name: Update version for dev
31-
run: |
32-
# Get current date for dev versioning
33-
DEV_DATE=$(date +%Y%m%d)
34-
35-
# Read current version from pyproject.toml
36-
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
37-
38-
# Create development version from RnD: e.g., 0.8.1.dev20241218
39-
DEV_VERSION="${CURRENT_VERSION}.dev${DEV_DATE}"
40-
41-
# Update version in pyproject.toml
42-
sed -i "s/^version = .*/version = \"${DEV_VERSION}\"/" pyproject.toml
43-
44-
echo "DEV_VERSION=${DEV_VERSION}" >> $GITHUB_ENV
45-
echo "Building development version from RnD: ${DEV_VERSION}"
46-
47-
- name: Modify package name for TestPyPI
48-
run: |
49-
sed -i 's/^name = "sequence"/name = "ssequence"/' pyproject.toml
50-
51-
- name: Build wheel and tarball
52-
run: python3 -m build
53-
54-
- name: Store development build as artifact
55-
uses: actions/upload-artifact@v4
56-
with:
57-
name: test-dev-build-RnD-${{ env.DEV_VERSION }}
58-
path: dist/
59-
retention-days: 4
60-
61-
publish-dev-to-test-pypi:
62-
name: Publish RnD Development to TestPyPI
63-
needs: build-test-rnd
27+
- name: Checkout RnD branch
28+
uses: actions/checkout@v5
29+
with:
30+
persist-credentials: 'true'
31+
ref: RnD
32+
33+
- name: Setup Python
34+
uses: actions/setup-python@v6
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Install pypa/build
39+
run: >-
40+
python3 -m
41+
pip install
42+
build
43+
--user
44+
45+
- name: Generate development version
46+
id: version
47+
run: |
48+
GIT_HASH=$(git rev-parse --short HEAD)
49+
NUMERIC_HASH=$((0x${GIT_HASH}))
50+
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
51+
52+
DEV_VERSION="${CURRENT_VERSION}.dev${NUMERIC_HASH}"
53+
54+
echo "dev_version=${DEV_VERSION}" >> $GITHUB_OUTPUT
55+
echo "commit_hash=${GIT_HASH}" >> $GITHUB_OUTPUT
56+
echo "DEV_VERSION=${DEV_VERSION}" >> $GITHUB_ENV
57+
58+
echo "Building development version from RnD: ${DEV_VERSION}"
59+
60+
- name: Update package configuration
61+
run: |
62+
# Update version in pyproject.toml
63+
sed -i "s/^version = .*/version = \"${DEV_VERSION}\"/" pyproject.toml
64+
65+
if [ "${{ matrix.target }}" = "testpypi" ]; then
66+
sed -i "s/^name = \"sequence\"/name = \"ssequence\"/" pyproject.toml
67+
fi
68+
69+
- name: Build wheel and tarball
70+
run: python3 -m build
71+
72+
- name: Store build as an artifact
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: build-RnD-${{ matrix.target }}-${{ steps.version.outputs.dev_version }}
76+
path: dist/
77+
retention-days: 4
78+
79+
publish-rnd:
80+
name: Publish RnD to TestPyPI and PyPI
81+
needs: build-rnd
6482
runs-on: ubuntu-latest
83+
if: success() && github.repository == 'sequence-toolbox/SeQUeNCe'
84+
85+
strategy:
86+
matrix:
87+
include:
88+
- target: pypi
89+
environment: pypi
90+
repository_url: https://pypi.org/p/sequence
91+
package_name: sequence
92+
- target: testpypi
93+
environment: testpypi
94+
repository_url: https://test.pypi.org/p/ssequence
95+
package_name: ssequence
96+
pypi_url: https://test.pypi.org/legacy/
6597

6698
environment:
67-
name: testpypi
68-
url: https://test.pypi.org/p/ssequence
99+
name: ${{ matrix.environment }}
100+
url: ${{ matrix.repository_url }}
69101

70102
permissions:
71103
id-token: write
72104

73105
steps:
74-
- name: Download development build
75-
uses: actions/download-artifact@v4
76-
with:
77-
pattern: test-dev-build-RnD-*
78-
path: dist/
79-
merge-multiple: true
80-
81-
- name: Publish development build to TestPyPI
82-
uses: pypa/gh-action-pypi-publish@release/v1
83-
with:
84-
repository-url: https://test.pypi.org/legacy/
85-
skip-existing: true
106+
- name: Download the builds
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: build-RnD-${{ matrix.target }}-${{ needs.build-rnd.outputs.dev_version }}
110+
path: dist/
111+
112+
- name: Publish dist
113+
uses: pypa/gh-action-pypi-publish@release/v1
114+
with:
115+
repository-url: ${{ matrix.pypi_url || '' }}
116+
skip-existing: true
117+
verbose: true

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build-release:
1212
name: Build the release
1313
runs-on: ubuntu-latest
14-
if: github.event_name == 'release'
14+
if: github.event_name == 'release' && github.repository == 'sequence-toolbox/SeQUeNCe'
1515
steps:
1616
- uses: actions/checkout@v5
1717
with:
@@ -37,7 +37,7 @@ jobs:
3737
build-test-release:
3838
name: Build the test release
3939
runs-on: ubuntu-latest
40-
if: github.event_name == 'push'
40+
if: github.event_name == 'push' && github.repository == 'sequence-toolbox/SeQUeNCe'
4141
steps:
4242
- uses: actions/checkout@v5
4343
with:
@@ -65,7 +65,7 @@ jobs:
6565

6666
publish-to-pypi:
6767
name: Publish dist to PyPi
68-
if: github.event_name == 'release' && github.event.action == 'published'
68+
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'sequence-toolbox/SeQUeNCe'
6969
needs:
7070
- build-release
7171
runs-on: ubuntu-latest
@@ -86,7 +86,7 @@ jobs:
8686

8787
publish-to-test-pypi:
8888
name: Publish dist to TestPyPi
89-
if: github.event_name == 'push'
89+
if: github.event_name == 'push' && github.repository == 'sequence-toolbox/SeQUeNCe'
9090
needs:
9191
- build-test-release
9292
runs-on: ubuntu-latest

.github/workflows/validation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
jobs:
1111
validation:
12+
if: github.repository == 'sequence-toolbox/SeQUeNCe'
1213
name: Run Unit Tests
1314
runs-on: ubuntu-latest
1415
strategy:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,6 @@ sequence/gui/test_run.py
143143

144144
# tmp folder
145145
tmp/
146+
147+
# config file
148+
utils/json_config_generators/*.json

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
9+
## [0.8.2] - 2025-11-19
10+
### Added
11+
- A new state `PURIFIED` in `MemoryInfo` is introduced to enable the new purify strategy `once`, i.e. only purify one time. The previous existing stragety is renamed to `until_target`, i.e., keep purifing until reaching the target fidelity.
12+
- `QuantumManagerKet.get_ascending_keys()`: call `reorder_qubits_ascending_keys()` before getting the state
13+
- `QuantumManagerKet.reorder_qubits_ascending_keys()`: reorder the quantum state such that the corresponding keys are in ascending order.
14+
- `QuantumManagerDensity.get_ascending_keys()` and `QuantumManagerDensity.reorder_qubits_ascending_keys()`: same reording qubits for density matrix formalism.
15+
- `quantum_utils.pretty_ket()`: return a pretty-looking state vector string
16+
- `NetworkManager.get_reservation_protocol()`: Method to get the resource reservation protocol in the network manager's protocol stack.
17+
18+
### Changed
19+
- Updated workflows `development.yml`, `publish.yml`, `validation.yml`. Only run on the main repository (sequence-toolbox/SeQUeNCe), preventing unintended builds and publishes from forks.
20+
- Standardized `gmpy2` context precision to 80 bits in timing-related modules (`detector.py`, `optical_channel.py`) for computation efficiency and sufficient accuracy.
21+
- `quantum_utils.measure_entangled_state_with_cache_ket()`: make code more mathematically sound.
22+
- A lot of minor refactoring (spacing, indentation, f-string, comments, docstring, etc.)
23+
- Updated related `pytest`
24+
25+
### Fixed
26+
- Improved time calculations in `Detector.record_detection` to use high-precision `gmpy2`
27+
28+
### Removed
29+
- Remove all parallel module related stuff under `utils/json_config_gnerators/*`, `config_generator.py` and `router_net_topo.py`.
30+
31+
32+
833
## [0.8.1] - 2025-09-17
934
### Changed
1035
- Migrate code to fit PEP requirements for py3.11

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,7 @@ python gui.py
7878
```
7979

8080
## Usage Examples
81-
Many examples of SeQUeNCe in action can be found in the [example](/example) folder. These include both quantum key distribution and entanglement distribution examples.
82-
83-
### Starlight Experiments
84-
Code for the experiments performed in our paper can be found in the file `starlight_experiments.py`. This script uses the `starlight.json` file (also within the example folder) to specify the network topology.
85-
86-
### Jupyter Notebook Examples
87-
The example folder contains several scripts that can be run with jupyter notebook for easy editing and visualization. These examples include:
88-
* `BB84_eg.ipynb`, which uses the BB84 protocol to distribute secure keys between two quantum nodes
89-
* `two_node_eg.ipynb`, which performs entanglement generation between two adjacent quantum routers
90-
* `three_node_eg_ep_es.ipynb`, which performs entanglement generation, purification, and swapping for a linear network of three quantum routers
81+
Many examples of SeQUeNCe in action can be found in the [example](/example) folder. The example includes jupyter notebook demos, and code used in published papers.
9182

9283
## Additional Tools
9384

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Xiaoliang Wu, Joaquin Chung, Alexander Kolar, Eugene Wang, Tian Zhong, Rajkumar Kettimuthu, Martin Suchara'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '0.8.1'
25+
release = '0.8.2'
2626

2727

2828
# -- General configuration ---------------------------------------------------

0 commit comments

Comments
 (0)