Skip to content

Commit ef8a40a

Browse files
authored
Merge pull request sequence-toolbox#280 from sequence-toolbox/migrate_to_uv
Migrate to uv
2 parents d7e8fad + 51d61a5 commit ef8a40a

9 files changed

Lines changed: 2676 additions & 88 deletions

File tree

.github/workflows/development.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch:
77

88
env:
9-
PYTHON_VERSION: '3.x'
109
PROD_PYPI_NAME: 'sequence'
1110
TEST_PYPI_NAME: 'ssequence'
1211

@@ -25,22 +24,13 @@ jobs:
2524

2625
steps:
2726
- name: Checkout RnD branch
28-
uses: actions/checkout@v5
27+
uses: actions/checkout@v6
2928
with:
30-
persist-credentials: 'true'
29+
persist-credentials: true
3130
ref: RnD
3231

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
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v7
4434

4535
- name: Generate development version
4636
id: version
@@ -67,7 +57,7 @@ jobs:
6757
fi
6858
6959
- name: Build wheel and tarball
70-
run: python3 -m build
60+
run: uv build
7161

7262
- name: Store build as an artifact
7363
uses: actions/upload-artifact@v4
@@ -101,17 +91,18 @@ jobs:
10191

10292
permissions:
10393
id-token: write
94+
attestations: write
10495

10596
steps:
10697
- name: Download the builds
10798
uses: actions/download-artifact@v4
10899
with:
109100
name: build-RnD-${{ matrix.target }}-${{ needs.build-rnd.outputs.dev_version }}
110101
path: dist/
111-
112102
- name: Publish dist
113103
uses: pypa/gh-action-pypi-publish@release/v1
114104
with:
105+
attestations: true
115106
repository-url: ${{ matrix.pypi_url || '' }}
116107
skip-existing: true
117108
verbose: true

.github/workflows/publish.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
if: github.event_name == 'release' && github.repository == 'sequence-toolbox/SeQUeNCe'
1515
steps:
16-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v6
1717
with:
18-
persist-credentials: 'true'
19-
- name: Setup Python
20-
uses: actions/setup-python@v6
18+
persist-credentials: true
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
2121
with:
22-
python-version: '3.x'
23-
- name: Install pypa/build
24-
run: >-
25-
python3 -m
26-
pip install
27-
build
28-
--user
22+
enable-cache: true
2923
- name: Build wheel and tarball
30-
run: python3 -m build
24+
run: uv build
3125
- name: Store dist as an artifact
3226
uses: actions/upload-artifact@v4
3327
with:
@@ -39,24 +33,18 @@ jobs:
3933
runs-on: ubuntu-latest
4034
if: github.event_name == 'push' && github.repository == 'sequence-toolbox/SeQUeNCe'
4135
steps:
42-
- uses: actions/checkout@v5
36+
- uses: actions/checkout@v6
4337
with:
44-
persist-credentials: 'true'
45-
- name: Setup Python
46-
uses: actions/setup-python@v6
38+
persist-credentials: true
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v7
4741
with:
48-
python-version: '3.x'
49-
- name: Install pypa/build
50-
run: >-
51-
python3 -m
52-
pip install
53-
build
54-
--user
42+
enable-cache: true
5543
- name: Modify package name for TestPyPI
5644
run: |
5745
sed -i 's/^name = "sequence"/name = "ssequence"/' pyproject.toml
5846
- name: Build wheel and tarball for test
59-
run: python3 -m build
47+
run: uv build
6048
- name: Store test dist as an artifact
6149
uses: actions/upload-artifact@v4
6250
with:
@@ -106,5 +94,6 @@ jobs:
10694
- name: Publish dist to TestPyPI
10795
uses: pypa/gh-action-pypi-publish@release/v1
10896
with:
97+
attestations: true
10998
repository-url: https://test.pypi.org/legacy/
11099
skip-existing: true

.github/workflows/validation.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,23 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.11', '3.12', '3.13']
17+
python-version:
18+
- "3.11"
19+
- "3.12"
20+
- "3.13"
21+
- "3.14"
1822

1923
steps:
20-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v6
2125

22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v5
26+
- name: Install uv and set py version
27+
uses: astral-sh/setup-uv@v7
2428
with:
2529
python-version: ${{ matrix.python-version }}
30+
enable-cache: true
2631

27-
- name: Install dependencies
28-
run: |
29-
pip install pytest
30-
make setup
31-
make install
32+
- name: Install project
33+
run: uv sync --locked --all-extras --dev
3234

33-
- name: Test with pytest
34-
run: |
35-
make test
35+
- name: Run tests
36+
run: uv run pytest tests

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ 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

88

9+
## [0.8.3] - 2025-12-11
10+
### Added
11+
- Add support for Python 3.14
12+
- A new function `read_version_from_pyproject()`. Don't need to update the version number 0.x.x at multiple locations anymore
13+
14+
### Changed
15+
- Moves the build-backend from legacy python to uv. More speed, more verbose useful errors, no more specifying modules in pyproject, dependency locks
16+
17+
### Fixed
18+
- A minor bug in `gui.py`
19+
20+
921
## [0.8.2] - 2025-11-21
1022
### Added
1123
- 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.

docs/source/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#
1313
import os
1414
import sys
15+
1516
sys.path.insert(0, os.path.abspath('../..'))
17+
from sequence import read_version_from_pyproject
1618

1719

1820
# -- Project information -----------------------------------------------------
@@ -21,8 +23,8 @@
2123
copyright = '2020-2025'
2224
author = 'Xiaoliang Wu, Joaquin Chung, Alexander Kolar, Eugene Wang, Tian Zhong, Rajkumar Kettimuthu, Martin Suchara'
2325

24-
# The full version, including alpha/beta/rc tags
25-
release = '0.8.2'
26+
# The full version, including alpha/beta/rc tags. Keep single source of truth in pyproject.
27+
version = release = read_version_from_pyproject()
2628

2729

2830
# -- General configuration ---------------------------------------------------

pyproject.toml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,51 @@
11
[project]
22
name = "sequence"
3-
version = "0.8.2"
3+
version = "0.8.3"
44
authors = [
55
{ name = "Xiaoliang Wu, Joaquin Chung, Alexander Kolar, Alexander Kiefer, Eugene Wang, Tian Zhong, Rajkumar Kettimuthu, Martin Suchara, Robert Hayek, Ansh Singal, Caitao Zhan", email = "czhan@anl.gov" }
66
]
77
maintainers = [
8-
{ name = "Caitao Zhan", email = "czhan@anl.gov" }
8+
{ name = "Caitao Zhan", email = "czhan@anl.gov" },
9+
{ name = "Robert Hayek", email = "rhayek@anl.gov" }
910
]
1011
description = "Simulator of QUantum Network Communication (SeQUeNCe) is an open-source tool that allows modeling of quantum networks including photonic network components, control protocols, and applications."
1112
readme = "README.md"
12-
requires-python = ">=3.11, <3.14"
13+
requires-python = ">=3.11, <3.15"
1314
classifiers = [
1415
"Programming Language :: Python :: 3.11",
1516
"Programming Language :: Python :: 3.12",
16-
"Programming Language :: Python :: 3.13"
17+
"Programming Language :: Python :: 3.13",
18+
"Programming Language :: Python :: 3.14"
1719
]
18-
dynamic = ["dependencies"]
1920
keywords = ["quantum", "network", "discrete", "event", "simulator"]
21+
dependencies = [
22+
"dash>=3.3.0",
23+
"dash-bootstrap-components>=2.0.4",
24+
"dash-core-components>=2.0.0",
25+
"dash-cytoscape>=1.0.2",
26+
"dash-html-components>=2.0.0",
27+
"dash-table>=5.0.0",
28+
"gmpy2>=2.2.2",
29+
"ipywidgets>=8.1.8",
30+
"jupyterlab>=4.5.0",
31+
"matplotlib>=3.10.7",
32+
"networkx>=3.6.1",
33+
"numpy>=2.3.5",
34+
"pandas>=2.3.3",
35+
"plotly>=6.5.0",
36+
"pytest>=9.0.2",
37+
"qutip>=5.2.2",
38+
"qutip-qip>=0.4.1",
39+
"scipy>=1.16.3",
40+
"tqdm>=4.67.1",
41+
]
2042

21-
[tool.setuptools.dynamic]
22-
dependencies = { file = ["requirements.txt"] }
43+
[build-system]
44+
requires = ["uv_build>=0.9.17,<0.10.0"]
45+
build-backend = "uv_build"
2346

24-
[tool.setuptools]
25-
packages = ['sequence', 'sequence.app', 'sequence.kernel', 'sequence.components', 'sequence.network_management',
26-
'sequence.entanglement_management', 'sequence.qkd', 'sequence.resource_management', 'sequence.topology',
27-
'sequence.utils', 'sequence.gui', 'sequence.qlan', 'sequence.topology.qlan',
28-
'sequence.entanglement_management.generation', 'sequence.entanglement_management.purification']
47+
[tool.uv.build-backend]
48+
module-root = ""
2949

3050
[tool.setuptools.package-data]
3151
sequence = ["gui/user_templates.json", "gui/default_params.json", "gui/starlight.json"]

requirements.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

sequence/__init__.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
from pathlib import Path
2+
13
__all__ = ['app', 'components', 'entanglement_management', 'kernel', 'network_management', 'qkd', 'resource_management',
2-
'topology', 'utils', 'message', 'protocol', 'gui', 'qlan']
4+
'topology', 'utils', 'message', 'protocol', 'gui', 'qlan', 'read_version_from_pyproject']
5+
6+
7+
def read_version_from_pyproject() -> str:
8+
pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
9+
if not pyproject.exists():
10+
return "unknown"
11+
try:
12+
import tomllib
13+
except Exception:
14+
return "unknown"
15+
16+
try:
17+
with pyproject.open("rb") as f:
18+
return tomllib.load(f)["project"]["version"]
19+
except Exception:
20+
return "unknown"
21+
22+
23+
__version__ = read_version_from_pyproject()
324

4-
__version__ = '0.8.2'
525

626
def __dir__():
7-
return sorted(__all__)
27+
return sorted(__all__)

0 commit comments

Comments
 (0)