pytecode 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytecode-0.0.1/pytecode.egg-info → pytecode-0.0.2}/PKG-INFO +19 -9
- {pytecode-0.0.1 → pytecode-0.0.2}/README.md +18 -8
- {pytecode-0.0.1 → pytecode-0.0.2}/pyproject.toml +1 -1
- pytecode-0.0.2/pytecode/_attribute_clone.py +546 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/constant_pool_builder.py +469 -67
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/hierarchy.py +1 -1
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/labels.py +332 -136
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/model.py +114 -63
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/verify.py +49 -35
- {pytecode-0.0.1 → pytecode-0.0.2/pytecode.egg-info}/PKG-INFO +19 -9
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode.egg-info/SOURCES.txt +1 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_constant_pool_builder.py +170 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_labels.py +161 -1
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_model.py +220 -2
- {pytecode-0.0.1 → pytecode-0.0.2}/LICENSE +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/MANIFEST.in +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/__init__.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/analysis.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/attributes.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/bytes_utils.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/class_reader.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/class_writer.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/constant_pool.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/constants.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/debug_info.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/descriptors.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/info.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/instructions.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/jar.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/modified_utf8.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/operands.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/py.typed +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode/transforms.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode.egg-info/dependency_links.txt +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode.egg-info/requires.txt +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/pytecode.egg-info/top_level.txt +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/setup.cfg +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_analysis.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_api_docs.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_attributes.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_bytes_utils.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_cfg_oracle.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_class_reader.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_class_writer.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_constant_pool.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_debug_info.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_descriptors.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_helpers.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_hierarchy.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_instructions.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_jar.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_javap_parser.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_modified_utf8.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_operands.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_transforms.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_validate_release_tag.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_validation.py +0 -0
- {pytecode-0.0.1 → pytecode-0.0.2}/tests/test_verify.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytecode
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: Python library for parsing, manipulating, and emitting JVM class files
|
|
5
5
|
Author: Trenton Smith
|
|
6
6
|
License-Expression: MIT
|
|
@@ -166,13 +166,13 @@ uv run ruff check .
|
|
|
166
166
|
uv run ruff format --check .
|
|
167
167
|
uv run basedpyright
|
|
168
168
|
uv run pytest -q
|
|
169
|
-
uv run python tools
|
|
169
|
+
uv run python tools/generate_api_docs.py --check
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
Generate local API reference HTML with:
|
|
173
173
|
|
|
174
174
|
```powershell
|
|
175
|
-
uv run python tools
|
|
175
|
+
uv run python tools/generate_api_docs.py
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
Build source and wheel distributions locally:
|
|
@@ -181,11 +181,21 @@ Build source and wheel distributions locally:
|
|
|
181
181
|
uv build
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
Profile isolated JAR-processing stages without `run.py`'s output overhead:
|
|
185
|
+
|
|
186
|
+
```powershell
|
|
187
|
+
uv run python tools/profile_jar_pipeline.py path/to/jar.jar
|
|
188
|
+
uv run python tools/profile_jar_pipeline.py path/to/jar.jar --stages class-parse model-lift model-lower
|
|
189
|
+
uv run python tools/profile_jar_pipeline.py path/to/dir/with/jars --stages model-lift model-lower --summary-json output/profiles/common-libs/summary.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
When making runtime-performance changes, prefer checking both a focused jar such as `225.jar` and the wider common-jar corpus so regressions and wins are not judged from a single artifact. A single jar defaults to all stages; directories and multi-jar runs default to `model-lift` and `model-lower`.
|
|
193
|
+
|
|
194
|
+
The `oracle`-marked CFG tests lazily cache ASM 9.7.1 test jars under `.pytest_cache/pytecode-oracle` and also honor manually seeded jars in `tests/resources/oracle/lib`. If `java`, `javac`, or the ASM jars are unavailable, that suite skips without failing the rest of the test run.
|
|
185
195
|
|
|
186
196
|
## Release automation
|
|
187
197
|
|
|
188
|
-
PyPI releases are published from GitHub Actions by pushing an immutable `v<version>` tag that matches `project.version` in `pyproject.toml`. The
|
|
198
|
+
PyPI releases are published from GitHub Actions by pushing an immutable `v<version>` tag that matches `project.version` in `pyproject.toml`. The same workflow can also be started manually for an existing tag by supplying a `tag` input. In both cases, the workflow checks out the tagged commit, reruns validation, builds both `sdist` and `wheel` with `uv build`, publishes from the protected `pypi` environment via PyPI Trusted Publishing, and then creates or updates a GitHub Release for the same tag with the built distributions attached.
|
|
189
199
|
|
|
190
200
|
Release procedure:
|
|
191
201
|
|
|
@@ -195,7 +205,7 @@ uv run ruff check .
|
|
|
195
205
|
uv run ruff format --check .
|
|
196
206
|
uv run basedpyright
|
|
197
207
|
uv run pytest -q
|
|
198
|
-
uv run python tools
|
|
208
|
+
uv run python tools/generate_api_docs.py --check
|
|
199
209
|
|
|
200
210
|
git commit -am "Bump version to X.Y.Z"
|
|
201
211
|
git push origin master
|
|
@@ -203,16 +213,16 @@ git tag vX.Y.Z
|
|
|
203
213
|
git push origin vX.Y.Z
|
|
204
214
|
```
|
|
205
215
|
|
|
206
|
-
The release workflow rejects tags that do not match `project.version`. Treat release tags as immutable: if a tag or published artifact is wrong, bump to a new version and publish a new tag instead of force-pushing the old one.
|
|
216
|
+
The release workflow rejects tags that do not match `project.version`. Treat release tags as immutable: if a tag or published artifact is wrong, bump to a new version and publish a new tag instead of force-pushing the old one. For an existing tag, you can rerun the workflow directly or start it manually from Actions by providing the tag name. The workflow is safe to rerun for the same tag: PyPI uploads skip files that already exist, and the GitHub Release step updates the existing release assets in place if the release was already created.
|
|
207
217
|
|
|
208
218
|
## Repository utilities
|
|
209
219
|
|
|
210
|
-
`run.py` is a manual smoke-test helper that parses a JAR file, writes pretty-printed parsed class structures under `<jar parent
|
|
220
|
+
`run.py` is a manual smoke-test helper that parses a JAR file, writes pretty-printed parsed class structures under `<jar parent>/output/<jar stem>/parsed/`, and writes class-model-derived rewritten `.class` files plus copied resources under `<jar parent>/output/<jar stem>/rewritten/`.
|
|
211
221
|
|
|
212
222
|
Example:
|
|
213
223
|
|
|
214
224
|
```powershell
|
|
215
|
-
uv run python
|
|
225
|
+
uv run python ./run.py ./path/to/input.jar
|
|
216
226
|
```
|
|
217
227
|
|
|
218
228
|
The script prints read, parse, lift, write, and rewrite timings plus class and resource counts to stdout.
|
|
@@ -140,13 +140,13 @@ uv run ruff check .
|
|
|
140
140
|
uv run ruff format --check .
|
|
141
141
|
uv run basedpyright
|
|
142
142
|
uv run pytest -q
|
|
143
|
-
uv run python tools
|
|
143
|
+
uv run python tools/generate_api_docs.py --check
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
Generate local API reference HTML with:
|
|
147
147
|
|
|
148
148
|
```powershell
|
|
149
|
-
uv run python tools
|
|
149
|
+
uv run python tools/generate_api_docs.py
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
Build source and wheel distributions locally:
|
|
@@ -155,11 +155,21 @@ Build source and wheel distributions locally:
|
|
|
155
155
|
uv build
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
Profile isolated JAR-processing stages without `run.py`'s output overhead:
|
|
159
|
+
|
|
160
|
+
```powershell
|
|
161
|
+
uv run python tools/profile_jar_pipeline.py path/to/jar.jar
|
|
162
|
+
uv run python tools/profile_jar_pipeline.py path/to/jar.jar --stages class-parse model-lift model-lower
|
|
163
|
+
uv run python tools/profile_jar_pipeline.py path/to/dir/with/jars --stages model-lift model-lower --summary-json output/profiles/common-libs/summary.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
When making runtime-performance changes, prefer checking both a focused jar such as `225.jar` and the wider common-jar corpus so regressions and wins are not judged from a single artifact. A single jar defaults to all stages; directories and multi-jar runs default to `model-lift` and `model-lower`.
|
|
167
|
+
|
|
168
|
+
The `oracle`-marked CFG tests lazily cache ASM 9.7.1 test jars under `.pytest_cache/pytecode-oracle` and also honor manually seeded jars in `tests/resources/oracle/lib`. If `java`, `javac`, or the ASM jars are unavailable, that suite skips without failing the rest of the test run.
|
|
159
169
|
|
|
160
170
|
## Release automation
|
|
161
171
|
|
|
162
|
-
PyPI releases are published from GitHub Actions by pushing an immutable `v<version>` tag that matches `project.version` in `pyproject.toml`. The
|
|
172
|
+
PyPI releases are published from GitHub Actions by pushing an immutable `v<version>` tag that matches `project.version` in `pyproject.toml`. The same workflow can also be started manually for an existing tag by supplying a `tag` input. In both cases, the workflow checks out the tagged commit, reruns validation, builds both `sdist` and `wheel` with `uv build`, publishes from the protected `pypi` environment via PyPI Trusted Publishing, and then creates or updates a GitHub Release for the same tag with the built distributions attached.
|
|
163
173
|
|
|
164
174
|
Release procedure:
|
|
165
175
|
|
|
@@ -169,7 +179,7 @@ uv run ruff check .
|
|
|
169
179
|
uv run ruff format --check .
|
|
170
180
|
uv run basedpyright
|
|
171
181
|
uv run pytest -q
|
|
172
|
-
uv run python tools
|
|
182
|
+
uv run python tools/generate_api_docs.py --check
|
|
173
183
|
|
|
174
184
|
git commit -am "Bump version to X.Y.Z"
|
|
175
185
|
git push origin master
|
|
@@ -177,16 +187,16 @@ git tag vX.Y.Z
|
|
|
177
187
|
git push origin vX.Y.Z
|
|
178
188
|
```
|
|
179
189
|
|
|
180
|
-
The release workflow rejects tags that do not match `project.version`. Treat release tags as immutable: if a tag or published artifact is wrong, bump to a new version and publish a new tag instead of force-pushing the old one.
|
|
190
|
+
The release workflow rejects tags that do not match `project.version`. Treat release tags as immutable: if a tag or published artifact is wrong, bump to a new version and publish a new tag instead of force-pushing the old one. For an existing tag, you can rerun the workflow directly or start it manually from Actions by providing the tag name. The workflow is safe to rerun for the same tag: PyPI uploads skip files that already exist, and the GitHub Release step updates the existing release assets in place if the release was already created.
|
|
181
191
|
|
|
182
192
|
## Repository utilities
|
|
183
193
|
|
|
184
|
-
`run.py` is a manual smoke-test helper that parses a JAR file, writes pretty-printed parsed class structures under `<jar parent
|
|
194
|
+
`run.py` is a manual smoke-test helper that parses a JAR file, writes pretty-printed parsed class structures under `<jar parent>/output/<jar stem>/parsed/`, and writes class-model-derived rewritten `.class` files plus copied resources under `<jar parent>/output/<jar stem>/rewritten/`.
|
|
185
195
|
|
|
186
196
|
Example:
|
|
187
197
|
|
|
188
198
|
```powershell
|
|
189
|
-
uv run python
|
|
199
|
+
uv run python ./run.py ./path/to/input.jar
|
|
190
200
|
```
|
|
191
201
|
|
|
192
202
|
The script prints read, parse, lift, write, and rewrite timings plus class and resource counts to stdout.
|