pywimparser 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pywimparser contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md LICENSE THIRD_PARTY_NOTICES.md
2
+ include scripts/build_libwim.sh
3
+ recursive-include src/pywimparser py.typed
4
+ recursive-include tests *.py *.wim *.md
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: pywimparser
3
+ Version: 0.1.0
4
+ Summary: Python library for parsing and extracting Microsoft WIM archives via libwim
5
+ Author: pywimparser contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/bwhitn/pywimparser
8
+ Project-URL: Repository, https://github.com/bwhitn/pywimparser
9
+ Project-URL: Issues, https://github.com/bwhitn/pywimparser/issues
10
+ Keywords: wim,windows,forensics,parser,archive
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: System :: Archiving
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.2.2; extra == "dev"
27
+ Requires-Dist: twine>=5.1.1; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # pywimparser
31
+
32
+ `pywimparser` is a Python library for reading Microsoft WIM archives.
33
+
34
+ It focuses on:
35
+ - parsing as much metadata as possible
36
+ - listing files/directories inside images
37
+ - extracting full images or selected paths
38
+
39
+ This project is read-only for WIM operations. It does **not** create or modify WIM files.
40
+
41
+ ## Backend Model
42
+
43
+ `pywimparser` has two runtime paths:
44
+
45
+ - Native `libwim` backend (`ctypes`, raw C API)
46
+ - full metadata traversal
47
+ - robust extraction support
48
+ - supports XPRESS, LZX, and LZMS through `libwim`
49
+ - Pure Python fallback
50
+ - parses core WIM structures directly
51
+ - can list/extract uncompressed resources
52
+ - cannot fully decompress entropy-coded XPRESS/LZX/LZMS resources
53
+
54
+ Use `WimParser.parse_backend` to see which backend was used for a parse call.
55
+
56
+ ## Features
57
+
58
+ - Archive-level metadata
59
+ - header fields (signature, version, flags, chunk size, GUID, parts, image count)
60
+ - lookup/offset table entries
61
+ - XML document (when available)
62
+ - Image metadata
63
+ - name, description, display name/description
64
+ - file/dir counts and total bytes (when present)
65
+ - selected Windows metadata from XML (when present)
66
+ - Filesystem metadata
67
+ - path, type, timestamps, attributes, size, packed size, stream hash
68
+ - Extraction
69
+ - `extract_all()` for an image
70
+ - `extract([...])` for selected paths
71
+
72
+ ## Platform Support
73
+
74
+ - Packaging:
75
+ - `pywimparser` is distributed as a pure-Python wheel (`py3-none-any`) plus sdist.
76
+ - The same wheel is installable on Linux/macOS/Windows for Intel and ARM.
77
+ - CI coverage:
78
+ - Linux: x64 + arm64
79
+ - macOS: Intel + Apple Silicon
80
+ - Windows: x64 + arm64
81
+ - Native `libwim` backend CI:
82
+ - validated on Linux x64 + arm64
83
+ - other platforms use the pure-Python fallback unless `libwim` is installed and discoverable
84
+
85
+ ## Installation
86
+
87
+ From PyPI:
88
+
89
+ ```bash
90
+ pip install pywimparser
91
+ ```
92
+
93
+ For full extraction/compression support, ensure `libwim` is installed and discoverable.
94
+
95
+ ## Build `libwim` Without `ntfs-3g`
96
+
97
+ The repository includes `scripts/build_libwim.sh` to build shared `libwim` with:
98
+ - `--without-ntfs-3g`
99
+ - `--without-fuse`
100
+ - `--enable-shared`
101
+ - `--disable-static`
102
+
103
+ This keeps usage in the `libwim` dual-license path that allows LGPL option when `ntfs-3g` is not linked.
104
+
105
+ ```bash
106
+ ./scripts/build_libwim.sh
107
+ ```
108
+
109
+ After build, point `pywimparser` to the library:
110
+
111
+ ```bash
112
+ export PYWIMPARSER_WIMLIB_PREFIX="$(pwd)/.vendor/wimlib"
113
+ # or:
114
+ export PYWIMPARSER_LIBWIM="$(pwd)/.vendor/wimlib/lib/libwim.so"
115
+ ```
116
+
117
+ ## Quick Start
118
+
119
+ ```python
120
+ from pywimparser import WimParser
121
+
122
+ parser = WimParser("install.wim")
123
+ metadata = parser.parse()
124
+
125
+ print(parser.parse_backend) # "libwim-c" or "python"
126
+ print(parser.native_backend_available) # True if libwim is usable
127
+ print(metadata.header.compression_format)
128
+
129
+ entries = parser.list_entries(image_index=1)
130
+ print(entries[0].path)
131
+
132
+ parser.extract_all("./out", image_index=1)
133
+ parser.extract(["Windows/System32/notepad.exe"], "./out", image_index=1)
134
+ ```
135
+
136
+ ## CLI
137
+
138
+ ```bash
139
+ pywimparser info install.wim
140
+ pywimparser list install.wim --image 1
141
+ pywimparser extract install.wim ./out --image 1
142
+ pywimparser extract install.wim ./out --image 1 --path Windows/System32/cmd.exe
143
+ ```
144
+
145
+ ## Development
146
+
147
+ Create and activate a virtual environment:
148
+
149
+ ```bash
150
+ python3 -m venv .venv
151
+ source .venv/bin/activate
152
+ ```
153
+
154
+ Install package + dev tooling:
155
+
156
+ ```bash
157
+ python -m pip install --upgrade pip
158
+ python -m pip install -e ".[dev]"
159
+ ```
160
+
161
+ Run tests:
162
+
163
+ ```bash
164
+ python -m unittest discover -s tests -v
165
+ ```
166
+
167
+ Fixture notes are in `tests/fixtures/README.md`.
168
+
169
+ ## Build Artifacts
170
+
171
+ Build wheel + sdist:
172
+
173
+ ```bash
174
+ python -m build
175
+ ```
176
+
177
+ ## GitHub Actions / PyPI Readiness
178
+
179
+ The repository includes workflows for:
180
+ - CI (install package, run tests, build artifacts)
181
+ - Publish (build sdist/wheel, publish with trusted publishing)
182
+
183
+ Before releasing publicly:
184
+ - confirm `project.urls` in `pyproject.toml`
185
+ - choose and document your versioning policy
186
+ - configure your PyPI trusted publisher or token flow
187
+
188
+ Tracked checklist: see `NEXT_STEPS.md`.
189
+
190
+ ## Public API
191
+
192
+ Main class:
193
+ - `WimParser(path)`
194
+
195
+ Methods:
196
+ - `parse(force_reload=False)`
197
+ - `list_entries(image_index=1)`
198
+ - `extract_all(destination, image_index=1)`
199
+ - `extract(paths, destination, image_index=1)`
200
+
201
+ Properties:
202
+ - `parse_backend`
203
+ - `native_backend_available`
204
+ - `rust_backend_available` (compatibility alias)
205
+ - `extraction_available`
206
+
207
+ ## License
208
+
209
+ `pywimparser` is licensed under MIT.
210
+
211
+ `libwim` is third-party software with its own license terms. See `THIRD_PARTY_NOTICES.md`.
212
+
213
+ This README is technical guidance, not legal advice.
@@ -0,0 +1,184 @@
1
+ # pywimparser
2
+
3
+ `pywimparser` is a Python library for reading Microsoft WIM archives.
4
+
5
+ It focuses on:
6
+ - parsing as much metadata as possible
7
+ - listing files/directories inside images
8
+ - extracting full images or selected paths
9
+
10
+ This project is read-only for WIM operations. It does **not** create or modify WIM files.
11
+
12
+ ## Backend Model
13
+
14
+ `pywimparser` has two runtime paths:
15
+
16
+ - Native `libwim` backend (`ctypes`, raw C API)
17
+ - full metadata traversal
18
+ - robust extraction support
19
+ - supports XPRESS, LZX, and LZMS through `libwim`
20
+ - Pure Python fallback
21
+ - parses core WIM structures directly
22
+ - can list/extract uncompressed resources
23
+ - cannot fully decompress entropy-coded XPRESS/LZX/LZMS resources
24
+
25
+ Use `WimParser.parse_backend` to see which backend was used for a parse call.
26
+
27
+ ## Features
28
+
29
+ - Archive-level metadata
30
+ - header fields (signature, version, flags, chunk size, GUID, parts, image count)
31
+ - lookup/offset table entries
32
+ - XML document (when available)
33
+ - Image metadata
34
+ - name, description, display name/description
35
+ - file/dir counts and total bytes (when present)
36
+ - selected Windows metadata from XML (when present)
37
+ - Filesystem metadata
38
+ - path, type, timestamps, attributes, size, packed size, stream hash
39
+ - Extraction
40
+ - `extract_all()` for an image
41
+ - `extract([...])` for selected paths
42
+
43
+ ## Platform Support
44
+
45
+ - Packaging:
46
+ - `pywimparser` is distributed as a pure-Python wheel (`py3-none-any`) plus sdist.
47
+ - The same wheel is installable on Linux/macOS/Windows for Intel and ARM.
48
+ - CI coverage:
49
+ - Linux: x64 + arm64
50
+ - macOS: Intel + Apple Silicon
51
+ - Windows: x64 + arm64
52
+ - Native `libwim` backend CI:
53
+ - validated on Linux x64 + arm64
54
+ - other platforms use the pure-Python fallback unless `libwim` is installed and discoverable
55
+
56
+ ## Installation
57
+
58
+ From PyPI:
59
+
60
+ ```bash
61
+ pip install pywimparser
62
+ ```
63
+
64
+ For full extraction/compression support, ensure `libwim` is installed and discoverable.
65
+
66
+ ## Build `libwim` Without `ntfs-3g`
67
+
68
+ The repository includes `scripts/build_libwim.sh` to build shared `libwim` with:
69
+ - `--without-ntfs-3g`
70
+ - `--without-fuse`
71
+ - `--enable-shared`
72
+ - `--disable-static`
73
+
74
+ This keeps usage in the `libwim` dual-license path that allows LGPL option when `ntfs-3g` is not linked.
75
+
76
+ ```bash
77
+ ./scripts/build_libwim.sh
78
+ ```
79
+
80
+ After build, point `pywimparser` to the library:
81
+
82
+ ```bash
83
+ export PYWIMPARSER_WIMLIB_PREFIX="$(pwd)/.vendor/wimlib"
84
+ # or:
85
+ export PYWIMPARSER_LIBWIM="$(pwd)/.vendor/wimlib/lib/libwim.so"
86
+ ```
87
+
88
+ ## Quick Start
89
+
90
+ ```python
91
+ from pywimparser import WimParser
92
+
93
+ parser = WimParser("install.wim")
94
+ metadata = parser.parse()
95
+
96
+ print(parser.parse_backend) # "libwim-c" or "python"
97
+ print(parser.native_backend_available) # True if libwim is usable
98
+ print(metadata.header.compression_format)
99
+
100
+ entries = parser.list_entries(image_index=1)
101
+ print(entries[0].path)
102
+
103
+ parser.extract_all("./out", image_index=1)
104
+ parser.extract(["Windows/System32/notepad.exe"], "./out", image_index=1)
105
+ ```
106
+
107
+ ## CLI
108
+
109
+ ```bash
110
+ pywimparser info install.wim
111
+ pywimparser list install.wim --image 1
112
+ pywimparser extract install.wim ./out --image 1
113
+ pywimparser extract install.wim ./out --image 1 --path Windows/System32/cmd.exe
114
+ ```
115
+
116
+ ## Development
117
+
118
+ Create and activate a virtual environment:
119
+
120
+ ```bash
121
+ python3 -m venv .venv
122
+ source .venv/bin/activate
123
+ ```
124
+
125
+ Install package + dev tooling:
126
+
127
+ ```bash
128
+ python -m pip install --upgrade pip
129
+ python -m pip install -e ".[dev]"
130
+ ```
131
+
132
+ Run tests:
133
+
134
+ ```bash
135
+ python -m unittest discover -s tests -v
136
+ ```
137
+
138
+ Fixture notes are in `tests/fixtures/README.md`.
139
+
140
+ ## Build Artifacts
141
+
142
+ Build wheel + sdist:
143
+
144
+ ```bash
145
+ python -m build
146
+ ```
147
+
148
+ ## GitHub Actions / PyPI Readiness
149
+
150
+ The repository includes workflows for:
151
+ - CI (install package, run tests, build artifacts)
152
+ - Publish (build sdist/wheel, publish with trusted publishing)
153
+
154
+ Before releasing publicly:
155
+ - confirm `project.urls` in `pyproject.toml`
156
+ - choose and document your versioning policy
157
+ - configure your PyPI trusted publisher or token flow
158
+
159
+ Tracked checklist: see `NEXT_STEPS.md`.
160
+
161
+ ## Public API
162
+
163
+ Main class:
164
+ - `WimParser(path)`
165
+
166
+ Methods:
167
+ - `parse(force_reload=False)`
168
+ - `list_entries(image_index=1)`
169
+ - `extract_all(destination, image_index=1)`
170
+ - `extract(paths, destination, image_index=1)`
171
+
172
+ Properties:
173
+ - `parse_backend`
174
+ - `native_backend_available`
175
+ - `rust_backend_available` (compatibility alias)
176
+ - `extraction_available`
177
+
178
+ ## License
179
+
180
+ `pywimparser` is licensed under MIT.
181
+
182
+ `libwim` is third-party software with its own license terms. See `THIRD_PARTY_NOTICES.md`.
183
+
184
+ This README is technical guidance, not legal advice.
@@ -0,0 +1,25 @@
1
+ # Third-Party Notices
2
+
3
+ `pywimparser` itself is licensed under MIT.
4
+
5
+ This project can use `libwim` at runtime through `ctypes` (dynamic linking).
6
+
7
+ ## libwim
8
+
9
+ - Project: https://wimlib.net/
10
+ - Upstream source: https://github.com/ebiggers/wimlib
11
+
12
+ Upstream licensing summary (from wimlib project documentation):
13
+ - wimlib project as a whole: GPLv3+
14
+ - `libwim` library component: dual license, GPLv3+ **or** LGPLv2.1+ when allowed
15
+ - If built with `libntfs-3g` linkage, GPL requirements apply
16
+ - If built without `ntfs-3g` (for example `./configure --without-ntfs-3g`), LGPL option for `libwim` remains available
17
+
18
+ `scripts/build_libwim.sh` in this repository intentionally builds with `--without-ntfs-3g`.
19
+
20
+ ## Distribution Notes
21
+
22
+ - `pywimparser` does not bundle `libwim` by default.
23
+ - If you redistribute binaries that include or depend on `libwim`, you must satisfy `libwim`'s license obligations for your chosen build/distribution model.
24
+
25
+ This file is a technical summary, not legal advice.
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pywimparser"
7
+ version = "0.1.0"
8
+ description = "Python library for parsing and extracting Microsoft WIM archives via libwim"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "pywimparser contributors" }]
13
+ keywords = ["wim", "windows", "forensics", "parser", "archive"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development :: Libraries",
25
+ "Topic :: System :: Archiving",
26
+ ]
27
+ dependencies = []
28
+
29
+ [project.optional-dependencies]
30
+ dev = [
31
+ "build>=1.2.2",
32
+ "twine>=5.1.1",
33
+ ]
34
+
35
+ [project.scripts]
36
+ pywimparser = "pywimparser.cli:main"
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/bwhitn/pywimparser"
40
+ Repository = "https://github.com/bwhitn/pywimparser"
41
+ Issues = "https://github.com/bwhitn/pywimparser/issues"
42
+
43
+ [tool.setuptools]
44
+ package-dir = { "" = "src" }
45
+ include-package-data = true
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.setuptools.package-data]
51
+ pywimparser = ["py.typed"]
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ VERSION="${WIMLIB_VERSION:-1.14.5}"
5
+ PREFIX="${WIMLIB_PREFIX:-$(pwd)/.vendor/wimlib}"
6
+ WORKDIR="${WIMLIB_WORKDIR:-/tmp/wimlib-build-${VERSION}}"
7
+ TARBALL="/tmp/wimlib-${VERSION}.tar.gz"
8
+ SRC_DIR="${WORKDIR}/wimlib-${VERSION}"
9
+
10
+ if command -v nproc >/dev/null 2>&1; then
11
+ BUILD_JOBS="$(nproc)"
12
+ elif command -v sysctl >/dev/null 2>&1; then
13
+ BUILD_JOBS="$(sysctl -n hw.ncpu)"
14
+ else
15
+ BUILD_JOBS=1
16
+ fi
17
+
18
+ echo "Building wimlib ${VERSION} without ntfs-3g"
19
+ echo "Install prefix: ${PREFIX}"
20
+
21
+ rm -rf "${WORKDIR}"
22
+ mkdir -p "${WORKDIR}"
23
+
24
+ curl -L "https://wimlib.net/downloads/wimlib-${VERSION}.tar.gz" -o "${TARBALL}"
25
+ tar -xzf "${TARBALL}" -C "${WORKDIR}"
26
+
27
+ pushd "${SRC_DIR}" >/dev/null
28
+ ./configure \
29
+ --prefix="${PREFIX}" \
30
+ --without-ntfs-3g \
31
+ --without-fuse \
32
+ --enable-shared \
33
+ --disable-static
34
+ make -j"${BUILD_JOBS}"
35
+ make install
36
+ popd >/dev/null
37
+
38
+ echo "libwim built at ${PREFIX}"
39
+ echo "Set one of:"
40
+ echo " export PYWIMPARSER_WIMLIB_PREFIX=${PREFIX}"
41
+ echo " export PYWIMPARSER_LIBWIM=${PREFIX}/lib/libwim.so"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,33 @@
1
+ """pywimparser public API."""
2
+
3
+ from .exceptions import (
4
+ ExternalToolError,
5
+ ExtractionError,
6
+ InvalidWimError,
7
+ UnsupportedFeatureError,
8
+ WimParserError,
9
+ )
10
+ from .models import (
11
+ WimArchiveMetadata,
12
+ WimFileEntry,
13
+ WimHeader,
14
+ WimImageMetadata,
15
+ WimLookupEntry,
16
+ WimResourceHeader,
17
+ )
18
+ from .parser import WimParser
19
+
20
+ __all__ = [
21
+ "ExternalToolError",
22
+ "ExtractionError",
23
+ "InvalidWimError",
24
+ "UnsupportedFeatureError",
25
+ "WimParser",
26
+ "WimParserError",
27
+ "WimArchiveMetadata",
28
+ "WimFileEntry",
29
+ "WimHeader",
30
+ "WimImageMetadata",
31
+ "WimLookupEntry",
32
+ "WimResourceHeader",
33
+ ]
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())