xpline 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,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First release.
6
+
7
+ - Four-stage bundler: load, analyze, names, emit
8
+ - CLI: `xpline`, `python3 -m xpline`, and the repo wrapper `bundler.py`
9
+ - Self-bundled single-file CLI at `dist/xpline.py`
10
+ - `--debug-dir` stage snapshots and `--list-stages`
xpline-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xpline 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,6 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ include bundler.py
5
+ include dist/xpline.py
6
+ recursive-include tests *.py
xpline-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: xpline
3
+ Version: 0.1.0
4
+ Summary: Bundle a Python program into a single readable source file.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/Naimy441/xpline
7
+ Project-URL: Repository, https://github.com/Naimy441/xpline
8
+ Project-URL: Issues, https://github.com/Naimy441/xpline/issues
9
+ Project-URL: Changelog, https://github.com/Naimy441/xpline/blob/main/CHANGELOG.md
10
+ Keywords: bundler,inline,ast,single-file
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Build Tools
20
+ Classifier: Topic :: Software Development :: Code Generators
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: numpy; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # xpline
29
+
30
+ Explain + Inline = Expline → Xpline
31
+
32
+ Flatten a Python program into one readable `.py` file. xpline follows imports, keeps reachable source, and emits a single file you can still read and run.
33
+
34
+ Local modules and many pure-Python third-party packages are inlined. The standard library, C extensions, and a few identity-sensitive modules stay as normal imports. This is not PyInstaller, zipapp, or a dependency freezer — the output still needs a Python interpreter and whatever it still imports.
35
+
36
+ Requires **Python 3.9+**.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install xpline
42
+ ```
43
+
44
+ From a checkout:
45
+
46
+ ```bash
47
+ pip install .
48
+ ```
49
+
50
+ Or skip install and use the self-bundled CLI:
51
+
52
+ ```bash
53
+ python3 dist/xpline.py app.py -o app_bundle.py
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ ```bash
59
+ xpline app.py -o app_bundle.py
60
+ python3 -m xpline app.py -o app_bundle.py
61
+ ```
62
+
63
+ From a checkout, `python3 bundler.py app.py -o app_bundle.py` is the same command.
64
+
65
+ ### Library
66
+
67
+ ```python
68
+ from pathlib import Path
69
+ from xpline import bundle_file
70
+
71
+ bundle_file(Path("app.py"), Path("app_bundle.py"))
72
+ ```
73
+
74
+ ### Debug a run
75
+
76
+ `--debug-dir` writes `01_load.json`, `02_analyze.json`, `03_names.json`, and `04_emit.py` so you can see what each stage decided.
77
+
78
+ ```bash
79
+ xpline app.py -o app_bundle.py --debug-dir .xpline-debug
80
+ xpline --list-stages
81
+ xpline --version
82
+ xpline --self-bundle -o dist/xpline.py
83
+ ```
84
+
85
+ ## What stays as an import
86
+
87
+ - The standard library
88
+ - C extensions, builtins, and frozen modules
89
+ - `matplotlib.font_manager` — Agg/FreeType compare `FontProperties` by class identity
90
+ - Anything xpline cannot load as `.py` source
91
+
92
+ ## Limitations
93
+
94
+ - `if TYPE_CHECKING:` blocks are dropped
95
+ - Analysis errors out after 50,000 reachable symbols
96
+ - Bundled output may include `_xpline_setglobal` or `__xpline_restore_class_name` helpers when flattening needs them
97
+
98
+ ## How it works
99
+
100
+ Source lives in `xpline/`. Each stage is its own module so you can read and debug them separately. Those stages are then bundled back into `dist/xpline.py` to show the tool working on itself.
101
+
102
+ ```
103
+ xpline/
104
+ models.py shared types
105
+ astutil.py AST helpers
106
+ resolve.py module lookup
107
+ pipeline.py runs the stages
108
+ cli.py
109
+ stages/
110
+ load.py 01 parse and index
111
+ analyze.py 02 keep reachable code
112
+ names.py 03 allocate flatten-safe names
113
+ emit.py 04 rewrite and interleave
114
+ rewrite.py AST rewrite used by emit
115
+ tests/
116
+ dist/xpline.py self-bundled CLI (generated)
117
+ bundler.py thin wrapper: python3 bundler.py in.py -o out.py
118
+ ```
119
+
120
+ ## Develop
121
+
122
+ ```bash
123
+ pip install -e ".[dev]"
124
+ python3 -m unittest tests.test_pipeline tests.test_bundler
125
+ ```
126
+
127
+ `tests/test_popular_modules.py`, `tests/test_extra_modules.py`, and `tests/test_matplotlib.py` skip packages that are not installed.
128
+
129
+ ## License
130
+
131
+ MIT
xpline-0.1.0/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # xpline
2
+
3
+ Explain + Inline = Expline → Xpline
4
+
5
+ Flatten a Python program into one readable `.py` file. xpline follows imports, keeps reachable source, and emits a single file you can still read and run.
6
+
7
+ Local modules and many pure-Python third-party packages are inlined. The standard library, C extensions, and a few identity-sensitive modules stay as normal imports. This is not PyInstaller, zipapp, or a dependency freezer — the output still needs a Python interpreter and whatever it still imports.
8
+
9
+ Requires **Python 3.9+**.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install xpline
15
+ ```
16
+
17
+ From a checkout:
18
+
19
+ ```bash
20
+ pip install .
21
+ ```
22
+
23
+ Or skip install and use the self-bundled CLI:
24
+
25
+ ```bash
26
+ python3 dist/xpline.py app.py -o app_bundle.py
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ xpline app.py -o app_bundle.py
33
+ python3 -m xpline app.py -o app_bundle.py
34
+ ```
35
+
36
+ From a checkout, `python3 bundler.py app.py -o app_bundle.py` is the same command.
37
+
38
+ ### Library
39
+
40
+ ```python
41
+ from pathlib import Path
42
+ from xpline import bundle_file
43
+
44
+ bundle_file(Path("app.py"), Path("app_bundle.py"))
45
+ ```
46
+
47
+ ### Debug a run
48
+
49
+ `--debug-dir` writes `01_load.json`, `02_analyze.json`, `03_names.json`, and `04_emit.py` so you can see what each stage decided.
50
+
51
+ ```bash
52
+ xpline app.py -o app_bundle.py --debug-dir .xpline-debug
53
+ xpline --list-stages
54
+ xpline --version
55
+ xpline --self-bundle -o dist/xpline.py
56
+ ```
57
+
58
+ ## What stays as an import
59
+
60
+ - The standard library
61
+ - C extensions, builtins, and frozen modules
62
+ - `matplotlib.font_manager` — Agg/FreeType compare `FontProperties` by class identity
63
+ - Anything xpline cannot load as `.py` source
64
+
65
+ ## Limitations
66
+
67
+ - `if TYPE_CHECKING:` blocks are dropped
68
+ - Analysis errors out after 50,000 reachable symbols
69
+ - Bundled output may include `_xpline_setglobal` or `__xpline_restore_class_name` helpers when flattening needs them
70
+
71
+ ## How it works
72
+
73
+ Source lives in `xpline/`. Each stage is its own module so you can read and debug them separately. Those stages are then bundled back into `dist/xpline.py` to show the tool working on itself.
74
+
75
+ ```
76
+ xpline/
77
+ models.py shared types
78
+ astutil.py AST helpers
79
+ resolve.py module lookup
80
+ pipeline.py runs the stages
81
+ cli.py
82
+ stages/
83
+ load.py 01 parse and index
84
+ analyze.py 02 keep reachable code
85
+ names.py 03 allocate flatten-safe names
86
+ emit.py 04 rewrite and interleave
87
+ rewrite.py AST rewrite used by emit
88
+ tests/
89
+ dist/xpline.py self-bundled CLI (generated)
90
+ bundler.py thin wrapper: python3 bundler.py in.py -o out.py
91
+ ```
92
+
93
+ ## Develop
94
+
95
+ ```bash
96
+ pip install -e ".[dev]"
97
+ python3 -m unittest tests.test_pipeline tests.test_bundler
98
+ ```
99
+
100
+ `tests/test_popular_modules.py`, `tests/test_extra_modules.py`, and `tests/test_matplotlib.py` skip packages that are not installed.
101
+
102
+ ## License
103
+
104
+ MIT
@@ -0,0 +1,17 @@
1
+ """Compatibility entry for the staged package: python3 bundler.py in.py -o out.py"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ sys.path.insert(0, str(Path(__file__).resolve().parent))
9
+
10
+ from xpline.cli import main
11
+ from xpline.pipeline import Bundler, bundle_file
12
+
13
+ __all__ = ["Bundler", "bundle_file", "main"]
14
+
15
+
16
+ if __name__ == "__main__":
17
+ raise SystemExit(main())