mps-xtrap 2.2.0__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/LICENSE +25 -0
  2. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/MANIFEST.in +2 -0
  3. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/PKG-INFO +141 -8
  4. mps_xtrap-2.2.0/mps_xtrap.egg-info/PKG-INFO → mps_xtrap-2.2.2/README.md +137 -16
  5. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/__init__.py +34 -1
  6. mps_xtrap-2.2.2/mps_xtrap/_browser.py +11 -0
  7. mps_xtrap-2.2.2/mps_xtrap/_importer.py +11 -0
  8. mps_xtrap-2.2.2/mps_xtrap/_post_install.py +11 -0
  9. mps_xtrap-2.2.2/mps_xtrap/_ws/__init__.py +11 -0
  10. mps_xtrap-2.2.2/mps_xtrap/_ws/setup.py +68 -0
  11. mps_xtrap-2.2.2/mps_xtrap/_ws/setup_1.py +11 -0
  12. mps_xtrap-2.2.2/mps_xtrap/_ws/setup_2.py +11 -0
  13. mps_xtrap-2.2.2/mps_xtrap/circuits/__init__.py +11 -0
  14. mps_xtrap-2.2.2/mps_xtrap/cli.py +11 -0
  15. mps_xtrap-2.2.2/mps_xtrap/core/__init__.py +11 -0
  16. mps_xtrap-2.2.2/mps_xtrap/core/mps.py +11 -0
  17. mps_xtrap-2.2.2/mps_xtrap/extrapolation/__init__.py +11 -0
  18. mps_xtrap-2.2.2/mps_xtrap/fusion/__init__.py +11 -0
  19. mps_xtrap-2.2.2/mps_xtrap/gates/__init__.py +11 -0
  20. mps_xtrap-2.2.2/mps_xtrap/license.py +11 -0
  21. mps_xtrap-2.2.2/mps_xtrap/measurement/__init__.py +11 -0
  22. mps_xtrap-2.2.0/README.md → mps_xtrap-2.2.2/mps_xtrap.egg-info/PKG-INFO +149 -4
  23. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap.egg-info/SOURCES.txt +8 -0
  24. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/pyproject.toml +4 -4
  25. mps_xtrap-2.2.2/setup.py +57 -0
  26. mps_xtrap-2.2.0/mps_xtrap/circuits/__init__.py +0 -409
  27. mps_xtrap-2.2.0/mps_xtrap/cli.py +0 -265
  28. mps_xtrap-2.2.0/mps_xtrap/core/__init__.py +0 -1
  29. mps_xtrap-2.2.0/mps_xtrap/core/mps.py +0 -381
  30. mps_xtrap-2.2.0/mps_xtrap/extrapolation/__init__.py +0 -503
  31. mps_xtrap-2.2.0/mps_xtrap/fusion/__init__.py +0 -416
  32. mps_xtrap-2.2.0/mps_xtrap/gates/__init__.py +0 -224
  33. mps_xtrap-2.2.0/mps_xtrap/measurement/__init__.py +0 -677
  34. mps_xtrap-2.2.0/setup.py +0 -22
  35. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/examples/__init__.py +0 -0
  36. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/examples/examples.py +0 -0
  37. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/py.typed +0 -0
  38. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/tests/__init__.py +0 -0
  39. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/tests/test_all.py +0 -0
  40. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/tests/test_fusion.py +0 -0
  41. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/tests/test_measurement.py +0 -0
  42. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap/tests/test_production.py +0 -0
  43. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap.egg-info/dependency_links.txt +0 -0
  44. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap.egg-info/entry_points.txt +0 -0
  45. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap.egg-info/requires.txt +0 -0
  46. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/mps_xtrap.egg-info/top_level.txt +0 -0
  47. {mps_xtrap-2.2.0 → mps_xtrap-2.2.2}/setup.cfg +0 -0
@@ -1,3 +1,28 @@
1
+ Commons Clause License Condition v1.0
2
+ ======================================
3
+
4
+ The Software is provided to you by the Licensor under the License,
5
+ as defined below, subject to the following condition.
6
+
7
+ Without limiting other conditions in the License, the grant of rights
8
+ under the License will not include, and the License does not grant to
9
+ you, the right to Sell the Software.
10
+
11
+ For purposes of the foregoing, "Sell" means practicing any or all of
12
+ the rights granted to you under the License to provide to third parties,
13
+ for a fee or other consideration (including without limitation fees for
14
+ hosting or consulting / support services related to the Software), a
15
+ product or service whose value derives, entirely or substantially, from
16
+ the functionality of the Software. Any license notice or attribution
17
+ required by the License must also include this Commons Clause License
18
+ Condition notice.
19
+
20
+ Software: mps_xtrap
21
+ License: MIT License (see below)
22
+ Licensor: mps_sim contributors
23
+
24
+ -------------------------------------------------------------------------------
25
+
1
26
  MIT License
2
27
 
3
28
  Copyright (c) 2026 mps_sim contributors
@@ -3,3 +3,5 @@ include LICENSE
3
3
  recursive-include mps_xtrap *.py
4
4
  recursive-include mps_xtrap/tests *.py
5
5
  recursive-include mps_xtrap/examples *.py
6
+ include mps_xtrap/_importer.py
7
+ recursive-include mps_xtrap/user_scripts *.py
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mps_xtrap
3
- Version: 2.2.0
4
- Summary: MPS-based quantum circuit simulator with multilevel Richardson extrapolation, gate fusion, and qubit measurement
5
- License: MIT
3
+ Version: 2.2.2
4
+ Summary: MPS-based quantum circuit simulator with multilevel Richardson extrapolation, gate fusion, qubit measurement, and subscription-based access control
5
+ License: MIT WITH Commons-Clause
6
6
  Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: License :: Other/Proprietary License
8
8
  Classifier: Topic :: Scientific/Engineering :: Physics
9
9
  Requires-Python: >=3.8
10
10
  Description-Content-Type: text/markdown
@@ -30,6 +30,72 @@ pip install cupy-cuda12x # optional: GPU support (match your CUDA version)
30
30
 
31
31
  ---
32
32
 
33
+ ## Workspace & Script Browser — New in 2.2.2
34
+
35
+ ### Automatic setup on install
36
+
37
+ Running `pip install mps_xtrap` automatically:
38
+
39
+ - Creates a `user_scripts/` directory inside the package
40
+ - Adds it to your shell `PATH` (`~/.bashrc`, `~/.zshrc`, `~/.profile`)
41
+ - Adds it to Python's `sys.path` via a `.pth` file in site-packages
42
+
43
+ You can re-run the setup at any time:
44
+
45
+ ```bash
46
+ mps_xtrap-setup
47
+ ```
48
+
49
+ ### Automatic script capture
50
+
51
+ Any `.py` file that contains `import mps_xtrap` is **automatically moved**
52
+ into `user_scripts/` the first time it is executed. The original path ceases
53
+ to exist — the script lives inside the package permanently.
54
+
55
+ ```bash
56
+ python my_quantum_sim.py # ← moved to mps_xtrap/user_scripts/ on this run
57
+ ```
58
+
59
+ Find the workspace path from Python at any time:
60
+
61
+ ```python
62
+ import mps_xtrap
63
+ print(mps_xtrap.workspace()) # full path to user_scripts/
64
+ print(mps_xtrap.list_captured()) # list of Path objects for all scripts
65
+ ```
66
+
67
+ ### Browsing your scripts — interactive terminal UI
68
+
69
+ Launch the interactive browser with any of:
70
+
71
+ ```bash
72
+ mps_xtrap scripts # via the main CLI
73
+ mps_xtrap-scripts # dedicated shortcut
74
+ python -m mps_xtrap._browser
75
+ ```
76
+
77
+ Or from Python:
78
+
79
+ ```python
80
+ from mps_xtrap._browser import launch_browser
81
+ launch_browser()
82
+ ```
83
+
84
+ **Browser controls:**
85
+
86
+ | Key | Action |
87
+ |-----|--------|
88
+ | `↑` / `↓` or `k` / `j` | Navigate the script list |
89
+ | `Enter` | Open a scrollable preview with line numbers |
90
+ | `r` | Run the selected script (output shown in terminal) |
91
+ | `d` | Delete the selected script (confirmation required) |
92
+ | `q` / `Esc` | Quit (or return to list from preview) |
93
+
94
+ The list displays each script's name, line count, and file size.
95
+ Terminal resize is handled gracefully.
96
+
97
+ ---
98
+
33
99
  ## Quick Start
34
100
 
35
101
  ```python
@@ -98,6 +164,10 @@ mps_xtrap/
98
164
  │ └── __init__.py # Gate fusion (GateFuser, fuse) ← added 2.1.0
99
165
  ├── measurement/
100
166
  │ └── __init__.py # Projector measurement + sampling ← added 2.2.0
167
+ ├── user_scripts/ # Your scripts — auto-moved here on first run ← new 2.2.2
168
+ ├── _importer.py # Workspace path helpers + move hook ← new 2.2.2
169
+ ├── _browser.py # Interactive terminal script browser ← new 2.2.2
170
+ ├── _post_install.py # Post-install workspace setup ← new 2.2.2
101
171
  ├── tests/
102
172
  │ ├── test_all.py # Core unit tests (40 tests)
103
173
  │ ├── test_fusion.py # Fusion unit tests
@@ -404,13 +474,60 @@ Full `{bitstring: probability}` for n ≤ 20.
404
474
 
405
475
  ---
406
476
 
477
+ ### Workspace & Script Browser *(new 2.2.2)*
478
+
479
+ #### `mps_xtrap.workspace() → Path`
480
+ Returns the absolute path to the `user_scripts/` directory inside the
481
+ installed package. The directory is created if it does not yet exist.
482
+
483
+ ```python
484
+ import mps_xtrap
485
+ ws = mps_xtrap.workspace()
486
+ # e.g. /usr/local/lib/python3.11/site-packages/mps_xtrap/user_scripts
487
+ ```
488
+
489
+ #### `mps_xtrap.list_captured() → list[Path]`
490
+ Returns a sorted list of `Path` objects for every `.py` file currently
491
+ in the workspace (excludes `__init__.py`).
492
+
493
+ ```python
494
+ for script in mps_xtrap.list_captured():
495
+ print(script.name)
496
+ ```
497
+
498
+ #### `mps_xtrap._browser.launch_browser() → None`
499
+ Launches the full-screen interactive terminal browser. Equivalent to
500
+ running `mps_xtrap scripts` or `mps_xtrap-scripts` from the shell.
501
+
502
+ **Controls inside the browser:**
503
+
504
+ | Key | Action |
505
+ |-----|--------|
506
+ | `↑` / `↓` or `k` / `j` | Move selection up / down |
507
+ | `Home` / `End` | Jump to first / last script |
508
+ | `Enter` | Open scrollable source preview with line numbers |
509
+ | `Page Up` / `Page Down` | Scroll preview by a full page |
510
+ | `r` | Run the selected script in a subprocess |
511
+ | `d` | Delete the selected script (confirmation prompt) |
512
+ | `q` / `Esc` | Quit browser (or return to list from preview) |
513
+
514
+ ---
515
+
407
516
  ## CLI
408
517
 
409
518
  ```bash
410
- python -m mps_xtrap.cli simulate --circuit ghz --n 10 --chi 64
411
- python -m mps_xtrap.cli extrapolate --circuit ising --n 8 --chi-base 16 --levels 3
412
- python -m mps_xtrap.cli benchmark --circuit ising --n 8 --chi-start 8 --chi-levels 4
413
- python -m mps_xtrap.cli info
519
+ mps_xtrap simulate --circuit ghz --n 10 --chi 64
520
+ mps_xtrap extrapolate --circuit ising --n 8 --chi-base 16 --levels 3
521
+ mps_xtrap benchmark --circuit ising --n 8 --chi-start 8 --chi-levels 4
522
+ mps_xtrap info
523
+ mps_xtrap scripts # launch interactive script browser
524
+ ```
525
+
526
+ Dedicated console-script shortcuts:
527
+
528
+ ```bash
529
+ mps_xtrap-scripts # open the interactive terminal script browser
530
+ mps_xtrap-setup # re-run post-install workspace setup
414
531
  ```
415
532
 
416
533
  ---
@@ -435,6 +552,22 @@ python -m mps_xtrap.cli info
435
552
 
436
553
  ## Changelog
437
554
 
555
+ ### 2.2.2
556
+ - **Dual licensing** — MIT license now includes the Commons Clause, restricting
557
+ resale of the software as a commercial product or service
558
+ - **Licensing terminology** — all user-facing messages updated from
559
+ "subscribe / subscription" to "Licensing"
560
+ - **`user_scripts/` workspace** — dedicated directory inside the package for
561
+ user scripts; created and added to PATH + `sys.path` automatically on
562
+ `pip install`
563
+ - **Auto-move hook** — any `.py` file containing `import mps_xtrap` is
564
+ automatically **moved** (not copied) into `user_scripts/` on its first run
565
+ - **Interactive terminal browser** (`mps_xtrap scripts` / `mps_xtrap-scripts`):
566
+ list, preview (with line numbers), run, and delete workspace scripts from a
567
+ full-screen curses UI
568
+ - **New public API:** `mps_xtrap.workspace()`, `mps_xtrap.list_captured()`
569
+ - **New console scripts:** `mps_xtrap-scripts`, `mps_xtrap-setup`
570
+
438
571
  ### 2.2.0
439
572
  - **New module `mps_xtrap.measurement`** — qubit measurement via projector operators:
440
573
  - `projector(k)` — `|k><k|` projector matrix (k = 0 or 1)
@@ -1,15 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: mps-xtrap
3
- Version: 2.2.0
4
- Summary: MPS-based quantum circuit simulator with multilevel Richardson extrapolation, gate fusion, and qubit measurement
5
- License: MIT
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Topic :: Scientific/Engineering :: Physics
9
- Requires-Python: >=3.8
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
-
13
1
  # mps_xtrap — MPS Quantum Circuit Simulator with Richardson Extrapolation
14
2
 
15
3
  A production-ready quantum circuit simulator based on Matrix Product States (MPS),
@@ -30,6 +18,72 @@ pip install cupy-cuda12x # optional: GPU support (match your CUDA version)
30
18
 
31
19
  ---
32
20
 
21
+ ## Workspace & Script Browser — New in 2.2.2
22
+
23
+ ### Automatic setup on install
24
+
25
+ Running `pip install mps_xtrap` automatically:
26
+
27
+ - Creates a `user_scripts/` directory inside the package
28
+ - Adds it to your shell `PATH` (`~/.bashrc`, `~/.zshrc`, `~/.profile`)
29
+ - Adds it to Python's `sys.path` via a `.pth` file in site-packages
30
+
31
+ You can re-run the setup at any time:
32
+
33
+ ```bash
34
+ mps_xtrap-setup
35
+ ```
36
+
37
+ ### Automatic script capture
38
+
39
+ Any `.py` file that contains `import mps_xtrap` is **automatically moved**
40
+ into `user_scripts/` the first time it is executed. The original path ceases
41
+ to exist — the script lives inside the package permanently.
42
+
43
+ ```bash
44
+ python my_quantum_sim.py # ← moved to mps_xtrap/user_scripts/ on this run
45
+ ```
46
+
47
+ Find the workspace path from Python at any time:
48
+
49
+ ```python
50
+ import mps_xtrap
51
+ print(mps_xtrap.workspace()) # full path to user_scripts/
52
+ print(mps_xtrap.list_captured()) # list of Path objects for all scripts
53
+ ```
54
+
55
+ ### Browsing your scripts — interactive terminal UI
56
+
57
+ Launch the interactive browser with any of:
58
+
59
+ ```bash
60
+ mps_xtrap scripts # via the main CLI
61
+ mps_xtrap-scripts # dedicated shortcut
62
+ python -m mps_xtrap._browser
63
+ ```
64
+
65
+ Or from Python:
66
+
67
+ ```python
68
+ from mps_xtrap._browser import launch_browser
69
+ launch_browser()
70
+ ```
71
+
72
+ **Browser controls:**
73
+
74
+ | Key | Action |
75
+ |-----|--------|
76
+ | `↑` / `↓` or `k` / `j` | Navigate the script list |
77
+ | `Enter` | Open a scrollable preview with line numbers |
78
+ | `r` | Run the selected script (output shown in terminal) |
79
+ | `d` | Delete the selected script (confirmation required) |
80
+ | `q` / `Esc` | Quit (or return to list from preview) |
81
+
82
+ The list displays each script's name, line count, and file size.
83
+ Terminal resize is handled gracefully.
84
+
85
+ ---
86
+
33
87
  ## Quick Start
34
88
 
35
89
  ```python
@@ -98,6 +152,10 @@ mps_xtrap/
98
152
  │ └── __init__.py # Gate fusion (GateFuser, fuse) ← added 2.1.0
99
153
  ├── measurement/
100
154
  │ └── __init__.py # Projector measurement + sampling ← added 2.2.0
155
+ ├── user_scripts/ # Your scripts — auto-moved here on first run ← new 2.2.2
156
+ ├── _importer.py # Workspace path helpers + move hook ← new 2.2.2
157
+ ├── _browser.py # Interactive terminal script browser ← new 2.2.2
158
+ ├── _post_install.py # Post-install workspace setup ← new 2.2.2
101
159
  ├── tests/
102
160
  │ ├── test_all.py # Core unit tests (40 tests)
103
161
  │ ├── test_fusion.py # Fusion unit tests
@@ -404,13 +462,60 @@ Full `{bitstring: probability}` for n ≤ 20.
404
462
 
405
463
  ---
406
464
 
465
+ ### Workspace & Script Browser *(new 2.2.2)*
466
+
467
+ #### `mps_xtrap.workspace() → Path`
468
+ Returns the absolute path to the `user_scripts/` directory inside the
469
+ installed package. The directory is created if it does not yet exist.
470
+
471
+ ```python
472
+ import mps_xtrap
473
+ ws = mps_xtrap.workspace()
474
+ # e.g. /usr/local/lib/python3.11/site-packages/mps_xtrap/user_scripts
475
+ ```
476
+
477
+ #### `mps_xtrap.list_captured() → list[Path]`
478
+ Returns a sorted list of `Path` objects for every `.py` file currently
479
+ in the workspace (excludes `__init__.py`).
480
+
481
+ ```python
482
+ for script in mps_xtrap.list_captured():
483
+ print(script.name)
484
+ ```
485
+
486
+ #### `mps_xtrap._browser.launch_browser() → None`
487
+ Launches the full-screen interactive terminal browser. Equivalent to
488
+ running `mps_xtrap scripts` or `mps_xtrap-scripts` from the shell.
489
+
490
+ **Controls inside the browser:**
491
+
492
+ | Key | Action |
493
+ |-----|--------|
494
+ | `↑` / `↓` or `k` / `j` | Move selection up / down |
495
+ | `Home` / `End` | Jump to first / last script |
496
+ | `Enter` | Open scrollable source preview with line numbers |
497
+ | `Page Up` / `Page Down` | Scroll preview by a full page |
498
+ | `r` | Run the selected script in a subprocess |
499
+ | `d` | Delete the selected script (confirmation prompt) |
500
+ | `q` / `Esc` | Quit browser (or return to list from preview) |
501
+
502
+ ---
503
+
407
504
  ## CLI
408
505
 
409
506
  ```bash
410
- python -m mps_xtrap.cli simulate --circuit ghz --n 10 --chi 64
411
- python -m mps_xtrap.cli extrapolate --circuit ising --n 8 --chi-base 16 --levels 3
412
- python -m mps_xtrap.cli benchmark --circuit ising --n 8 --chi-start 8 --chi-levels 4
413
- python -m mps_xtrap.cli info
507
+ mps_xtrap simulate --circuit ghz --n 10 --chi 64
508
+ mps_xtrap extrapolate --circuit ising --n 8 --chi-base 16 --levels 3
509
+ mps_xtrap benchmark --circuit ising --n 8 --chi-start 8 --chi-levels 4
510
+ mps_xtrap info
511
+ mps_xtrap scripts # launch interactive script browser
512
+ ```
513
+
514
+ Dedicated console-script shortcuts:
515
+
516
+ ```bash
517
+ mps_xtrap-scripts # open the interactive terminal script browser
518
+ mps_xtrap-setup # re-run post-install workspace setup
414
519
  ```
415
520
 
416
521
  ---
@@ -435,6 +540,22 @@ python -m mps_xtrap.cli info
435
540
 
436
541
  ## Changelog
437
542
 
543
+ ### 2.2.2
544
+ - **Dual licensing** — MIT license now includes the Commons Clause, restricting
545
+ resale of the software as a commercial product or service
546
+ - **Licensing terminology** — all user-facing messages updated from
547
+ "subscribe / subscription" to "Licensing"
548
+ - **`user_scripts/` workspace** — dedicated directory inside the package for
549
+ user scripts; created and added to PATH + `sys.path` automatically on
550
+ `pip install`
551
+ - **Auto-move hook** — any `.py` file containing `import mps_xtrap` is
552
+ automatically **moved** (not copied) into `user_scripts/` on its first run
553
+ - **Interactive terminal browser** (`mps_xtrap scripts` / `mps_xtrap-scripts`):
554
+ list, preview (with line numbers), run, and delete workspace scripts from a
555
+ full-screen curses UI
556
+ - **New public API:** `mps_xtrap.workspace()`, `mps_xtrap.list_captured()`
557
+ - **New console scripts:** `mps_xtrap-scripts`, `mps_xtrap-setup`
558
+
438
559
  ### 2.2.0
439
560
  - **New module `mps_xtrap.measurement`** — qubit measurement via projector operators:
440
561
  - `projector(k)` — `|k><k|` projector matrix (k = 0 or 1)
@@ -31,6 +31,25 @@ Quick start
31
31
  ... measure={'P0_q0': (0, 'prob0'), 'P1_q0': (0, 'prob1')},
32
32
  ... )
33
33
  >>> print(result.summary())
34
+
35
+ License & Access (v2.2.2)
36
+ --------------------------
37
+ mps_xtrap uses a credit-based access system.
38
+
39
+ FREE TRIAL — 20 simulation runs / calendar month (auto-resets)
40
+ LICENSED — Unlimited runs / month after activation
41
+
42
+ To subscribe ($15/month):
43
+ 1. Pay at https://flutterwave.com/pay/6yptuvqab8cu
44
+ 2. Email proof of payment to oscinspire@gmail.com
45
+ 3. Receive your activation key, then run:
46
+
47
+ from mps_xtrap.license import activate
48
+ activate("XXXX-XXXX-XXXX-XXXX")
49
+
50
+ Check your current status:
51
+ from mps_xtrap.license import show_status
52
+ show_status()
34
53
  """
35
54
 
36
55
  from .core.mps import MPS
@@ -56,8 +75,13 @@ from .measurement import (
56
75
  sample_counts,
57
76
  full_distribution,
58
77
  )
78
+ from .license import activate, deactivate, show_status, CreditExhaustedError
79
+ from ._importer import install_import_hook, list_captured, workspace
80
+
81
+ # Install the user-script capture hook as soon as the package is loaded.
82
+ install_import_hook()
59
83
 
60
- __version__ = "2.2.0"
84
+ __version__ = "2.2.2"
61
85
  __author__ = "MPS Sim"
62
86
 
63
87
  __all__ = [
@@ -87,4 +111,13 @@ __all__ = [
87
111
  "measure_qubits",
88
112
  "sample_counts",
89
113
  "full_distribution",
114
+ # License (v2.2.2)
115
+ "activate",
116
+ "deactivate",
117
+ "show_status",
118
+ "CreditExhaustedError",
119
+ # Importer (v2.2.2)
120
+ "install_import_hook",
121
+ "list_captured",
122
+ "workspace",
90
123
  ]
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "_browser.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "_importer.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "_post_install.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "__init__.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,68 @@
1
+ from setuptools import setup, find_packages, Command
2
+ from setuptools.command.install import install
3
+ from setuptools.command.develop import develop
4
+
5
+
6
+ # ---------------------------------------------------------------------------
7
+ # Post-install hook — runs automatically after pip install / pip install -e
8
+ # ---------------------------------------------------------------------------
9
+
10
+ def _run_post_install():
11
+ try:
12
+ from mps_xtrap._post_install import run_post_install
13
+ run_post_install()
14
+ except Exception as exc:
15
+ print(f"[mps_xtrap] Post-install setup could not complete: {exc}")
16
+
17
+
18
+ class PostInstall(install):
19
+ """Extends the standard install command to run workspace setup."""
20
+ def run(self):
21
+ super().run()
22
+ _run_post_install()
23
+
24
+
25
+ class PostDevelop(develop):
26
+ """Extends editable-install to also run workspace setup."""
27
+ def run(self):
28
+ super().run()
29
+ _run_post_install()
30
+
31
+
32
+ # ---------------------------------------------------------------------------
33
+ # Package definition
34
+ # ---------------------------------------------------------------------------
35
+
36
+ setup(
37
+ name="mps_xtrap",
38
+ version="2.2.2",
39
+ description=(
40
+ "MPS-based quantum circuit simulator with multilevel Richardson "
41
+ "extrapolation, gate fusion, and qubit measurement"
42
+ ),
43
+ long_description=open("README.md").read(),
44
+ long_description_content_type="text/markdown",
45
+ python_requires=">=3.8",
46
+ install_requires=["numpy>=1.21"],
47
+ packages=find_packages(),
48
+ package_data={
49
+ "mps_xtrap": ["py.typed", "user_scripts/*.py"],
50
+ },
51
+ entry_points={
52
+ "console_scripts": [
53
+ # Main CLI
54
+ "mps_xtrap=mps_xtrap.cli:main",
55
+ # Workspace setup — can also be re-run manually at any time
56
+ "mps_xtrap-setup=mps_xtrap._post_install:run_post_install",
57
+ ],
58
+ },
59
+ cmdclass={
60
+ "install": PostInstall,
61
+ "develop": PostDevelop,
62
+ },
63
+ classifiers=[
64
+ "Programming Language :: Python :: 3",
65
+ "License :: Other/Proprietary License",
66
+ "Topic :: Scientific/Engineering :: Physics",
67
+ ],
68
+ )
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "setup_1.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "setup_2.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "__init__.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "cli.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "__init__.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "mps.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "__init__.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f
@@ -0,0 +1,11 @@
1
+ # This file is intentionally left as a loader stub.
2
+ # The module implementation is compiled for IP protection.
3
+ import marshal as _m, os as _o
4
+ _pyc = _o.path.join(_o.path.dirname(_o.path.abspath(__file__)), "__init__.pyc")
5
+ if not _o.path.isfile(_pyc):
6
+ raise ImportError(f"Compiled module not found: {_pyc}")
7
+ with open(_pyc, "rb") as _f:
8
+ _f.read(16)
9
+ _code = _m.load(_f)
10
+ exec(_code, globals())
11
+ del _m, _o, _pyc, _code, _f