coil-compiler 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.
Files changed (51) hide show
  1. coil_compiler-0.1.0/LICENSE +200 -0
  2. coil_compiler-0.1.0/PKG-INFO +417 -0
  3. coil_compiler-0.1.0/README.md +390 -0
  4. coil_compiler-0.1.0/pyproject.toml +50 -0
  5. coil_compiler-0.1.0/setup.cfg +4 -0
  6. coil_compiler-0.1.0/src/coil/__init__.py +3 -0
  7. coil_compiler-0.1.0/src/coil/__main__.py +5 -0
  8. coil_compiler-0.1.0/src/coil/bootloader.py +654 -0
  9. coil_compiler-0.1.0/src/coil/builder.py +197 -0
  10. coil_compiler-0.1.0/src/coil/cli.py +679 -0
  11. coil_compiler-0.1.0/src/coil/config.py +177 -0
  12. coil_compiler-0.1.0/src/coil/decompiler.py +101 -0
  13. coil_compiler-0.1.0/src/coil/doctor.py +221 -0
  14. coil_compiler-0.1.0/src/coil/inspect.py +224 -0
  15. coil_compiler-0.1.0/src/coil/obfuscator.py +195 -0
  16. coil_compiler-0.1.0/src/coil/packager.py +774 -0
  17. coil_compiler-0.1.0/src/coil/platforms/__init__.py +28 -0
  18. coil_compiler-0.1.0/src/coil/platforms/base.py +48 -0
  19. coil_compiler-0.1.0/src/coil/platforms/linux.py +25 -0
  20. coil_compiler-0.1.0/src/coil/platforms/macos.py +25 -0
  21. coil_compiler-0.1.0/src/coil/platforms/windows.py +297 -0
  22. coil_compiler-0.1.0/src/coil/py.typed +0 -0
  23. coil_compiler-0.1.0/src/coil/resolver.py +125 -0
  24. coil_compiler-0.1.0/src/coil/runtime.py +261 -0
  25. coil_compiler-0.1.0/src/coil/scanner.py +68 -0
  26. coil_compiler-0.1.0/src/coil/ui.py +194 -0
  27. coil_compiler-0.1.0/src/coil/utils/__init__.py +0 -0
  28. coil_compiler-0.1.0/src/coil/utils/compat.py +21 -0
  29. coil_compiler-0.1.0/src/coil/utils/fs.py +47 -0
  30. coil_compiler-0.1.0/src/coil/utils/gui_frameworks.py +31 -0
  31. coil_compiler-0.1.0/src/coil/utils/package_map.py +62 -0
  32. coil_compiler-0.1.0/src/coil/utils/stdlib_list.py +102 -0
  33. coil_compiler-0.1.0/src/coil/utils/stdlib_strip.py +25 -0
  34. coil_compiler-0.1.0/src/coil_compiler.egg-info/PKG-INFO +417 -0
  35. coil_compiler-0.1.0/src/coil_compiler.egg-info/SOURCES.txt +49 -0
  36. coil_compiler-0.1.0/src/coil_compiler.egg-info/dependency_links.txt +1 -0
  37. coil_compiler-0.1.0/src/coil_compiler.egg-info/entry_points.txt +2 -0
  38. coil_compiler-0.1.0/src/coil_compiler.egg-info/requires.txt +1 -0
  39. coil_compiler-0.1.0/src/coil_compiler.egg-info/top_level.txt +1 -0
  40. coil_compiler-0.1.0/tests/test_builder.py +315 -0
  41. coil_compiler-0.1.0/tests/test_cli.py +358 -0
  42. coil_compiler-0.1.0/tests/test_config.py +154 -0
  43. coil_compiler-0.1.0/tests/test_decompiler.py +124 -0
  44. coil_compiler-0.1.0/tests/test_doctor.py +150 -0
  45. coil_compiler-0.1.0/tests/test_inspect.py +158 -0
  46. coil_compiler-0.1.0/tests/test_packager.py +385 -0
  47. coil_compiler-0.1.0/tests/test_platforms.py +226 -0
  48. coil_compiler-0.1.0/tests/test_resolver.py +134 -0
  49. coil_compiler-0.1.0/tests/test_runtime.py +89 -0
  50. coil_compiler-0.1.0/tests/test_scanner.py +122 -0
  51. coil_compiler-0.1.0/tests/test_ui.py +182 -0
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. Please also get an in-depth
185
+ understanding of the text from the ASF at
186
+ http://www.apache.org/foundation/license-faq.html
187
+
188
+ Copyright 2025 Nathan Curtis
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,417 @@
1
+ Metadata-Version: 2.4
2
+ Name: coil-compiler
3
+ Version: 0.1.0
4
+ Summary: A Python-to-executable compiler that just works.
5
+ Author: Nathan Curtis
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/nathannncurtis/coil
8
+ Project-URL: Repository, https://github.com/nathannncurtis/coil
9
+ Project-URL: Issues, https://github.com/nathannncurtis/coil/issues
10
+ Keywords: compiler,executable,exe,packaging,distribution
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: Microsoft :: Windows
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: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Build Tools
21
+ Classifier: Topic :: Software Development :: Compilers
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: rich>=13.0
26
+ Dynamic: license-file
27
+
28
+ # Coil
29
+
30
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
31
+ ![License](https://img.shields.io/badge/license-Apache%202.0-green)
32
+ ![Platform](https://img.shields.io/badge/platform-Windows-lightgrey)
33
+ ![Version](https://img.shields.io/badge/version-0.1.0-orange)
34
+
35
+ **A Python-to-executable compiler that just works.**
36
+
37
+ ---
38
+
39
+ ## Why Coil?
40
+
41
+ Existing tools for turning Python projects into executables — PyInstaller, cx_Freeze, Nuitka, py2exe — all share the same problem: they're complicated. Hidden imports, missing DLLs, spec files, hook scripts, cryptic errors. You spend more time fighting the tool than building your app.
42
+
43
+ Coil takes a different approach: **directory in, executable out.** Point it at your project folder, and it handles the rest. No spec files. No hook scripts. No per-file configuration.
44
+
45
+ - Auto-detects entry points
46
+ - Auto-detects dependencies (or reads your requirements.txt)
47
+ - Bundles an embedded Python runtime — no Python installation needed on the target machine
48
+ - Produces a single portable .exe or a clean bundled directory
49
+ - Built-in decompiler to recover your own source if you need it
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ pip install coil-compiler
55
+ coil init ./myproject # Generate coil.toml config
56
+ coil build ./myproject # Build your executable
57
+ ```
58
+
59
+ Or, if `coil` isn't on your PATH:
60
+
61
+ ```bash
62
+ python -m coil init ./myproject
63
+ python -m coil build ./myproject
64
+ ```
65
+
66
+ That's it. Your executable is in `./dist/`.
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install coil-compiler
72
+ ```
73
+
74
+ **Requirements:**
75
+ - Python 3.9 or later
76
+ - Windows (macOS and Linux support planned)
77
+ - pip (for dependency installation during builds)
78
+
79
+ > **Windows note:** If `coil` isn't recognized after install, your pip Scripts directory may not be on PATH. You can either:
80
+ > - Use `python -m coil` instead (works the same way — all examples below apply)
81
+ > - Or add Python's Scripts directory to your PATH (`python -m site --user-site` will show you where it is)
82
+
83
+ ## Usage
84
+
85
+ ### Basic Build
86
+
87
+ ```bash
88
+ # Auto-detect entry point, build portable exe
89
+ coil build ./myproject
90
+ ```
91
+
92
+ ### Specify Entry Point
93
+
94
+ ```bash
95
+ coil build ./myproject --entry app.py
96
+ ```
97
+
98
+ ### Portable Mode (Default)
99
+
100
+ Single standalone .exe. Copy it anywhere and run it. No installation needed.
101
+
102
+ ```bash
103
+ coil build ./myproject --mode portable
104
+ ```
105
+
106
+ ### Bundled Mode
107
+
108
+ Directory containing compiled application files. Multiple scripts become multiple compiled files.
109
+
110
+ ```bash
111
+ coil build ./myproject --mode bundled
112
+ ```
113
+
114
+ ### GUI Application
115
+
116
+ Coil auto-detects GUI frameworks. If your project imports `tkinter`, `PyQt5`, `PyQt6`, `PySide2`, `PySide6`, `wx`, `kivy`, `pygame`, `pyglet`, `dearpygui`, `customtkinter`, `flet`, `pystray`, `infi.systray`, or `plyer`, the console window is hidden automatically.
117
+
118
+ ```bash
119
+ # No --gui needed — Coil detects tkinter/PyQt5/etc. and hides the console
120
+ coil build ./myproject
121
+
122
+ # Force console window even with GUI imports
123
+ coil build ./myproject --console
124
+
125
+ # Explicitly set GUI mode (redundant if auto-detected, but works)
126
+ coil build ./myproject --gui
127
+ ```
128
+
129
+ ### Specify Python Version
130
+
131
+ ```bash
132
+ coil build ./myproject --python 3.12
133
+ ```
134
+
135
+ ### Dependency Control
136
+
137
+ ```bash
138
+ # Exclude packages
139
+ coil build ./myproject --exclude numpy,pandas
140
+
141
+ # Force-include packages
142
+ coil build ./myproject --include extra-lib
143
+
144
+ # Use a specific requirements file
145
+ coil build ./myproject --requirements ./reqs.txt
146
+ ```
147
+
148
+ ### Multiple Entry Points
149
+
150
+ Each entry point produces its own executable:
151
+
152
+ ```bash
153
+ coil build ./myproject --entry cli.py --entry gui.py --mode bundled
154
+ ```
155
+
156
+ ### Secure Build
157
+
158
+ Heavy obfuscation. Cannot be reversed by `coil decompile`:
159
+
160
+ ```bash
161
+ coil build ./myproject --secure
162
+ ```
163
+
164
+ ### Decompile
165
+
166
+ Recover source from a default (non-secure) Coil build:
167
+
168
+ ```bash
169
+ coil decompile ./dist/MyApp.exe --output ./recovered
170
+ ```
171
+
172
+ Secure builds cannot be decompiled.
173
+
174
+ ### Clean Build
175
+
176
+ Build in an isolated environment with only declared dependencies. Guarantees reproducible builds:
177
+
178
+ ```bash
179
+ coil build ./myproject --clean
180
+ ```
181
+
182
+ The clean environment is cached — subsequent builds reuse it if dependencies haven't changed.
183
+
184
+ ### Project Setup
185
+
186
+ Generate a `coil.toml` config file for your project:
187
+
188
+ ```bash
189
+ coil init ./myproject
190
+ ```
191
+
192
+ This asks a few questions (entry point, console/GUI, icon) and writes a `coil.toml` with sensible defaults. After that, `coil build ./myproject` uses the config automatically — no flags needed.
193
+
194
+ ### Build Profiles
195
+
196
+ Define named profiles in `coil.toml` for different build scenarios:
197
+
198
+ ```toml
199
+ [profile.dev]
200
+ mode = "bundled"
201
+ secure = false
202
+ verbose = true
203
+
204
+ [profile.release]
205
+ mode = "portable"
206
+ secure = true
207
+ ```
208
+
209
+ Switch between them with `--profile`:
210
+
211
+ ```bash
212
+ coil build ./myproject --profile dev
213
+ coil build ./myproject --profile release
214
+ ```
215
+
216
+ CLI flags always override profile settings.
217
+
218
+ ### Pre-Build Diagnostics
219
+
220
+ Check for problems before building:
221
+
222
+ ```bash
223
+ coil doctor ./myproject
224
+ ```
225
+
226
+ Checks Python version, runtime availability, write permissions, config validity, and known package issues.
227
+
228
+ ### Build Preview
229
+
230
+ See what Coil will include in a build without building:
231
+
232
+ ```bash
233
+ coil inspect ./myproject
234
+ ```
235
+
236
+ Shows entry point, dependencies (stdlib vs third-party), estimated output size, and config.
237
+
238
+ ### Dry Run
239
+
240
+ See what would be built without building:
241
+
242
+ ```bash
243
+ coil build ./myproject --dry-run --verbose
244
+ ```
245
+
246
+ ### Full Example
247
+
248
+ ```bash
249
+ coil build ./myproject \
250
+ --entry main.py \
251
+ --mode portable \
252
+ --os windows \
253
+ --python 3.12 \
254
+ --gui \
255
+ --secure \
256
+ --exclude numpy,pandas \
257
+ --output ./dist \
258
+ --name MyApp \
259
+ --icon ./assets/icon.ico
260
+ ```
261
+
262
+ ## How It Works
263
+
264
+ 1. **Dependency Resolution** — Coil checks for a `requirements.txt` or `pyproject.toml`. If neither exists, it scans every `.py` file using Python's `ast` module to find all imports, separates stdlib from third-party, and resolves import names to PyPI packages.
265
+
266
+ 2. **Runtime Bundling** — Downloads the official Windows embeddable Python distribution matching your target version. No C compiler needed.
267
+
268
+ 3. **Compilation** — All `.py` files are compiled to `.pyc` bytecode. No loose `.py` files in the output.
269
+
270
+ 4. **Packaging** — In portable mode, everything is packed into a single `.exe` file. In bundled mode, a clean directory with the runtime, compiled code, and dependencies.
271
+
272
+ ### Portable Mode Details
273
+
274
+ The portable `.exe` is a single file you can copy anywhere and run. Here's what happens under the hood:
275
+
276
+ - **You distribute one file.** The `.exe` contains a lightweight native launcher (~23 KB) with the full application payload appended.
277
+ - **First launch** extracts the runtime to a local cache (`%LOCALAPPDATA%\coil\<app>\<build_hash>\`). This is a one-time operation.
278
+ - **Subsequent launches** detect the cache and start instantly — no extraction needed.
279
+ - **Each build gets a unique hash.** Rebuilding your app creates a new cache entry. Old cache entries are automatically cleaned up (only the 3 most recent are kept).
280
+ - **Cache safety:** Extraction uses file locking to prevent corruption if multiple instances launch simultaneously. A marker file ensures only fully-extracted caches are used — if extraction is interrupted, it will restart cleanly.
281
+
282
+ To manage the cache manually:
283
+
284
+ ```bash
285
+ coil cache info # Show cache location and size
286
+ coil cache clear # Delete all cached runtimes
287
+ ```
288
+
289
+ > **Tip:** If you have a `requirements.txt` or `pyproject.toml`, Coil uses that instead of scanning imports. This is faster and more reliable.
290
+
291
+ ## Configuration (`coil.toml`)
292
+
293
+ Run `coil init` to generate a config file, or create one manually:
294
+
295
+ ```toml
296
+ [project]
297
+ entry = "main.py"
298
+ name = "MyApp"
299
+
300
+ [build]
301
+ mode = "portable"
302
+ os = "windows"
303
+ console = true
304
+ python = "3.12"
305
+ clean = false
306
+
307
+ [build.dependencies]
308
+ # Coil resolves deps automatically from requirements.txt or AST scan
309
+ auto = true
310
+ exclude = []
311
+ include = []
312
+
313
+ [build.output]
314
+ dir = "./dist"
315
+ icon = ""
316
+
317
+ # Profiles override [build] settings
318
+ # [profile.dev]
319
+ # mode = "bundled"
320
+ # secure = false
321
+ # verbose = true
322
+
323
+ # [profile.release]
324
+ # mode = "portable"
325
+ # secure = true
326
+ ```
327
+
328
+ **Priority order:** CLI flags > profile values > `[build]` values > defaults.
329
+
330
+ ## CLI Reference
331
+
332
+ ### Subcommands
333
+
334
+ | Command | Description |
335
+ |---------|-------------|
336
+ | `coil build <project>` | Build a Python project into an executable |
337
+ | `coil init [project]` | Generate a coil.toml config file |
338
+ | `coil doctor [project]` | Run pre-build diagnostics |
339
+ | `coil inspect [project]` | Preview what Coil will include in a build |
340
+ | `coil decompile <exe>` | Recover source from a default Coil build |
341
+ | `coil cache info` | Show cache location and size |
342
+ | `coil cache clear` | Delete all cached runtimes |
343
+
344
+ ### Build Flags
345
+
346
+ | Flag | Default | Description |
347
+ |------|---------|-------------|
348
+ | `--entry` | Auto-detect (`__main__.py` then `main.py`) | Entry point script relative to project dir |
349
+ | `--mode` | `portable` | `portable` (single exe) or `bundled` (directory) |
350
+ | `--os` | Current OS | `windows`, `macos`, `linux` |
351
+ | `--python` | Auto-detect | Target Python version |
352
+ | `--gui` | `false` | Suppress console window |
353
+ | `--console` | `true` | Show console window (default) |
354
+ | `--secure` | `false` | Heavy obfuscation, not reversible |
355
+ | `--clean` | `false` | Build in clean environment with only declared deps |
356
+ | `--profile` | None | Build profile from coil.toml |
357
+ | `--exclude` | None | Comma-separated packages to exclude |
358
+ | `--include` | None | Comma-separated packages to force-include |
359
+ | `--output` | `./dist` | Output directory |
360
+ | `--name` | Project dir name | Output executable name |
361
+ | `--icon` | None | Icon file path (.ico) |
362
+ | `--requirements` | Auto-detect | Path to requirements.txt or pyproject.toml |
363
+ | `--verbose` | `false` | Detailed build output |
364
+ | `--dry-run` | `false` | Preview build without executing |
365
+
366
+ ## Obfuscation
367
+
368
+ **Default mode:** Source is compiled to bytecode and packaged with metadata that `coil decompile` can use to recover the original `.py` files. This is a safety net — not cryptographic security, but your source isn't casually visible.
369
+
370
+ **Secure mode (`--secure`):** Bytecode only, debug info stripped, no recovery metadata. `coil decompile` will refuse to process it. This is stronger but not impenetrable — no bytecode obfuscation is NSA-proof. It's meant to raise the bar, not guarantee secrecy.
371
+
372
+ ## FAQ
373
+
374
+ **Q: Does Coil require Python on the target machine?**
375
+ No. Coil bundles an embedded Python runtime. The resulting executable is fully standalone.
376
+
377
+ **Q: What about C extensions / native modules?**
378
+ Coil bundles `.pyd` / `.dll` files from installed packages. Most packages with C extensions work out of the box.
379
+
380
+ **Q: How big are the executables?**
381
+ A minimal project produces an exe around 15-20 MB (mostly the Python runtime). Dependencies add to that. Coil strips unnecessary files to keep size reasonable.
382
+
383
+ **Q: Can I cross-compile for other platforms?**
384
+ Not yet. Currently Coil only builds Windows executables on Windows. Cross-platform and cross-compilation are on the roadmap.
385
+
386
+ **Q: What's the difference between portable and bundled?**
387
+ Portable = single `.exe` file you can copy anywhere. On first launch, it extracts the runtime to a local cache and runs from there. Later launches reuse the cache and start instantly. Bundled = directory with the executable and its supporting files. No extraction step — it runs directly from the directory.
388
+
389
+ **Q: Where does the portable exe store its cache?**
390
+ `%LOCALAPPDATA%\coil\<AppName>\<build_hash>\`. Run `coil cache info` to see details, or `coil cache clear` to remove it. If `%LOCALAPPDATA%` isn't available, it falls back to `%TEMP%` or the exe's own directory.
391
+
392
+ **Q: Is the portable exe really a single file?**
393
+ Yes. The build output is a single `.exe`. On first run, it extracts a cached copy of the runtime to a local directory. This is not visible to the user as a separate step — the app just starts. Subsequent runs skip extraction entirely.
394
+
395
+ ## Roadmap
396
+
397
+ - macOS .app support
398
+ - Linux ELF binary support
399
+ - ARM64 bootloader for Windows on ARM
400
+ - Cross-compilation
401
+ - Optional runtime signing (helps with AV false positives)
402
+
403
+ ## Contributing
404
+
405
+ Contributions welcome. Open an issue or submit a pull request.
406
+
407
+ ```bash
408
+ # Development setup
409
+ git clone https://github.com/nathannncurtis/coil.git
410
+ cd coil
411
+ pip install -e .
412
+ python -m pytest
413
+ ```
414
+
415
+ ## License
416
+
417
+ Apache License 2.0. See [LICENSE](LICENSE) for the full text.