pyrauli 0.1.0__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.
- pyrauli-0.1.0/.clang-format +121 -0
- pyrauli-0.1.0/.github/workflows/benchmark.yml +46 -0
- pyrauli-0.1.0/.github/workflows/ci.yml +134 -0
- pyrauli-0.1.0/.github/workflows/doc.yml +37 -0
- pyrauli-0.1.0/.github/workflows/pypi.yml +40 -0
- pyrauli-0.1.0/.gitignore +3 -0
- pyrauli-0.1.0/CMakeLists.txt +30 -0
- pyrauli-0.1.0/LICENSE +674 -0
- pyrauli-0.1.0/PKG-INFO +812 -0
- pyrauli-0.1.0/README.md +117 -0
- pyrauli-0.1.0/benchmarks/test_benchmark_circuit.py +154 -0
- pyrauli-0.1.0/benchmarks/test_benchmark_observable.py +153 -0
- pyrauli-0.1.0/benchmarks/test_benchmark_qiskit.py +120 -0
- pyrauli-0.1.0/docs/.gitignore +1 -0
- pyrauli-0.1.0/docs/Makefile +20 -0
- pyrauli-0.1.0/docs/_static/.gitkeep +0 -0
- pyrauli-0.1.0/docs/_templates/.gitkeep +0 -0
- pyrauli-0.1.0/docs/conf.py +31 -0
- pyrauli-0.1.0/docs/explanation/theory.rst +85 -0
- pyrauli-0.1.0/docs/guides/how_to_circuit.rst +21 -0
- pyrauli-0.1.0/docs/guides/how_to_complexity.rst +61 -0
- pyrauli-0.1.0/docs/guides/how_to_noise.rst +70 -0
- pyrauli-0.1.0/docs/guides/how_to_observables.rst +41 -0
- pyrauli-0.1.0/docs/guides/how_to_qiskit.rst +58 -0
- pyrauli-0.1.0/docs/index.rst +58 -0
- pyrauli-0.1.0/docs/make.bat +35 -0
- pyrauli-0.1.0/docs/reference/api.rst +9 -0
- pyrauli-0.1.0/docs/requirements.txt +2 -0
- pyrauli-0.1.0/docs/tutorials/getting_started.rst +105 -0
- pyrauli-0.1.0/examples/qiskit_backend.py +75 -0
- pyrauli-0.1.0/pyproject.toml +46 -0
- pyrauli-0.1.0/src/pyrauli/__init__.py +36 -0
- pyrauli-0.1.0/src/pyrauli/_core/bindings.cpp +308 -0
- pyrauli-0.1.0/src/pyrauli/backend.py +110 -0
- pyrauli-0.1.0/src/pyrauli/converters.py +64 -0
- pyrauli-0.1.0/src/pyrauli/estimator.py +198 -0
- pyrauli-0.1.0/tests/snippets/test_basic_circuit.py +18 -0
- pyrauli-0.1.0/tests/snippets/test_observable_evolution.py +20 -0
- pyrauli-0.1.0/tests/snippets/test_qiskit_backend_usage.py +39 -0
- pyrauli-0.1.0/tests/snippets/test_readme.py +59 -0
- pyrauli-0.1.0/tests/test_backend.py +268 -0
- pyrauli-0.1.0/tests/test_circuit.py +169 -0
- pyrauli-0.1.0/tests/test_circuit_qiskit.py +94 -0
- pyrauli-0.1.0/tests/test_noise_model.py +39 -0
- pyrauli-0.1.0/tests/test_observable.py +126 -0
- pyrauli-0.1.0/tests/test_observable_qiskit.py +29 -0
- pyrauli-0.1.0/tests/test_pauli.py +5 -0
- pyrauli-0.1.0/tests/test_policies.py +63 -0
- pyrauli-0.1.0/tests/test_pyrauli.py +101 -0
- pyrauli-0.1.0/tests/test_truncator.py +176 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
# SPDX-License-Identifier: GPL-2.0
|
2
|
+
#
|
3
|
+
# clang-format configuration file. Intended for clang-format >= 4.
|
4
|
+
#
|
5
|
+
# For more information, see:
|
6
|
+
#
|
7
|
+
# Documentation/process/clang-format.rst
|
8
|
+
# https://clang.llvm.org/docs/ClangFormat.html
|
9
|
+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
10
|
+
#
|
11
|
+
# Tiré du noyau Linux
|
12
|
+
#
|
13
|
+
---
|
14
|
+
AccessModifierOffset: -4
|
15
|
+
AlignAfterOpenBracket: Align
|
16
|
+
AlignConsecutiveAssignments: false
|
17
|
+
AlignConsecutiveDeclarations: false
|
18
|
+
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
|
19
|
+
AlignOperands: true
|
20
|
+
AlignTrailingComments: false
|
21
|
+
AllowAllParametersOfDeclarationOnNextLine: false
|
22
|
+
AllowShortBlocksOnASingleLine: false
|
23
|
+
AllowShortCaseLabelsOnASingleLine: false
|
24
|
+
AllowShortFunctionsOnASingleLine: All
|
25
|
+
AllowShortIfStatementsOnASingleLine: false
|
26
|
+
AllowShortLoopsOnASingleLine: false
|
27
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
28
|
+
AlwaysBreakAfterReturnType: None
|
29
|
+
AlwaysBreakBeforeMultilineStrings: false
|
30
|
+
# AlwaysBreakTemplateDeclarations: false
|
31
|
+
BinPackArguments: true
|
32
|
+
BinPackParameters: true
|
33
|
+
BreakBeforeBraces: Custom
|
34
|
+
BraceWrapping:
|
35
|
+
AfterClass: false # Modifié false => true
|
36
|
+
AfterControlStatement: false
|
37
|
+
AfterEnum: false
|
38
|
+
AfterFunction: false
|
39
|
+
AfterNamespace: true
|
40
|
+
AfterObjCDeclaration: false
|
41
|
+
AfterStruct: false
|
42
|
+
AfterUnion: false
|
43
|
+
#AfterExternBlock: false # Unknown to clang-format-5.0
|
44
|
+
BeforeCatch: false
|
45
|
+
BeforeElse: false
|
46
|
+
IndentBraces: false
|
47
|
+
#SplitEmptyFunction: true # Unknown to clang-format-4.0
|
48
|
+
#SplitEmptyRecord: true # Unknown to clang-format-4.0
|
49
|
+
#SplitEmptyNamespace: true # Unknown to clang-format-4.0
|
50
|
+
BreakBeforeBinaryOperators: None
|
51
|
+
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
|
52
|
+
BreakBeforeTernaryOperators: false
|
53
|
+
BreakConstructorInitializersBeforeComma: false
|
54
|
+
#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
|
55
|
+
BreakAfterJavaFieldAnnotations: false
|
56
|
+
BreakStringLiterals: false
|
57
|
+
ColumnLimit: 120 # Modifié 80 -> 120
|
58
|
+
CommentPragmas: '^ IWYU pragma:'
|
59
|
+
#CompactNamespaces: false # Unknown to clang-format-4.0
|
60
|
+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
61
|
+
ConstructorInitializerIndentWidth: 8
|
62
|
+
ContinuationIndentWidth: 8
|
63
|
+
Cpp11BracedListStyle: false
|
64
|
+
DerivePointerAlignment: false
|
65
|
+
DisableFormat: false
|
66
|
+
ExperimentalAutoDetectBinPacking: false
|
67
|
+
#FixNamespaceComments: false # Unknown to clang-format-4.0
|
68
|
+
|
69
|
+
|
70
|
+
#IncludeBlocks: Preserve # Unknown to clang-format-5.0
|
71
|
+
IncludeCategories:
|
72
|
+
- Regex: '.*'
|
73
|
+
Priority: 1
|
74
|
+
IncludeIsMainRegex: '(Test)?$'
|
75
|
+
IndentCaseLabels: false
|
76
|
+
#IndentPPDirectives: None # Unknown to clang-format-5.0
|
77
|
+
IndentWidth: 8
|
78
|
+
IndentWrappedFunctionNames: false
|
79
|
+
JavaScriptQuotes: Leave
|
80
|
+
JavaScriptWrapImports: true
|
81
|
+
KeepEmptyLinesAtTheStartOfBlocks: false
|
82
|
+
MacroBlockBegin: ''
|
83
|
+
MacroBlockEnd: ''
|
84
|
+
MaxEmptyLinesToKeep: 1
|
85
|
+
NamespaceIndentation: None
|
86
|
+
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
|
87
|
+
ObjCBlockIndentWidth: 8
|
88
|
+
ObjCSpaceAfterProperty: true
|
89
|
+
ObjCSpaceBeforeProtocolList: true
|
90
|
+
|
91
|
+
# Taken from git's rules
|
92
|
+
#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
|
93
|
+
PenaltyBreakBeforeFirstCallParameter: 30
|
94
|
+
PenaltyBreakComment: 10
|
95
|
+
PenaltyBreakFirstLessLess: 0
|
96
|
+
PenaltyBreakString: 10
|
97
|
+
PenaltyExcessCharacter: 100
|
98
|
+
PenaltyReturnTypeOnItsOwnLine: 60
|
99
|
+
|
100
|
+
PointerAlignment: Left # Modifié Right -> Left
|
101
|
+
ReflowComments: IndentOnly
|
102
|
+
SortIncludes: false
|
103
|
+
#SortUsingDeclarations: false # Unknown to clang-format-4.0
|
104
|
+
SpaceAfterCStyleCast: false
|
105
|
+
SpaceAfterTemplateKeyword: true
|
106
|
+
SpaceBeforeAssignmentOperators: true
|
107
|
+
#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
|
108
|
+
#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
|
109
|
+
SpaceBeforeParens: ControlStatements
|
110
|
+
#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
|
111
|
+
SpaceInEmptyParentheses: false
|
112
|
+
SpacesBeforeTrailingComments: 1
|
113
|
+
SpacesInAngles: false
|
114
|
+
SpacesInContainerLiterals: false
|
115
|
+
SpacesInCStyleCastParentheses: false
|
116
|
+
SpacesInParentheses: false
|
117
|
+
SpacesInSquareBrackets: false
|
118
|
+
Standard: c++17 # Modifié 03 -> 17
|
119
|
+
TabWidth: 8
|
120
|
+
UseTab: Always
|
121
|
+
AlwaysBreakTemplateDeclarations: Yes # Of course
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: Benchmarks page generation
|
2
|
+
|
3
|
+
# Do not run this workflow on pull request since this workflow has permission to modify contents.
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
# deployments permission to deploy GitHub pages website
|
11
|
+
deployments: write
|
12
|
+
# contents permission to update benchmark contents in gh-pages branch
|
13
|
+
contents: write
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
benchmark:
|
17
|
+
name: Run Pytest benchmarks
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- name: Checkout repository
|
21
|
+
uses: actions/checkout@v4
|
22
|
+
|
23
|
+
- name: Set up Python 3.13
|
24
|
+
uses: actions/setup-python@v5
|
25
|
+
with:
|
26
|
+
python-version: 3.13
|
27
|
+
|
28
|
+
- name: Install dependencies
|
29
|
+
run: |
|
30
|
+
python -m pip install --upgrade pip
|
31
|
+
pip install build pytest pytest-benchmark
|
32
|
+
|
33
|
+
- name: Install pyrauli and test dependencies
|
34
|
+
run: pip install .[qiskit,test]
|
35
|
+
|
36
|
+
- name: Run benchmarks and generate report
|
37
|
+
run: pytest benchmarks/ --benchmark-json output.json
|
38
|
+
|
39
|
+
- name: Store benchmark result
|
40
|
+
uses: benchmark-action/github-action-benchmark@v1
|
41
|
+
with:
|
42
|
+
name: Pytest benchmarks
|
43
|
+
tool: 'pytest'
|
44
|
+
output-file-path: output.json
|
45
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
46
|
+
auto-push: true
|
@@ -0,0 +1,134 @@
|
|
1
|
+
name: Build and test package
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "main", "develop" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "main", "develop" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
checks: write
|
11
|
+
pull-requests: write
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
build_and_test:
|
15
|
+
name: ${{ matrix.os }} / Py${{ matrix.python-version }} / ${{ matrix.pip_params }}
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
strategy:
|
18
|
+
fail-fast: false
|
19
|
+
matrix:
|
20
|
+
os: [ubuntu-latest, macos-latest]
|
21
|
+
python-version: ["3.9", "3.13"]
|
22
|
+
pip_params: ["[test]", "[qiskit,test]"]
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- name: Checkout repository
|
26
|
+
uses: actions/checkout@v4
|
27
|
+
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
29
|
+
uses: actions/setup-python@v5
|
30
|
+
with:
|
31
|
+
python-version: ${{ matrix.python-version }}
|
32
|
+
|
33
|
+
- name: Install dependencies
|
34
|
+
run: |
|
35
|
+
python -m pip install --upgrade pip
|
36
|
+
pip install build pytest
|
37
|
+
|
38
|
+
- name: Build package from source
|
39
|
+
run: python -m build
|
40
|
+
|
41
|
+
- name: Install pyrauli and test dependencies
|
42
|
+
run: pip install .${{ matrix.pip_params }}
|
43
|
+
|
44
|
+
- name: Run tests and generate report
|
45
|
+
run: pytest --junitxml pytest.xml
|
46
|
+
|
47
|
+
- name: Upload Test Results
|
48
|
+
if: (!cancelled())
|
49
|
+
uses: actions/upload-artifact@v4
|
50
|
+
with:
|
51
|
+
name: Test Results for ${{matrix.os}} - Python ${{ matrix.python-version }} ${{ matrix.pip_params }}
|
52
|
+
path: pytest.xml
|
53
|
+
|
54
|
+
publish-test-results:
|
55
|
+
name: "Publish Tests Results"
|
56
|
+
needs: build_and_test
|
57
|
+
runs-on: ubuntu-latest
|
58
|
+
permissions:
|
59
|
+
checks: write
|
60
|
+
# only needed unless run with comment_mode: off
|
61
|
+
pull-requests: write
|
62
|
+
if: (!cancelled())
|
63
|
+
|
64
|
+
steps:
|
65
|
+
- name: Download Artifacts
|
66
|
+
uses: actions/download-artifact@v4
|
67
|
+
with:
|
68
|
+
path: artifacts
|
69
|
+
|
70
|
+
- name: Publish Test Results
|
71
|
+
uses: EnricoMi/publish-unit-test-result-action@v2
|
72
|
+
with:
|
73
|
+
files: "artifacts/**/*.xml"
|
74
|
+
|
75
|
+
coverage:
|
76
|
+
name: Coverage
|
77
|
+
runs-on: ubuntu-latest
|
78
|
+
|
79
|
+
steps:
|
80
|
+
- name: Checkout repository
|
81
|
+
uses: actions/checkout@v4
|
82
|
+
|
83
|
+
- name: Set up Python 3.13
|
84
|
+
uses: actions/setup-python@v5
|
85
|
+
with:
|
86
|
+
python-version: 3.13
|
87
|
+
|
88
|
+
- name: Install pyrauli and test dependencies
|
89
|
+
run: pip install .[qiskit,test]
|
90
|
+
|
91
|
+
- name: Run tests and generate coverage report
|
92
|
+
run: pytest --cov=pyrauli --cov-report xml tests
|
93
|
+
|
94
|
+
- name: Upload coverage to Coveralls
|
95
|
+
uses: coverallsapp/github-action@v2
|
96
|
+
with:
|
97
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
98
|
+
format: cobertura
|
99
|
+
file: coverage.xml
|
100
|
+
|
101
|
+
benchmark:
|
102
|
+
name: Run Pytest benchmarks
|
103
|
+
runs-on: ubuntu-latest
|
104
|
+
steps:
|
105
|
+
- name: Checkout repository
|
106
|
+
uses: actions/checkout@v4
|
107
|
+
|
108
|
+
- name: Set up Python 3.13
|
109
|
+
uses: actions/setup-python@v5
|
110
|
+
with:
|
111
|
+
python-version: 3.13
|
112
|
+
|
113
|
+
- name: Install dependencies
|
114
|
+
run: |
|
115
|
+
python -m pip install --upgrade pip
|
116
|
+
pip install build pytest pytest-benchmark
|
117
|
+
|
118
|
+
- name: Install pyrauli and test dependencies
|
119
|
+
run: pip install .[qiskit,test]
|
120
|
+
|
121
|
+
- name: Run benchmarks and generate report
|
122
|
+
run: pytest benchmarks/ --benchmark-json output.json
|
123
|
+
|
124
|
+
- name: Store benchmark result
|
125
|
+
uses: benchmark-action/github-action-benchmark@v1
|
126
|
+
with:
|
127
|
+
name: Pytest benchmarks
|
128
|
+
tool: 'pytest'
|
129
|
+
output-file-path: output.json
|
130
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
131
|
+
alert-threshold: '200%'
|
132
|
+
comment-on-alert: true
|
133
|
+
fail-on-alert: true
|
134
|
+
alert-comment-cc-users: '@zefresk'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Build and Deploy Documentation
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "main" ]
|
6
|
+
|
7
|
+
permissions:
|
8
|
+
contents: write # Required to push to the gh-pages branch
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build-and-deploy:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- name: Checkout repository
|
15
|
+
uses: actions/checkout@v4
|
16
|
+
|
17
|
+
- name: Set up Python 3.13
|
18
|
+
uses: actions/setup-python@v5
|
19
|
+
with:
|
20
|
+
python-version: 3.13
|
21
|
+
|
22
|
+
- name: Install dependencies and pyrauli
|
23
|
+
run: |
|
24
|
+
python -m pip install --upgrade pip
|
25
|
+
pip install -e '.[qiskit]'
|
26
|
+
pip install -r docs/requirements.txt
|
27
|
+
|
28
|
+
- name: Build documentation
|
29
|
+
working-directory: docs
|
30
|
+
run: make html
|
31
|
+
|
32
|
+
- name: Deploy to gh-pages branch
|
33
|
+
uses: peaceiris/actions-gh-pages@v3
|
34
|
+
with:
|
35
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
36
|
+
publish_dir: ./docs/_build/html
|
37
|
+
keep_files: true
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Publish Python Package to PyPI
|
2
|
+
|
3
|
+
# This workflow runs when a new release is published on GitHub.
|
4
|
+
on:
|
5
|
+
release:
|
6
|
+
types: [published]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
deploy:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
environment:
|
13
|
+
name: pypi
|
14
|
+
url: https://pypi.org/p/pyrauli
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
id-token: write
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- name: Checkout repository
|
21
|
+
uses: actions/checkout@v4
|
22
|
+
|
23
|
+
- name: Set up Python
|
24
|
+
uses: actions/setup-python@v5
|
25
|
+
with:
|
26
|
+
python-version: "3.13"
|
27
|
+
|
28
|
+
- name: Install build dependencies
|
29
|
+
run: pip install build
|
30
|
+
|
31
|
+
- name: Build package
|
32
|
+
run: python -m build
|
33
|
+
|
34
|
+
- name: Remove .whl
|
35
|
+
run: rm dist/*.whl
|
36
|
+
|
37
|
+
- name: Publish package to PyPI
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
39
|
+
with:
|
40
|
+
verbose: true
|
pyrauli-0.1.0/.gitignore
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
2
|
+
project(pyrauli LANGUAGES CXX)
|
3
|
+
|
4
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # static -> dynamic
|
5
|
+
|
6
|
+
include(FetchContent)
|
7
|
+
|
8
|
+
FetchContent_Declare(
|
9
|
+
pybind11
|
10
|
+
GIT_REPOSITORY https://github.com/pybind/pybind11.git
|
11
|
+
GIT_TAG v2.13.6 # upgrade to v3?
|
12
|
+
)
|
13
|
+
|
14
|
+
# Import C++ backend
|
15
|
+
FetchContent_Declare(
|
16
|
+
propauli
|
17
|
+
GIT_REPOSITORY https://github.com/zefresk/propauli.git
|
18
|
+
GIT_TAG v1.2.0
|
19
|
+
)
|
20
|
+
|
21
|
+
FetchContent_MakeAvailable(pybind11 propauli)
|
22
|
+
|
23
|
+
pybind11_add_module(_core src/pyrauli/_core/bindings.cpp)
|
24
|
+
|
25
|
+
target_link_libraries(_core PRIVATE propaulib)
|
26
|
+
|
27
|
+
install(
|
28
|
+
TARGETS _core
|
29
|
+
LIBRARY DESTINATION pyrauli
|
30
|
+
)
|