pyjuno 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.
- pyjuno-0.1.0/.clang-format +113 -0
- pyjuno-0.1.0/.github/release.yml +12 -0
- pyjuno-0.1.0/.github/workflows/build-wheels.yml +49 -0
- pyjuno-0.1.0/.github/workflows/python-publish.yml +52 -0
- pyjuno-0.1.0/.github/workflows/run-tests.yml +34 -0
- pyjuno-0.1.0/.github/workflows/semantic-pr-titles.yml +19 -0
- pyjuno-0.1.0/.gitignore +180 -0
- pyjuno-0.1.0/.pre-commit-config.yaml +41 -0
- pyjuno-0.1.0/CONTRIBUTION.md +45 -0
- pyjuno-0.1.0/LICENSE +28 -0
- pyjuno-0.1.0/PKG-INFO +106 -0
- pyjuno-0.1.0/README.md +81 -0
- pyjuno-0.1.0/cpp/CMakeLists.txt +33 -0
- pyjuno-0.1.0/cpp/mod.cc +102 -0
- pyjuno-0.1.0/pyjuno/__init__.py +3 -0
- pyjuno-0.1.0/pyjuno/_version.py +24 -0
- pyjuno-0.1.0/pyjuno/junoio.py +295 -0
- pyjuno-0.1.0/pyjuno/pyjuno_cpp.pyi +10 -0
- pyjuno-0.1.0/pyproject.toml +62 -0
- pyjuno-0.1.0/tests/conftest.py +22 -0
- pyjuno-0.1.0/tests/data/detsim.root +0 -0
- pyjuno-0.1.0/tests/test_junoio.py +71 -0
- pyjuno-0.1.0/uv.lock +1842 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Language: Cpp
|
|
2
|
+
BasedOnStyle: Google
|
|
3
|
+
AccessModifierOffset: -2
|
|
4
|
+
AlignAfterOpenBracket: Align
|
|
5
|
+
AlignConsecutiveAssignments: true
|
|
6
|
+
AlignConsecutiveDeclarations: false
|
|
7
|
+
AlignEscapedNewlines: Right
|
|
8
|
+
AlignOperands: true
|
|
9
|
+
AlignTrailingComments: true
|
|
10
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
|
11
|
+
AllowShortBlocksOnASingleLine: Always
|
|
12
|
+
AllowShortCaseLabelsOnASingleLine: true
|
|
13
|
+
AllowShortFunctionsOnASingleLine: All
|
|
14
|
+
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
|
15
|
+
AllowShortLoopsOnASingleLine: true
|
|
16
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
|
17
|
+
AlwaysBreakAfterReturnType: None
|
|
18
|
+
AlwaysBreakBeforeMultilineStrings: false
|
|
19
|
+
AlwaysBreakTemplateDeclarations: true
|
|
20
|
+
BinPackArguments: true
|
|
21
|
+
BinPackParameters: true
|
|
22
|
+
BraceWrapping:
|
|
23
|
+
AfterClass: false
|
|
24
|
+
AfterControlStatement: true
|
|
25
|
+
AfterEnum: false
|
|
26
|
+
AfterFunction: false
|
|
27
|
+
AfterNamespace: false
|
|
28
|
+
AfterObjCDeclaration: false
|
|
29
|
+
AfterStruct: false
|
|
30
|
+
AfterUnion: false
|
|
31
|
+
AfterExternBlock: false
|
|
32
|
+
BeforeCatch: false
|
|
33
|
+
BeforeElse: true
|
|
34
|
+
IndentBraces: false
|
|
35
|
+
SplitEmptyFunction: false
|
|
36
|
+
SplitEmptyRecord: false
|
|
37
|
+
SplitEmptyNamespace: false
|
|
38
|
+
BreakBeforeBinaryOperators: None
|
|
39
|
+
BreakBeforeBraces: Custom
|
|
40
|
+
BreakBeforeInheritanceComma: false
|
|
41
|
+
BreakBeforeTernaryOperators: true
|
|
42
|
+
BreakConstructorInitializersBeforeComma: true
|
|
43
|
+
BreakConstructorInitializers: BeforeComma
|
|
44
|
+
BreakAfterJavaFieldAnnotations: false
|
|
45
|
+
BreakStringLiterals: true
|
|
46
|
+
ColumnLimit: 95
|
|
47
|
+
CommentPragmas: '^ IWYU pragma:'
|
|
48
|
+
CompactNamespaces: false
|
|
49
|
+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
50
|
+
ConstructorInitializerIndentWidth: 4
|
|
51
|
+
ContinuationIndentWidth: 4
|
|
52
|
+
Cpp11BracedListStyle: true
|
|
53
|
+
DerivePointerAlignment: false
|
|
54
|
+
DisableFormat: false
|
|
55
|
+
ExperimentalAutoDetectBinPacking: false
|
|
56
|
+
FixNamespaceComments: true
|
|
57
|
+
ForEachMacros:
|
|
58
|
+
- foreach
|
|
59
|
+
- Q_FOREACH
|
|
60
|
+
- BOOST_FOREACH
|
|
61
|
+
IncludeBlocks: Preserve
|
|
62
|
+
IncludeCategories:
|
|
63
|
+
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
|
|
64
|
+
Priority: 2
|
|
65
|
+
- Regex: ^(<|"(gtest|gmock|isl|json)/)
|
|
66
|
+
Priority: 3
|
|
67
|
+
- Regex: .*
|
|
68
|
+
Priority: 1
|
|
69
|
+
IncludeIsMainRegex: (Test)?$
|
|
70
|
+
IndentCaseLabels: false
|
|
71
|
+
IndentPPDirectives: AfterHash
|
|
72
|
+
IndentWidth: 4
|
|
73
|
+
IndentWrappedFunctionNames: false
|
|
74
|
+
JavaScriptQuotes: Leave
|
|
75
|
+
JavaScriptWrapImports: true
|
|
76
|
+
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
77
|
+
MacroBlockBegin: ''
|
|
78
|
+
MacroBlockEnd: ''
|
|
79
|
+
MaxEmptyLinesToKeep: 1
|
|
80
|
+
NamespaceIndentation: All
|
|
81
|
+
ObjCBinPackProtocolList: Auto
|
|
82
|
+
ObjCBlockIndentWidth: 2
|
|
83
|
+
ObjCSpaceAfterProperty: false
|
|
84
|
+
ObjCSpaceBeforeProtocolList: true
|
|
85
|
+
PenaltyBreakAssignment: 2
|
|
86
|
+
PenaltyBreakBeforeFirstCallParameter: 19
|
|
87
|
+
PenaltyBreakComment: 60
|
|
88
|
+
PenaltyBreakFirstLessLess: 30
|
|
89
|
+
PenaltyBreakString: 1000
|
|
90
|
+
PenaltyBreakTemplateDeclaration: 10
|
|
91
|
+
PenaltyExcessCharacter: 1000000
|
|
92
|
+
PenaltyReturnTypeOnItsOwnLine: 60
|
|
93
|
+
PointerAlignment: Left
|
|
94
|
+
ReflowComments: true
|
|
95
|
+
SortIncludes: CaseSensitive
|
|
96
|
+
SortUsingDeclarations: true
|
|
97
|
+
SpaceAfterCStyleCast: false
|
|
98
|
+
SpaceAfterTemplateKeyword: true
|
|
99
|
+
SpaceBeforeAssignmentOperators: true
|
|
100
|
+
SpaceBeforeCpp11BracedList: false
|
|
101
|
+
SpaceBeforeCtorInitializerColon: true
|
|
102
|
+
SpaceBeforeInheritanceColon: true
|
|
103
|
+
SpaceBeforeParens: ControlStatements
|
|
104
|
+
SpaceBeforeRangeBasedForLoopColon: true
|
|
105
|
+
SpaceInEmptyParentheses: false
|
|
106
|
+
SpacesBeforeTrailingComments: 1
|
|
107
|
+
SpacesInAngles: false
|
|
108
|
+
SpacesInContainerLiterals: true
|
|
109
|
+
SpacesInCStyleCastParentheses: false
|
|
110
|
+
SpacesInParentheses: true
|
|
111
|
+
Standard: c++11
|
|
112
|
+
TabWidth: 8
|
|
113
|
+
UseTab: Never
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Build wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
run-tests:
|
|
9
|
+
uses: ./.github/workflows/run-tests.yml
|
|
10
|
+
|
|
11
|
+
build-wheels:
|
|
12
|
+
needs: run-tests
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
name: Build wheels on ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
|
+
|
|
22
|
+
- uses: actions/setup-python@v6
|
|
23
|
+
|
|
24
|
+
- name: Install cibuildwheel
|
|
25
|
+
run: pip install "cibuildwheel~=3.4"
|
|
26
|
+
|
|
27
|
+
- name: Build wheels
|
|
28
|
+
run: cibuildwheel --output-dir ./wheelhouse
|
|
29
|
+
|
|
30
|
+
- name: Upload distributions
|
|
31
|
+
uses: actions/upload-artifact@v7
|
|
32
|
+
with:
|
|
33
|
+
name: ci-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
34
|
+
path: ./wheelhouse/*.whl
|
|
35
|
+
|
|
36
|
+
build-sdist:
|
|
37
|
+
needs: run-tests
|
|
38
|
+
name: Build source distribution
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v6
|
|
42
|
+
|
|
43
|
+
- name: Build sdist
|
|
44
|
+
run: pipx run build --sdist
|
|
45
|
+
|
|
46
|
+
- uses: actions/upload-artifact@v7
|
|
47
|
+
with:
|
|
48
|
+
name: ci-sdist
|
|
49
|
+
path: dist/*.tar.gz
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build-wheels:
|
|
20
|
+
uses: ./.github/workflows/build-wheels.yml
|
|
21
|
+
|
|
22
|
+
pypi-publish:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
needs:
|
|
25
|
+
- build-wheels
|
|
26
|
+
permissions:
|
|
27
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
28
|
+
id-token: write
|
|
29
|
+
|
|
30
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
31
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
32
|
+
environment:
|
|
33
|
+
name: pypi
|
|
34
|
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
35
|
+
url: https://pypi.org/project/pyjuno
|
|
36
|
+
#
|
|
37
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
38
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
39
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- name: Retrieve release distributions
|
|
43
|
+
uses: actions/download-artifact@v8
|
|
44
|
+
with:
|
|
45
|
+
path: dist/
|
|
46
|
+
pattern: ci-*
|
|
47
|
+
merge-multiple: true
|
|
48
|
+
|
|
49
|
+
- name: Publish release distributions to PyPI
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
51
|
+
with:
|
|
52
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Run tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
workflow_call:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
run-pytest:
|
|
13
|
+
name: Test for ${{ matrix.os }}-${{ matrix.python-version }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- uses: astral-sh/setup-uv@v7
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
activate-environment: true
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
uv sync --only-group dev
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: |
|
|
34
|
+
uv run pytest -v tests/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Lint PR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- edited
|
|
8
|
+
- reopened
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
main:
|
|
12
|
+
name: Validate PR title
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
pull-requests: read
|
|
16
|
+
steps:
|
|
17
|
+
- uses: amannn/action-semantic-pull-request@v6
|
|
18
|
+
env:
|
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
pyjuno-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# VS Code
|
|
2
|
+
.vscode/
|
|
3
|
+
|
|
4
|
+
# scikit-build-core
|
|
5
|
+
_version.py
|
|
6
|
+
|
|
7
|
+
# cibuildwheel
|
|
8
|
+
wheelhouse/
|
|
9
|
+
|
|
10
|
+
# Byte-compiled / optimized / DLL files
|
|
11
|
+
__pycache__/
|
|
12
|
+
*.py[cod]
|
|
13
|
+
*$py.class
|
|
14
|
+
|
|
15
|
+
# C extensions
|
|
16
|
+
*.so
|
|
17
|
+
|
|
18
|
+
# Distribution / packaging
|
|
19
|
+
.Python
|
|
20
|
+
build/
|
|
21
|
+
develop-eggs/
|
|
22
|
+
dist/
|
|
23
|
+
downloads/
|
|
24
|
+
eggs/
|
|
25
|
+
.eggs/
|
|
26
|
+
lib/
|
|
27
|
+
lib64/
|
|
28
|
+
parts/
|
|
29
|
+
sdist/
|
|
30
|
+
var/
|
|
31
|
+
wheels/
|
|
32
|
+
share/python-wheels/
|
|
33
|
+
*.egg-info/
|
|
34
|
+
.installed.cfg
|
|
35
|
+
*.egg
|
|
36
|
+
MANIFEST
|
|
37
|
+
|
|
38
|
+
# PyInstaller
|
|
39
|
+
# Usually these files are written by a python script from a template
|
|
40
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
41
|
+
*.manifest
|
|
42
|
+
*.spec
|
|
43
|
+
|
|
44
|
+
# Installer logs
|
|
45
|
+
pip-log.txt
|
|
46
|
+
pip-delete-this-directory.txt
|
|
47
|
+
|
|
48
|
+
# Unit test / coverage reports
|
|
49
|
+
htmlcov/
|
|
50
|
+
.tox/
|
|
51
|
+
.nox/
|
|
52
|
+
.coverage
|
|
53
|
+
.coverage.*
|
|
54
|
+
.cache
|
|
55
|
+
nosetests.xml
|
|
56
|
+
coverage.xml
|
|
57
|
+
*.cover
|
|
58
|
+
*.py,cover
|
|
59
|
+
.hypothesis/
|
|
60
|
+
.pytest_cache/
|
|
61
|
+
cover/
|
|
62
|
+
|
|
63
|
+
# Translations
|
|
64
|
+
*.mo
|
|
65
|
+
*.pot
|
|
66
|
+
|
|
67
|
+
# Django stuff:
|
|
68
|
+
*.log
|
|
69
|
+
local_settings.py
|
|
70
|
+
db.sqlite3
|
|
71
|
+
db.sqlite3-journal
|
|
72
|
+
|
|
73
|
+
# Flask stuff:
|
|
74
|
+
instance/
|
|
75
|
+
.webassets-cache
|
|
76
|
+
|
|
77
|
+
# Scrapy stuff:
|
|
78
|
+
.scrapy
|
|
79
|
+
|
|
80
|
+
# Sphinx documentation
|
|
81
|
+
docs/_build/
|
|
82
|
+
|
|
83
|
+
# PyBuilder
|
|
84
|
+
.pybuilder/
|
|
85
|
+
target/
|
|
86
|
+
|
|
87
|
+
# Jupyter Notebook
|
|
88
|
+
.ipynb_checkpoints
|
|
89
|
+
|
|
90
|
+
# IPython
|
|
91
|
+
profile_default/
|
|
92
|
+
ipython_config.py
|
|
93
|
+
|
|
94
|
+
# pyenv
|
|
95
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
96
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
97
|
+
# .python-version
|
|
98
|
+
|
|
99
|
+
# pipenv
|
|
100
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
101
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
102
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
103
|
+
# install all needed dependencies.
|
|
104
|
+
#Pipfile.lock
|
|
105
|
+
|
|
106
|
+
# UV
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
108
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
109
|
+
# commonly ignored for libraries.
|
|
110
|
+
#uv.lock
|
|
111
|
+
|
|
112
|
+
# poetry
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
114
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
115
|
+
# commonly ignored for libraries.
|
|
116
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
117
|
+
#poetry.lock
|
|
118
|
+
|
|
119
|
+
# pdm
|
|
120
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
121
|
+
#pdm.lock
|
|
122
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
123
|
+
# in version control.
|
|
124
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
125
|
+
.pdm.toml
|
|
126
|
+
.pdm-python
|
|
127
|
+
.pdm-build/
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# SageMath parsed files
|
|
137
|
+
*.sage.py
|
|
138
|
+
|
|
139
|
+
# Environments
|
|
140
|
+
.env
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
#.idea/
|
|
178
|
+
|
|
179
|
+
# PyPI configuration file
|
|
180
|
+
.pypirc
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore: update pre-commit hooks"
|
|
3
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
4
|
+
autoupdate_schedule: monthly
|
|
5
|
+
|
|
6
|
+
repos:
|
|
7
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
+
rev: v6.0.0
|
|
9
|
+
hooks:
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
- id: check-case-conflict
|
|
12
|
+
- id: check-merge-conflict
|
|
13
|
+
- id: check-symlinks
|
|
14
|
+
- id: check-yaml
|
|
15
|
+
exclude: |
|
|
16
|
+
(?x)^(
|
|
17
|
+
mkdocs\.yml|
|
|
18
|
+
\.clang-format
|
|
19
|
+
)
|
|
20
|
+
- id: debug-statements
|
|
21
|
+
- id: end-of-file-fixer
|
|
22
|
+
- id: mixed-line-ending
|
|
23
|
+
- id: requirements-txt-fixer
|
|
24
|
+
- id: trailing-whitespace
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
27
|
+
rev: 26.1.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: black
|
|
30
|
+
|
|
31
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
32
|
+
rev: v0.15.4
|
|
33
|
+
hooks:
|
|
34
|
+
- id: ruff-check
|
|
35
|
+
args: [--fix, --show-fixes]
|
|
36
|
+
|
|
37
|
+
- repo: https://github.com/pre-commit/mirrors-clang-format
|
|
38
|
+
rev: v22.1.0
|
|
39
|
+
hooks:
|
|
40
|
+
- id: clang-format
|
|
41
|
+
types_or: [c++, c]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## Development environment setup
|
|
2
|
+
|
|
3
|
+
### Step 1: Install uv
|
|
4
|
+
|
|
5
|
+
For macOS and Linux, run:
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For Windows, run:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> [!TIP]
|
|
18
|
+
> You can refer [this link](https://docs.astral.sh/uv/getting-started/installation/) to install `uv`.
|
|
19
|
+
|
|
20
|
+
### Step 2: Create and setup virtual environment
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
python3 -m venv .venv
|
|
24
|
+
source .venv/bin/activate
|
|
25
|
+
uv sync
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> [!TIP]
|
|
29
|
+
> If the synchronization is too slow, you can run `export UV_DEFAULT_INDEX="https://pypi.tuna.tsinghua.edu.cn/simple"` to change the download mirror.
|
|
30
|
+
|
|
31
|
+
### Step 3: Setup pre-commit
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
pre-commit install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This may take several minutes. It downloads hooks from github repositories.
|
|
38
|
+
|
|
39
|
+
## Rebuild pyjuno when C++ files are modified
|
|
40
|
+
|
|
41
|
+
Every time you modify the C++ files, run following commands to rebuild the project:
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
uv pip install -e .
|
|
45
|
+
```
|
pyjuno-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Mingrun Li
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
pyjuno-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: pyjuno
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Standalone Python module for JUNO
|
|
5
|
+
Author-Email: Mingrun Li <mrli@ihep.ac.cn>
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: C++
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: <3.14,>=3.9
|
|
20
|
+
Requires-Dist: uproot>=5.6.8
|
|
21
|
+
Requires-Dist: awkward
|
|
22
|
+
Requires-Dist: uproot-custom==2.3.*
|
|
23
|
+
Requires-Dist: numba
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# pyjuno
|
|
27
|
+
|
|
28
|
+
Pyjuno is a Python package that helps JUNO users analyzing data more easily. The core functionality of pyjuno is its JUNO-specific format data reading.
|
|
29
|
+
|
|
30
|
+
> [!WARNING]
|
|
31
|
+
> This package is still under developing.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install pyjuno
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> [!TIP]
|
|
40
|
+
> If you are working on IHEP computing nodes (lxlogin server), it is recommended to move `~/.local` and `~/.cache` to somewhere else, in case of the installation reaches your disk quota in `/afs` file system.
|
|
41
|
+
|
|
42
|
+
## JUNO format data reading
|
|
43
|
+
|
|
44
|
+
Basing on [Uproot](https://uproot.readthedocs.io/), [uproot-custom](https://mrzimu.github.io/uproot-custom/index.html) and [awkward-array](https://awkward-array.org/doc/main/user-guide/index.html), pyjuno can read most of JUNO-specific data format without ROOT or junosw environment.
|
|
45
|
+
|
|
46
|
+
### Standalone subevent reading
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
>>> import uproot
|
|
50
|
+
>>> import pyjuno # automatically register JUNO format to uproot
|
|
51
|
+
>>> f = uproot.open("rec.root")
|
|
52
|
+
>>> calib_pmt = f["Event/CdLpmtCalib/CdLpmtCalibEvt/m_calibPMTCol"].array()
|
|
53
|
+
>>> calib_pmt.show()
|
|
54
|
+
[[{m_nPE: 0.842, m_pmtId: 269619712, m_firstHitTime: 386, ...}, ..., {...}],
|
|
55
|
+
[{m_nPE: 0.427, m_pmtId: 269500928, m_firstHitTime: 433, ...}, ..., {...}],
|
|
56
|
+
[{m_nPE: 0.751, m_pmtId: 269500928, m_firstHitTime: 385, ...}, ..., {...}],
|
|
57
|
+
[{m_nPE: 1.04, m_pmtId: 269558272, m_firstHitTime: 387, ...}, ..., {...}],
|
|
58
|
+
[{m_nPE: 2.41, m_pmtId: 269500928, m_firstHitTime: 979, ...}, ..., {...}],
|
|
59
|
+
[{m_nPE: 3.9, m_pmtId: 269586944, m_firstHitTime: 899, ...}, ..., {...}],
|
|
60
|
+
[{m_nPE: 1.33, m_pmtId: 269615616, m_firstHitTime: 673, ...}, ..., {...}],
|
|
61
|
+
[{m_nPE: 0.539, m_pmtId: 269496832, m_firstHitTime: 401, ...}, ..., {...}],
|
|
62
|
+
[{m_nPE: 0.478, m_pmtId: 269554176, m_firstHitTime: 377, ...}, ..., {...}],
|
|
63
|
+
[{m_nPE: 0.554, m_pmtId: 269496832, m_firstHitTime: 389, ...}, ..., {...}]]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Assembling all subevents
|
|
67
|
+
|
|
68
|
+
In JUNO, subevents are not always present in one event. To assemble different subevent tree, a method `pyjuno.assemble_event` is provided:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
>>> import uproot
|
|
72
|
+
>>> import pyjuno # automatically register JUNO format to uproot
|
|
73
|
+
>>> f = uproot.open("rec.root")
|
|
74
|
+
>>> events = pyjuno.assemble_event(f)
|
|
75
|
+
>>> events.show()
|
|
76
|
+
[{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
77
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
78
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
79
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
80
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
81
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
82
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
83
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
84
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...},
|
|
85
|
+
{SimEvt: [{m_tracks: [{...}], ...}], CdLpmtElecTruthEvt: [[...]], ...}]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Reading all data from file at once could consume much memory. You can either read less events by specifying `entry_start` and `entry_stop` arguments, or only read necesarry subevents by passing `filter_path` argument:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
# Read a small batch of events
|
|
92
|
+
batch_events = pyjuno.assemble_event(f, entry_start=0, entry_stop=10)
|
|
93
|
+
|
|
94
|
+
# Read CdLpmtTruth and CdSpmtTruth
|
|
95
|
+
spec_events = pyjuno.assemble_event(f, filter_path=["/Event/CdLpmtTruth", "/Event/CdSpmtTruth"])
|
|
96
|
+
# or
|
|
97
|
+
spec_events = pyjuno.assemble_event(f, filter_path="*pmtTruth")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
> [!NOTE]
|
|
103
|
+
> At present, `GenEvent` is not supported to be read in Python, since it contains recursive data that awkward-array cannot handle.
|
|
104
|
+
|
|
105
|
+
> [!TIP]
|
|
106
|
+
> For frequently used data, it is more efficient to read it with pyjuno once, then use `ak.to_parquet` to save it in `parquet` format and use `ak.from_parquet` to read it back.
|