Metadata-Version: 2.3
Name: depyinstaller
Version: 0.1.0
Summary: Extract PyInstaller-packed executables to .pyc files
Author: wmymz
Author-email: wmymz <wmymz@icloud.com>
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# depyinstaller

Extract PyInstaller-packed executables back to Python source `.pyc` files.

- Automatically detects the Python version embedded in the executable
- If your Python version doesn't match, tells you exactly which version to use
- Filters out stdlib, third-party dependencies, and PyInstaller bootstrap files — only outputs **your** source code
- Supports PyInstaller 2.0 ~ 6.19.0, Python 3.6+

## Install

```bash
pip install depyinstaller
```

## Usage

```bash
python -m depyinstaller -F <exe_file> -n <output_dir>
```

### Example

```bash
python -m depyinstaller -F app.exe -n output
```

If the Python version matches, you'll get a clean output directory containing only user source `.pyc` files:

```
output/
  main.pyc
  pkg/
    __init__.pyc
    mod.pyc
```

If the version doesn't match:

```
[!] Python version mismatch: this exe requires Python 3.8, but you are running Python 3.14

[*] To fix this, install and run depyinstaller with Python 3.8:
      pip install depyinstaller  # using Python 3.8
      python -m depyinstaller -F app.exe -n output
```

## How it works

1. **Extract** — parses the PyInstaller archive (CArchive + PYZ) and extracts all embedded files
2. **Filter** — identifies user source code by:
   - Selecting entry point scripts (excluding PyInstaller bootstrap like `pyiboot*`, `pyi_rth_*`)
   - Dynamically detecting third-party packages from binary extensions (`.pyd`/`.so`) and `.dist-info` metadata in the archive
   - Filtering out stdlib modules
   - Tracing imports recursively from entry points to find all user modules
3. **Output** — copies only user `.pyc` files to the output directory, preserving the original package structure

## License

GPL-3.0
