uproot-custom 2.1.0__tar.gz → 2.2.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.
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/.clang-format +37 -37
- uproot_custom-2.2.0/.github/workflows/build-wheels.yml +44 -0
- uproot_custom-2.2.0/.github/workflows/deploy-docs.yml +34 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/.github/workflows/semantic-pr-titles.yml +1 -1
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/.github/workflows/test-package.yml +10 -11
- uproot_custom-2.2.0/.github/workflows/weekly-build.yml +10 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/.gitignore +3 -3
- uproot_custom-2.2.0/.pre-commit-config.yaml +42 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/PKG-INFO +14 -30
- uproot_custom-2.2.0/README.md +53 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/cpp/CMakeLists.txt +1 -1
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/cpp/include/uproot-custom/uproot-custom.hh +3 -10
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/cpp/src/uproot-custom.cc +10 -8
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/conf.py +2 -4
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/example/override-streamer.md +10 -6
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/example/read-tobjarray.md +11 -7
- uproot_custom-2.2.0/docs/index.md +81 -0
- uproot_custom-2.2.0/docs/reference/api/.gitignore +2 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/reference/api/uproot-custom-ref.md +1 -1
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/reference/binary-format.md +5 -4
- uproot_custom-2.2.0/docs/reference/reader-backends.md +59 -0
- uproot_custom-2.2.0/docs/reference/version-requirements.md +42 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/customize-factory-reader/binary-data.md +10 -7
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/customize-factory-reader/bootstrap.md +50 -26
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/customize-factory-reader/reader-and-factory.md +15 -9
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/customize-factory-reader/streamer-info.md +5 -5
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/customize-factory-reader/template-python-project.md +16 -6
- uproot_custom-2.2.0/docs/tutorial/customize-factory-reader.md +33 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/tutorial/use-built-in.md +22 -18
- uproot_custom-2.2.0/pyproject.toml +86 -0
- uproot_custom-2.1.0/tests/test_AsCustom.py → uproot_custom-2.2.0/tests/conftest.py +21 -8
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/CMakeLists.txt +4 -7
- uproot_custom-2.2.0/tests/gen-test-data/README.md +24 -0
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/LinkDef.h +0 -3
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TBasicTypes.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TCStyleArray.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TComplicatedSTL.hh +0 -2
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TNestedSTL.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TRootObjects.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLArray.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLMapWithObj.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLSeqWithObj.hh +1 -1
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/src/main.cc +3 -14
- uproot_custom-2.2.0/tests/test-data.root +0 -0
- uproot_custom-2.2.0/tests/test_builtin_cpp.py +18 -0
- uproot_custom-2.2.0/tests/test_builtin_python.py +20 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/AsCustom.py +1 -1
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/__init__.py +21 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/_version.py +3 -3
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/cpp.pyi +7 -4
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/factories.py +144 -42
- uproot_custom-2.2.0/uproot_custom/readers/cpp.py +69 -0
- uproot_custom-2.2.0/uproot_custom/readers/python.py +867 -0
- uproot_custom-2.2.0/uproot_custom/share/cmake/__init__.py +0 -0
- uproot_custom-2.2.0/uv.lock +2693 -0
- uproot_custom-2.1.0/.github/workflows/build-wheels.yml +0 -44
- uproot_custom-2.1.0/.github/workflows/deploy-docs.yml +0 -36
- uproot_custom-2.1.0/README.md +0 -49
- uproot_custom-2.1.0/docs/index.md +0 -77
- uproot_custom-2.1.0/docs/reference/api/uproot_custom.rst +0 -37
- uproot_custom-2.1.0/docs/reference/version-requirements.md +0 -23
- uproot_custom-2.1.0/docs/tutorial/customize-factory-reader.md +0 -26
- uproot_custom-2.1.0/example/README.md +0 -83
- uproot_custom-2.1.0/example/cpp/CMakeLists.txt +0 -31
- uproot_custom-2.1.0/example/cpp/my_reader.cc +0 -80
- uproot_custom-2.1.0/example/gen-demo-data/include/TObjInObjArray.hh +0 -114
- uproot_custom-2.1.0/example/gen-demo-data/include/TOverrideStreamer.hh +0 -16
- uproot_custom-2.1.0/example/gen-demo-data/src/TOverrideStreamer.cc +0 -34
- uproot_custom-2.1.0/example/my_reader/OverrideStreamerFactory.py +0 -46
- uproot_custom-2.1.0/example/my_reader/TObjArrayFactory.py +0 -76
- uproot_custom-2.1.0/example/my_reader/__init__.py +0 -12
- uproot_custom-2.1.0/example/my_reader/my_reader_cpp.pyi +0 -11
- uproot_custom-2.1.0/example/pyproject.toml +0 -21
- uproot_custom-2.1.0/example/read-dask.py +0 -19
- uproot_custom-2.1.0/example/read-data.py +0 -26
- uproot_custom-2.1.0/pyproject.toml +0 -87
- uproot_custom-2.1.0/tests/conftest.py +0 -19
- uproot_custom-2.1.0/tests/test-data.root +0 -0
- uproot_custom-2.1.0/tests/test_docs.py +0 -15
- uproot_custom-2.1.0/tests/test_downstream_build.py +0 -38
- uproot_custom-2.1.0/tests/test_downstream_build_pyproject.toml +0 -24
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/.github/workflows/python-publish.yml +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/CHANGELOG.md +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/LICENSE +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/cpp/share/cmake/uproot-customConfig.cmake +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/Doxyfile +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/reference/api/cpp-api.md +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/reference/api/cpp-module.md +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/docs/reference/api.md +0 -0
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLMap.hh +0 -0
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLSequence.hh +0 -0
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSTLString.hh +0 -0
- {uproot_custom-2.1.0/example/gen-demo-data → uproot_custom-2.2.0/tests/gen-test-data}/include/TSimpleObject.hh +0 -0
- {uproot_custom-2.1.0/uproot_custom/share/cmake → uproot_custom-2.2.0/uproot_custom/readers}/__init__.py +0 -0
- {uproot_custom-2.1.0 → uproot_custom-2.2.0}/uproot_custom/utils.py +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
---
|
|
1
2
|
# This .clang_format file is derectly copied from Gaudi project.
|
|
2
3
|
---
|
|
3
|
-
Language:
|
|
4
|
-
BasedOnStyle:
|
|
4
|
+
Language: Cpp
|
|
5
|
+
BasedOnStyle: Google
|
|
5
6
|
AccessModifierOffset: -2
|
|
6
7
|
AlignAfterOpenBracket: Align
|
|
7
8
|
AlignConsecutiveAssignments: true
|
|
8
9
|
AlignConsecutiveDeclarations: false
|
|
9
10
|
AlignEscapedNewlines: Right
|
|
10
|
-
AlignOperands:
|
|
11
|
+
AlignOperands: true
|
|
11
12
|
AlignTrailingComments: true
|
|
12
13
|
AllowAllParametersOfDeclarationOnNextLine: true
|
|
13
14
|
AllowShortBlocksOnASingleLine: Always
|
|
@@ -22,18 +23,18 @@ AlwaysBreakTemplateDeclarations: true
|
|
|
22
23
|
BinPackArguments: true
|
|
23
24
|
BinPackParameters: true
|
|
24
25
|
BraceWrapping:
|
|
25
|
-
AfterClass:
|
|
26
|
+
AfterClass: false
|
|
26
27
|
AfterControlStatement: true
|
|
27
|
-
AfterEnum:
|
|
28
|
-
AfterFunction:
|
|
29
|
-
AfterNamespace:
|
|
28
|
+
AfterEnum: false
|
|
29
|
+
AfterFunction: false
|
|
30
|
+
AfterNamespace: false
|
|
30
31
|
AfterObjCDeclaration: false
|
|
31
|
-
AfterStruct:
|
|
32
|
-
AfterUnion:
|
|
32
|
+
AfterStruct: false
|
|
33
|
+
AfterUnion: false
|
|
33
34
|
AfterExternBlock: false
|
|
34
|
-
BeforeCatch:
|
|
35
|
-
BeforeElse:
|
|
36
|
-
IndentBraces:
|
|
35
|
+
BeforeCatch: false
|
|
36
|
+
BeforeElse: true
|
|
37
|
+
IndentBraces: false
|
|
37
38
|
SplitEmptyFunction: false
|
|
38
39
|
SplitEmptyRecord: false
|
|
39
40
|
SplitEmptyNamespace: false
|
|
@@ -45,39 +46,39 @@ BreakConstructorInitializersBeforeComma: true
|
|
|
45
46
|
BreakConstructorInitializers: BeforeComma
|
|
46
47
|
BreakAfterJavaFieldAnnotations: false
|
|
47
48
|
BreakStringLiterals: true
|
|
48
|
-
ColumnLimit:
|
|
49
|
-
CommentPragmas:
|
|
49
|
+
ColumnLimit: 95
|
|
50
|
+
CommentPragmas: '^ IWYU pragma:'
|
|
50
51
|
CompactNamespaces: false
|
|
51
52
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
52
53
|
ConstructorInitializerIndentWidth: 4
|
|
53
54
|
ContinuationIndentWidth: 4
|
|
54
55
|
Cpp11BracedListStyle: true
|
|
55
56
|
DerivePointerAlignment: false
|
|
56
|
-
DisableFormat:
|
|
57
|
+
DisableFormat: false
|
|
57
58
|
ExperimentalAutoDetectBinPacking: false
|
|
58
59
|
FixNamespaceComments: true
|
|
59
60
|
ForEachMacros:
|
|
60
61
|
- foreach
|
|
61
62
|
- Q_FOREACH
|
|
62
63
|
- BOOST_FOREACH
|
|
63
|
-
IncludeBlocks:
|
|
64
|
+
IncludeBlocks: Preserve
|
|
64
65
|
IncludeCategories:
|
|
65
|
-
- Regex:
|
|
66
|
-
Priority:
|
|
67
|
-
- Regex:
|
|
68
|
-
Priority:
|
|
69
|
-
- Regex:
|
|
70
|
-
Priority:
|
|
71
|
-
IncludeIsMainRegex:
|
|
66
|
+
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
|
|
67
|
+
Priority: 2
|
|
68
|
+
- Regex: ^(<|"(gtest|gmock|isl|json)/)
|
|
69
|
+
Priority: 3
|
|
70
|
+
- Regex: .*
|
|
71
|
+
Priority: 1
|
|
72
|
+
IncludeIsMainRegex: (Test)?$
|
|
72
73
|
IndentCaseLabels: false
|
|
73
74
|
IndentPPDirectives: AfterHash
|
|
74
|
-
IndentWidth:
|
|
75
|
+
IndentWidth: 4
|
|
75
76
|
IndentWrappedFunctionNames: false
|
|
76
77
|
JavaScriptQuotes: Leave
|
|
77
78
|
JavaScriptWrapImports: true
|
|
78
79
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
79
80
|
MacroBlockBegin: ''
|
|
80
|
-
MacroBlockEnd:
|
|
81
|
+
MacroBlockEnd: ''
|
|
81
82
|
MaxEmptyLinesToKeep: 1
|
|
82
83
|
NamespaceIndentation: All
|
|
83
84
|
ObjCBinPackProtocolList: Auto
|
|
@@ -93,8 +94,8 @@ PenaltyBreakTemplateDeclaration: 10
|
|
|
93
94
|
PenaltyExcessCharacter: 1000000
|
|
94
95
|
PenaltyReturnTypeOnItsOwnLine: 60
|
|
95
96
|
PointerAlignment: Left
|
|
96
|
-
ReflowComments:
|
|
97
|
-
SortIncludes:
|
|
97
|
+
ReflowComments: true
|
|
98
|
+
SortIncludes: CaseSensitive
|
|
98
99
|
SortUsingDeclarations: true
|
|
99
100
|
SpaceAfterCStyleCast: false
|
|
100
101
|
SpaceAfterTemplateKeyword: true
|
|
@@ -106,22 +107,21 @@ SpaceBeforeParens: ControlStatements
|
|
|
106
107
|
SpaceBeforeRangeBasedForLoopColon: true
|
|
107
108
|
SpaceInEmptyParentheses: false
|
|
108
109
|
SpacesBeforeTrailingComments: 1
|
|
109
|
-
SpacesInAngles:
|
|
110
|
+
SpacesInAngles: false
|
|
110
111
|
SpacesInContainerLiterals: true
|
|
111
112
|
SpacesInCStyleCastParentheses: false
|
|
112
113
|
SpacesInParentheses: true
|
|
113
|
-
Standard:
|
|
114
|
-
TabWidth:
|
|
115
|
-
UseTab:
|
|
114
|
+
Standard: c++11
|
|
115
|
+
TabWidth: 8
|
|
116
|
+
UseTab: Never
|
|
116
117
|
---
|
|
117
|
-
Language:
|
|
118
|
-
IndentWidth:
|
|
119
|
-
ColumnLimit:
|
|
118
|
+
Language: Json
|
|
119
|
+
IndentWidth: 4
|
|
120
|
+
ColumnLimit: 95
|
|
120
121
|
---
|
|
121
|
-
Language:
|
|
122
|
-
ColumnLimit:
|
|
122
|
+
Language: JavaScript
|
|
123
|
+
ColumnLimit: 95
|
|
123
124
|
---
|
|
124
125
|
Language: ObjC
|
|
125
126
|
# Don't format Objective-C, Objective-C++ files.
|
|
126
127
|
DisableFormat: true
|
|
127
|
-
...
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Build wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test-package:
|
|
9
|
+
uses: ./.github/workflows/test-package.yml
|
|
10
|
+
|
|
11
|
+
build-wheels:
|
|
12
|
+
needs: test-package
|
|
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@v4
|
|
21
|
+
|
|
22
|
+
- name: Build wheels
|
|
23
|
+
uses: pypa/cibuildwheel@v3.1.3
|
|
24
|
+
|
|
25
|
+
- name: Upload distributions
|
|
26
|
+
uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: ci-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
29
|
+
path: ./wheelhouse/*.whl
|
|
30
|
+
|
|
31
|
+
build-sdist:
|
|
32
|
+
needs: test-package
|
|
33
|
+
name: Build source distribution
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
|
|
38
|
+
- name: Build sdist
|
|
39
|
+
run: pipx run build --sdist
|
|
40
|
+
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: ci-sdist
|
|
44
|
+
path: dist/*.tar.gz
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Deploy docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
deploy-docs:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: astral-sh/setup-uv@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: '3.13'
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: |
|
|
22
|
+
sudo apt-get update
|
|
23
|
+
sudo apt-get install -y doxygen
|
|
24
|
+
uv sync --group=docs
|
|
25
|
+
|
|
26
|
+
- name: Build docs
|
|
27
|
+
run: |
|
|
28
|
+
sphinx-build -b html docs/ build/html
|
|
29
|
+
|
|
30
|
+
- name: Deploy to GitHub Pages
|
|
31
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
32
|
+
with:
|
|
33
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
34
|
+
publish_dir: ./build/html
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Test package
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -16,20 +16,20 @@ jobs:
|
|
|
16
16
|
runs-on: ${{ matrix.os }}
|
|
17
17
|
strategy:
|
|
18
18
|
matrix:
|
|
19
|
-
python-version: [
|
|
20
|
-
os: [
|
|
19
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
|
20
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
21
21
|
|
|
22
22
|
steps:
|
|
23
23
|
- uses: actions/checkout@v4
|
|
24
24
|
|
|
25
|
-
- uses:
|
|
25
|
+
- uses: astral-sh/setup-uv@v5
|
|
26
26
|
with:
|
|
27
27
|
python-version: ${{ matrix.python-version }}
|
|
28
28
|
|
|
29
29
|
- name: Install dependencies
|
|
30
30
|
run: |
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
uv lock --upgrade
|
|
32
|
+
uv sync --all-extras
|
|
33
33
|
|
|
34
34
|
- name: Run pytest
|
|
35
35
|
run: |
|
|
@@ -41,17 +41,16 @@ jobs:
|
|
|
41
41
|
steps:
|
|
42
42
|
- uses: actions/checkout@v4
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
uses: actions/setup-python@v4
|
|
44
|
+
- uses: astral-sh/setup-uv@v5
|
|
46
45
|
with:
|
|
47
|
-
python-version:
|
|
46
|
+
python-version: '3.13'
|
|
48
47
|
|
|
49
48
|
- name: Install dependencies
|
|
50
49
|
run: |
|
|
51
|
-
python -m pip install --upgrade pip
|
|
52
|
-
pip install .[docs]
|
|
53
50
|
sudo apt-get update
|
|
54
51
|
sudo apt-get install -y doxygen
|
|
52
|
+
uv lock --upgrade
|
|
53
|
+
uv sync --all-extras
|
|
55
54
|
|
|
56
55
|
- name: Build docs
|
|
57
56
|
run: |
|
|
@@ -182,9 +182,9 @@ cython_debug/
|
|
|
182
182
|
.abstra/
|
|
183
183
|
|
|
184
184
|
# Visual Studio Code
|
|
185
|
-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
186
|
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
188
|
# you could uncomment the following to ignore the entire vscode folder
|
|
189
189
|
.vscode/
|
|
190
190
|
|
|
@@ -206,4 +206,4 @@ marimo/_static/
|
|
|
206
206
|
marimo/_lsp/
|
|
207
207
|
__marimo__/
|
|
208
208
|
|
|
209
|
-
_version.py
|
|
209
|
+
_version.py
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
\.clang-format
|
|
18
|
+
)
|
|
19
|
+
- id: debug-statements
|
|
20
|
+
- id: end-of-file-fixer
|
|
21
|
+
- id: mixed-line-ending
|
|
22
|
+
- id: requirements-txt-fixer
|
|
23
|
+
- id: trailing-whitespace
|
|
24
|
+
|
|
25
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
26
|
+
rev: 26.1.0
|
|
27
|
+
hooks:
|
|
28
|
+
- id: black
|
|
29
|
+
|
|
30
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
31
|
+
rev: v0.14.14
|
|
32
|
+
hooks:
|
|
33
|
+
- id: ruff-check
|
|
34
|
+
args: [--fix, --show-fixes]
|
|
35
|
+
|
|
36
|
+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
|
37
|
+
rev: v2.16.0
|
|
38
|
+
hooks:
|
|
39
|
+
- id: pretty-format-toml
|
|
40
|
+
args: [--autofix]
|
|
41
|
+
- id: pretty-format-yaml
|
|
42
|
+
args: [--autofix, --indent, '2', --offset, '2']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: uproot-custom
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: uproot extension for reading custom classes
|
|
5
5
|
Author-Email: Mingrun Li <mrli@ihep.ac.cn>
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -30,39 +30,23 @@ Requires-Python: <3.14,>=3.9
|
|
|
30
30
|
Requires-Dist: uproot>=5.6.7
|
|
31
31
|
Requires-Dist: numpy
|
|
32
32
|
Requires-Dist: awkward>=2.8.0
|
|
33
|
-
Provides-Extra: dev
|
|
34
|
-
Requires-Dist: pytest; extra == "dev"
|
|
35
|
-
Requires-Dist: pytest-xdist; extra == "dev"
|
|
36
|
-
Requires-Dist: dask[complete]; extra == "dev"
|
|
37
|
-
Requires-Dist: dask-awkward; extra == "dev"
|
|
38
|
-
Requires-Dist: build; extra == "dev"
|
|
39
|
-
Provides-Extra: docs
|
|
40
|
-
Requires-Dist: sphinx>=8.2; extra == "docs"
|
|
41
|
-
Requires-Dist: sphinx-book-theme; extra == "docs"
|
|
42
|
-
Requires-Dist: myst_parser; extra == "docs"
|
|
43
|
-
Requires-Dist: sphinx-design; extra == "docs"
|
|
44
|
-
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
45
|
-
Requires-Dist: sphinxext-rediraffe; extra == "docs"
|
|
46
|
-
Requires-Dist: sphinxext-opengraph; extra == "docs"
|
|
47
|
-
Requires-Dist: sphinx-tippy; extra == "docs"
|
|
48
|
-
Requires-Dist: sphinx-togglebutton; extra == "docs"
|
|
49
|
-
Requires-Dist: sphinxcontrib-mermaid; extra == "docs"
|
|
50
|
-
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
51
|
-
Requires-Dist: sphinx-intl; extra == "docs"
|
|
52
|
-
Requires-Dist: breathe; extra == "docs"
|
|
53
33
|
Description-Content-Type: text/markdown
|
|
54
34
|
|
|
55
35
|
# Introduction
|
|
56
36
|
|
|
57
|
-
|
|
37
|
+
Uproot-custom is an extension of [Uproot](https://uproot.readthedocs.io/en/latest/basic.html) that provides an enhanced way to read custom classes stored in `TTree`.
|
|
58
38
|
|
|
59
|
-
##
|
|
39
|
+
## What uproot-custom can do
|
|
60
40
|
|
|
61
|
-
|
|
41
|
+
Uproot-custom can natively read complicated combinations of nested classes and c-style arrays (e.g. `map<int, map<int, map<int, string>>>`, `vector<TString>[3]`, etc), and memberwisely stored classes. It also exposes a way for users to implement their own readers for custom classes that are not supported by Uproot or uproot-custom built-in readers, so that users can read their custom classes seamlessly.
|
|
62
42
|
|
|
63
|
-
##
|
|
43
|
+
## When to use uproot-custom
|
|
64
44
|
|
|
65
|
-
|
|
45
|
+
Uproot-custom aims to handle cases that classes are too complex for Uproot to read, such as when their `Streamer` methods are overridden or some specific data members are not supported by Uproot.
|
|
46
|
+
|
|
47
|
+
## How uproot-custom works
|
|
48
|
+
|
|
49
|
+
Uproot-custom uses a `reader`/`factory` mechanism to read classes:
|
|
66
50
|
|
|
67
51
|
```mermaid
|
|
68
52
|
flowchart TD
|
|
@@ -90,14 +74,14 @@ flowchart TD
|
|
|
90
74
|
- `reader` is a C++ class that implements the logic to read data from binary buffers.
|
|
91
75
|
- `factory` is a Python class that creates, combines `reader`s, and post-processes the data read by `reader`s.
|
|
92
76
|
|
|
93
|
-
This machanism is implemented
|
|
77
|
+
This machanism is implemented basing on `uproot_custom.AsCustom` interpretation. This makes uproot-custom well compatible with Uproot.
|
|
94
78
|
|
|
95
79
|
> [!TIP]
|
|
96
|
-
> Users can implement their own `factory` and `reader`, register them to
|
|
80
|
+
> Users can implement their own `factory` and `reader`, register them to uproot-custom. An example of implementing a custom `factory`/`reader` can be found in [the example repository](https://github.com/mrzimu/uproot-custom-example).
|
|
97
81
|
|
|
98
82
|
> [!NOTE]
|
|
99
|
-
>
|
|
83
|
+
> Uproot-custom does not provide a full reimplementation of `ROOT`'s I/O system. Users are expected to implement their own `factory`/`reader` for their custom classes that built-in factories cannot handle.
|
|
100
84
|
|
|
101
85
|
## Documentation
|
|
102
86
|
|
|
103
|
-
View the [documentation](https://mrzimu.github.io/uproot-custom/) for more details about customizing your own `reader`/`factory`,
|
|
87
|
+
View the [documentation](https://mrzimu.github.io/uproot-custom/) for more details about customizing your own `reader`/`factory`, the architecture of uproot-custom, and build-only dependencies (e.g., `pybind11` is needed only at build time and should not be present in the runtime environment).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
Uproot-custom is an extension of [Uproot](https://uproot.readthedocs.io/en/latest/basic.html) that provides an enhanced way to read custom classes stored in `TTree`.
|
|
4
|
+
|
|
5
|
+
## What uproot-custom can do
|
|
6
|
+
|
|
7
|
+
Uproot-custom can natively read complicated combinations of nested classes and c-style arrays (e.g. `map<int, map<int, map<int, string>>>`, `vector<TString>[3]`, etc), and memberwisely stored classes. It also exposes a way for users to implement their own readers for custom classes that are not supported by Uproot or uproot-custom built-in readers, so that users can read their custom classes seamlessly.
|
|
8
|
+
|
|
9
|
+
## When to use uproot-custom
|
|
10
|
+
|
|
11
|
+
Uproot-custom aims to handle cases that classes are too complex for Uproot to read, such as when their `Streamer` methods are overridden or some specific data members are not supported by Uproot.
|
|
12
|
+
|
|
13
|
+
## How uproot-custom works
|
|
14
|
+
|
|
15
|
+
Uproot-custom uses a `reader`/`factory` mechanism to read classes:
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
subgraph py["Python field"]
|
|
20
|
+
direction TB
|
|
21
|
+
AsCustom --> fac["Factory (Primitive, STLVector, TString, ...)"]
|
|
22
|
+
fac["Factory (Primitive, STLVector, TString, ...)"] -- Optional --> form(["construct awkward forms"])
|
|
23
|
+
fac --> build_reader(["build corresponding C++ reader"])
|
|
24
|
+
fac --> build_ak(["construct awkward arrays"])
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
user_fac["User's Factory"] -. Register .-> fac
|
|
28
|
+
|
|
29
|
+
subgraph cpp["C++ field"]
|
|
30
|
+
direction TB
|
|
31
|
+
build_reader --> reader["C++ Reader"]
|
|
32
|
+
reader --> read_bin(["read binary data"])
|
|
33
|
+
read_bin --> ret_data(["return data"])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
ret_data --> raw_data[("tuple, list, numpy arrays, ...")]
|
|
37
|
+
raw_data --> build_ak
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- `reader` is a C++ class that implements the logic to read data from binary buffers.
|
|
41
|
+
- `factory` is a Python class that creates, combines `reader`s, and post-processes the data read by `reader`s.
|
|
42
|
+
|
|
43
|
+
This machanism is implemented basing on `uproot_custom.AsCustom` interpretation. This makes uproot-custom well compatible with Uproot.
|
|
44
|
+
|
|
45
|
+
> [!TIP]
|
|
46
|
+
> Users can implement their own `factory` and `reader`, register them to uproot-custom. An example of implementing a custom `factory`/`reader` can be found in [the example repository](https://github.com/mrzimu/uproot-custom-example).
|
|
47
|
+
|
|
48
|
+
> [!NOTE]
|
|
49
|
+
> Uproot-custom does not provide a full reimplementation of `ROOT`'s I/O system. Users are expected to implement their own `factory`/`reader` for their custom classes that built-in factories cannot handle.
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
View the [documentation](https://mrzimu.github.io/uproot-custom/) for more details about customizing your own `reader`/`factory`, the architecture of uproot-custom, and build-only dependencies (e.g., `pybind11` is needed only at build time and should not be present in the runtime environment).
|
|
@@ -356,22 +356,15 @@ namespace uproot {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
|
-
* @brief Read multiple elements from the buffer in member-wise fashion.
|
|
360
|
-
*
|
|
361
|
-
* overridden to handle member-wise reading more efficiently.
|
|
359
|
+
* @brief Read multiple elements from the buffer in member-wise fashion. Readers
|
|
360
|
+
* that need to handle member-wise data reading must implement this method.
|
|
362
361
|
*
|
|
363
362
|
* @param buffer The binary buffer to read from.
|
|
364
363
|
* @param count Number of elements to read.
|
|
365
364
|
* @return Number of elements read.
|
|
366
365
|
*/
|
|
367
366
|
virtual uint32_t read_many_memberwise( BinaryBuffer& buffer, const int64_t count ) {
|
|
368
|
-
|
|
369
|
-
{
|
|
370
|
-
std::stringstream msg;
|
|
371
|
-
msg << name() << "::read_many_memberwise with negative count: " << count;
|
|
372
|
-
throw std::runtime_error( msg.str() );
|
|
373
|
-
}
|
|
374
|
-
return read_many( buffer, count );
|
|
367
|
+
throw std::runtime_error( name() + "::read_many_memberwise is not implemented." );
|
|
375
368
|
}
|
|
376
369
|
};
|
|
377
370
|
|
|
@@ -116,7 +116,8 @@ namespace uproot {
|
|
|
116
116
|
/**
|
|
117
117
|
* @brief Read a TObject from the buffer. A TObject contains `fVersion` (int16_t),
|
|
118
118
|
* `fUniqueID` (int32_t), `fBits` (uint32_t). If `fBits & kIsReferenced`, then a `pidf`
|
|
119
|
-
* (uint16_t) follows.
|
|
119
|
+
* (uint16_t) follows. If @ref m_keep_data is true, the read data
|
|
120
|
+
* will be stored.
|
|
120
121
|
*
|
|
121
122
|
* @param buffer The binary buffer to read from
|
|
122
123
|
*/
|
|
@@ -365,11 +366,11 @@ namespace uproot {
|
|
|
365
366
|
"supported when with_header is true!" );
|
|
366
367
|
|
|
367
368
|
auto fNBytes = buffer.read_fNBytes();
|
|
369
|
+
auto end_pos = buffer.get_cursor() + fNBytes;
|
|
368
370
|
auto fVersion = buffer.read_fVersion();
|
|
369
371
|
bool is_memberwise = fVersion & kStreamedMemberWise;
|
|
370
372
|
check_objwise_memberwise( is_memberwise );
|
|
371
373
|
if ( is_memberwise ) buffer.skip( 2 );
|
|
372
|
-
auto end_pos = buffer.get_cursor() + fNBytes - 2; //
|
|
373
374
|
|
|
374
375
|
uint32_t cur_count = 0;
|
|
375
376
|
while ( buffer.get_cursor() < end_pos )
|
|
@@ -1038,13 +1039,14 @@ namespace uproot {
|
|
|
1038
1039
|
* @param buffer The binary buffer to read from.
|
|
1039
1040
|
*/
|
|
1040
1041
|
void read( BinaryBuffer& buffer ) override {
|
|
1041
|
-
auto nbytes
|
|
1042
|
-
auto
|
|
1042
|
+
auto nbytes = buffer.read_fNBytes();
|
|
1043
|
+
auto start_pos = buffer.get_cursor();
|
|
1044
|
+
auto end_pos = buffer.get_cursor() + nbytes;
|
|
1043
1045
|
|
|
1044
1046
|
auto fTag = buffer.read<int32_t>();
|
|
1045
|
-
if ( fTag ==
|
|
1047
|
+
if ( fTag == kNewClassTag )
|
|
1048
|
+
{ auto fTypename = buffer.read_null_terminated_string(); }
|
|
1046
1049
|
|
|
1047
|
-
auto start_pos = buffer.get_cursor();
|
|
1048
1050
|
m_element_reader->read( buffer );
|
|
1049
1051
|
|
|
1050
1052
|
if ( buffer.get_cursor() != end_pos )
|
|
@@ -1109,7 +1111,7 @@ namespace uproot {
|
|
|
1109
1111
|
m_flat_size );
|
|
1110
1112
|
debug_printf( buffer );
|
|
1111
1113
|
|
|
1112
|
-
if ( m_flat_size
|
|
1114
|
+
if ( m_flat_size >= 0 ) { m_element_reader->read_many( buffer, m_flat_size ); }
|
|
1113
1115
|
else
|
|
1114
1116
|
{
|
|
1115
1117
|
// get end-position
|
|
@@ -1178,7 +1180,7 @@ namespace uproot {
|
|
|
1178
1180
|
* m_element_reader. Otherwise, return a tuple contains: (offsets, elements_data).
|
|
1179
1181
|
*/
|
|
1180
1182
|
py::object data() const override {
|
|
1181
|
-
if ( m_flat_size
|
|
1183
|
+
if ( m_flat_size >= 0 ) return m_element_reader->data();
|
|
1182
1184
|
else
|
|
1183
1185
|
{
|
|
1184
1186
|
auto offsets_array = make_array( m_offsets );
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
#
|
|
3
3
|
# For the full list of built-in configuration values, see the documentation:
|
|
4
4
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
5
7
|
|
|
6
8
|
# -- Project information -----------------------------------------------------
|
|
7
9
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
@@ -69,9 +71,6 @@ gettext_compact = False # Do not compact message files
|
|
|
69
71
|
language = "en" # Default language
|
|
70
72
|
|
|
71
73
|
# -- Options for autodoc ---------------------------------------------------------
|
|
72
|
-
import sys
|
|
73
|
-
from pathlib import Path
|
|
74
|
-
|
|
75
74
|
sys.path.insert(0, str(Path(__file__).parent.parent.resolve()))
|
|
76
75
|
|
|
77
76
|
apidoc_modules = [
|
|
@@ -121,7 +120,6 @@ sys.path.insert(0, str(Path(__file__).parent.parent.resolve() / "doxygen" / "xml
|
|
|
121
120
|
def run_doxygen():
|
|
122
121
|
"""Run the doxygen make command in the designated folder."""
|
|
123
122
|
import subprocess
|
|
124
|
-
import os
|
|
125
123
|
|
|
126
124
|
doxygen_file = Path(__file__).parent / "Doxyfile"
|
|
127
125
|
working_dir = doxygen_file.parent
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Example 1: `Streamer` method is overridden
|
|
2
2
|
|
|
3
|
+
Goal: handle a class whose `Streamer` overrides the default layout by inserting
|
|
4
|
+
an extra mask. We will inspect the bytes, write a C++ reader, wrap it with a
|
|
5
|
+
factory, register it, then read with Uproot.
|
|
6
|
+
|
|
3
7
|
```{seealso}
|
|
4
|
-
A full example can be found in the
|
|
8
|
+
A full example can be found in the [example repository](https://github.com/mrzimu/uproot-custom-example).
|
|
5
9
|
```
|
|
6
10
|
|
|
7
|
-
We define a demo class `TOverrideStreamer` whose `Streamer` method is overridden to show how to read such classes using
|
|
11
|
+
We define a demo class `TOverrideStreamer` whose `Streamer` method is overridden to show how to read such classes using uproot-custom.
|
|
8
12
|
|
|
9
13
|
There are 2 member variables in `TOverrideStreamer`: `m_int` and `m_double`:
|
|
10
14
|
|
|
@@ -35,7 +39,7 @@ We add a mask in the `Streamer` method to demonstrate how to handle special logi
|
|
|
35
39
|
```{code-block} cpp
|
|
36
40
|
---
|
|
37
41
|
caption: `TOverrideStreamer.cc`
|
|
38
|
-
emphasize-lines: 16-23, 31-32
|
|
42
|
+
emphasize-lines: 16-23, 31-32
|
|
39
43
|
---
|
|
40
44
|
#include <TBuffer.h>
|
|
41
45
|
#include <TObject.h>
|
|
@@ -281,7 +285,7 @@ Refer to [awkward forms](https://awkward-array.org/doc/main/reference/generated/
|
|
|
281
285
|
|
|
282
286
|
## Step 4: Register target branch and the `factory`
|
|
283
287
|
|
|
284
|
-
Finally, we need to register the branch we want to read with
|
|
288
|
+
Finally, we need to register the branch we want to read with uproot-custom, and also register the `OverrideStreamerFactory` so that it can be used by uproot-custom.
|
|
285
289
|
|
|
286
290
|
We can do this by adding the following code in the `__init__.py` of your package:
|
|
287
291
|
|
|
@@ -295,9 +299,9 @@ AsCustom.target_branches |= {
|
|
|
295
299
|
registered_factories.add(OverrideStreamerFactory)
|
|
296
300
|
```
|
|
297
301
|
|
|
298
|
-
## Step 5: Read data with
|
|
302
|
+
## Step 5: Read data with Uproot
|
|
299
303
|
|
|
300
|
-
Now we can read the data using
|
|
304
|
+
Now we can read the data using Uproot as usual:
|
|
301
305
|
|
|
302
306
|
```python
|
|
303
307
|
>>> b = uproot.open("demo_data.root")["my_tree:override_streamer"]
|