pychd


Namepychd JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryThe ChatGPT-powered decompiler for Python, providing superior code analysis capabilities
upload_time2024-06-23 13:41:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyChD

[![CI](https://github.com/diohabara/pychd/actions/workflows/ci.yml/badge.svg)](https://github.com/diohabara/pychd/actions/workflows/ci.yml)
[![PyPI Version](https://img.shields.io/pypi/v/pychd.svg)](https://pypi.python.org/pypi/pychd)

The ChatGPT-powered decompiler for Python, providing superior code analysis capabilities

## Usage

### Install

From pip

```bash
pip install pychd
```

### Compile

```bash
pychd compile <directory | file> # you need to specify a directory or a .py file
```

E.g.,

```bash
pychd compile examples/01_example_variables.py # `example/__pycache__/01_example_variables.cpython-310.pyc` will be created
```

### Decompile

```bash
pychd decompile <pyc-file> # you need to specify a .pyc file
```

E.g.,

```bash
pychd decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompiled code will be printed
```

```bash
pychd decompile example/__pycache__/01_example_variables.cpython-310.pyc -o example/decompiled/01_example_variables.cpython-310.py # decompiled code will be written to `example/decompiled/01_example_variables.cpython-310.py`
```

## Examples

You can find examples in `example` directory.

## Development

### Setup

1. Install [rye](https://rye.astral.sh/guide/installation/).

2. Install all dependencies.

```bash
rye sync --all-features
```

3. Set `OPENAI_API_KEY` environment variable. If you're using `direnv`, you can use `.envrc.template` as a template.

4. Run the compiler/decompiler.

Using scripts:

```bash
rye run python -m pychd.main compile examples/01_example_variables.py # compile
```

```bash
rye run python -m pychd.main decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompile
```

Activating the virtual environment:

```bash
. .venv/bin/activate
```

```bash
python -m pychd.main compile example/python/01_example_variables.py # compile
```

```bash
python -m pychd.main decompile example/python/01_example_variables.pyc # decompile
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pychd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "\u534ddiohabara\u534d <diohabara@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/5e/3f/9d87cbc333ce25e20f01f16d59ee26de02ed3e19f74770a8c84faee34437/pychd-0.2.4.tar.gz",
    "platform": null,
    "description": "# PyChD\n\n[![CI](https://github.com/diohabara/pychd/actions/workflows/ci.yml/badge.svg)](https://github.com/diohabara/pychd/actions/workflows/ci.yml)\n[![PyPI Version](https://img.shields.io/pypi/v/pychd.svg)](https://pypi.python.org/pypi/pychd)\n\nThe ChatGPT-powered decompiler for Python, providing superior code analysis capabilities\n\n## Usage\n\n### Install\n\nFrom pip\n\n```bash\npip install pychd\n```\n\n### Compile\n\n```bash\npychd compile <directory | file> # you need to specify a directory or a .py file\n```\n\nE.g.,\n\n```bash\npychd compile examples/01_example_variables.py # `example/__pycache__/01_example_variables.cpython-310.pyc` will be created\n```\n\n### Decompile\n\n```bash\npychd decompile <pyc-file> # you need to specify a .pyc file\n```\n\nE.g.,\n\n```bash\npychd decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompiled code will be printed\n```\n\n```bash\npychd decompile example/__pycache__/01_example_variables.cpython-310.pyc -o example/decompiled/01_example_variables.cpython-310.py # decompiled code will be written to `example/decompiled/01_example_variables.cpython-310.py`\n```\n\n## Examples\n\nYou can find examples in `example` directory.\n\n## Development\n\n### Setup\n\n1. Install [rye](https://rye.astral.sh/guide/installation/).\n\n2. Install all dependencies.\n\n```bash\nrye sync --all-features\n```\n\n3. Set `OPENAI_API_KEY` environment variable. If you're using `direnv`, you can use `.envrc.template` as a template.\n\n4. Run the compiler/decompiler.\n\nUsing scripts:\n\n```bash\nrye run python -m pychd.main compile examples/01_example_variables.py # compile\n```\n\n```bash\nrye run python -m pychd.main decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompile\n```\n\nActivating the virtual environment:\n\n```bash\n. .venv/bin/activate\n```\n\n```bash\npython -m pychd.main compile example/python/01_example_variables.py # compile\n```\n\n```bash\npython -m pychd.main decompile example/python/01_example_variables.pyc # decompile\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The ChatGPT-powered decompiler for Python, providing superior code analysis capabilities",
    "version": "0.2.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0eb6a648b6929edf76bf0b9c04cd8edad9926f666434f565239431e78b54d7c",
                "md5": "f5ede859719df7d5b31eac21c554dcc2",
                "sha256": "687a7b3b30ed5f598a992bf31f2f41a50922ddf8fd580a00784c4cd176299185"
            },
            "downloads": -1,
            "filename": "pychd-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f5ede859719df7d5b31eac21c554dcc2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 6163,
            "upload_time": "2024-06-23T13:41:43",
            "upload_time_iso_8601": "2024-06-23T13:41:43.009955Z",
            "url": "https://files.pythonhosted.org/packages/f0/eb/6a648b6929edf76bf0b9c04cd8edad9926f666434f565239431e78b54d7c/pychd-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e3f9d87cbc333ce25e20f01f16d59ee26de02ed3e19f74770a8c84faee34437",
                "md5": "08032c894540d9b264664055d2a6c944",
                "sha256": "ca63e6b323fee8ffdcd6db75ffb24b047bb078e4fc1f43df3234f7df16c3172f"
            },
            "downloads": -1,
            "filename": "pychd-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "08032c894540d9b264664055d2a6c944",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 5121,
            "upload_time": "2024-06-23T13:41:44",
            "upload_time_iso_8601": "2024-06-23T13:41:44.612888Z",
            "url": "https://files.pythonhosted.org/packages/5e/3f/9d87cbc333ce25e20f01f16d59ee26de02ed3e19f74770a8c84faee34437/pychd-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-23 13:41:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pychd"
}
        
Elapsed time: 5.23800s