dashc


Namedashc JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryTool to generate python -c bash as if it were a package format.
upload_time2025-08-31 23:29:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords bash packaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dashc

Tool to generate `python -c` bash scripts as if they were a package format.

---

## About

`dashc` lets you bundle Python source code (a single file or an entire package) into a executable shell script.
Instead of shipping loose files, you can hand over a bash command (or `.sh` script) that self-contains your Python logic and runs without needing to touch the filesystem.

Features:

* **Single file mode** – wrap a single `.py` into a compressed string or plain text.
* **Module mode** – zip up a package with `__main__.py` or a specified `module:function` entrypoint.
* **Bash-friendly** – outputs either a plain (`python -c '...'`) or a script with a shebang.
* **Validates syntax** – checks both Python and Bash syntax before generating.

---

## Installation

It is recommended to install with [pipx](https://pypa.github.io/pipx/):

```bash
pipx install dashc
```

This keeps `dashc` isolated in its own environment while making the CLI available globally.

---

## Usage

Run with:

```bash
dashc [--version] [--verbose|--quiet|--dry-run] <command> [options]
```

Global options:

* `--version` – show version
* `--verbose` – debug logging
* `--quiet` – suppress logs except errors
* `--dry-run` – simulate actions without writing files

### Commands

* `file` – Compile a single `.py` into a script.
* `module` – Package a directory and run `__main__.py` or a chosen entrypoint.

---

## Example

**Single file to script:**

```bash
dashc file send_email.py --out run_send_email.sh
./run_send_email.sh --to test@example.com
```

**Single file to script:**

```bash
dashc file send_email.py --one-line
# -> prints a bash command like: python -c '...'
```

**Module with `__main__.py`:**

```bash
dashc module ./send_email --out run_pkg.sh
./run_pkg.sh --config config.yaml
```

**Module with function entrypoint:**

```bash
dashc module ./send_email --entrypoint send_email.cli:main --out run_cli.sh
./run_cli.sh --to test@example.com
```

---

## Prior Art / Alternatives

* **zipapp** (`python -m zipapp`) – Standard library tool for packaging Python code into `.pyz` archives runnable with Python.
* **shiv**, **pex** – Build self-contained Python executables with full dependency resolution.
* **pyinstaller** – Freezes Python programs into standalone executables.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dashc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "bash, packaging",
    "author": null,
    "author_email": "Matthew Martin <matthewdeanmartin@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e2/90/7a9b3be9d44a312c3c5e77245343e2ff2f7745aa4983c5c84560d2369025/dashc-0.1.1.tar.gz",
    "platform": null,
    "description": "# dashc\n\nTool to generate `python -c` bash scripts as if they were a package format.\n\n---\n\n## About\n\n`dashc` lets you bundle Python source code (a single file or an entire package) into a executable shell script.\nInstead of shipping loose files, you can hand over a bash command (or `.sh` script) that self-contains your Python logic and runs without needing to touch the filesystem.\n\nFeatures:\n\n* **Single file mode** \u2013 wrap a single `.py` into a compressed string or plain text.\n* **Module mode** \u2013 zip up a package with `__main__.py` or a specified `module:function` entrypoint.\n* **Bash-friendly** \u2013 outputs either a plain (`python -c '...'`) or a script with a shebang.\n* **Validates syntax** \u2013 checks both Python and Bash syntax before generating.\n\n---\n\n## Installation\n\nIt is recommended to install with [pipx](https://pypa.github.io/pipx/):\n\n```bash\npipx install dashc\n```\n\nThis keeps `dashc` isolated in its own environment while making the CLI available globally.\n\n---\n\n## Usage\n\nRun with:\n\n```bash\ndashc [--version] [--verbose|--quiet|--dry-run] <command> [options]\n```\n\nGlobal options:\n\n* `--version` \u2013 show version\n* `--verbose` \u2013 debug logging\n* `--quiet` \u2013 suppress logs except errors\n* `--dry-run` \u2013 simulate actions without writing files\n\n### Commands\n\n* `file` \u2013 Compile a single `.py` into a script.\n* `module` \u2013 Package a directory and run `__main__.py` or a chosen entrypoint.\n\n---\n\n## Example\n\n**Single file to script:**\n\n```bash\ndashc file send_email.py --out run_send_email.sh\n./run_send_email.sh --to test@example.com\n```\n\n**Single file to script:**\n\n```bash\ndashc file send_email.py --one-line\n# -> prints a bash command like: python -c '...'\n```\n\n**Module with `__main__.py`:**\n\n```bash\ndashc module ./send_email --out run_pkg.sh\n./run_pkg.sh --config config.yaml\n```\n\n**Module with function entrypoint:**\n\n```bash\ndashc module ./send_email --entrypoint send_email.cli:main --out run_cli.sh\n./run_cli.sh --to test@example.com\n```\n\n---\n\n## Prior Art / Alternatives\n\n* **zipapp** (`python -m zipapp`) \u2013 Standard library tool for packaging Python code into `.pyz` archives runnable with Python.\n* **shiv**, **pex** \u2013 Build self-contained Python executables with full dependency resolution.\n* **pyinstaller** \u2013 Freezes Python programs into standalone executables.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tool to generate python -c bash as if it were a package format.",
    "version": "0.1.1",
    "project_urls": {
        "Changelog": "https://github.com/matthewdeanmartin/dashc/blob/main/CHANGELOG.md",
        "Repository": "https://github.com/matthewdeanmartin/dashc",
        "homepage": "https://github.com/matthewdeanmartin/dashc",
        "issues": "https://github.com/matthewdeanmartin/dashc/issues/"
    },
    "split_keywords": [
        "bash",
        " packaging"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b7b0fa8a931913611f166ebb3852bcd08bb440b0b837112c43607b3c88882b95",
                "md5": "ff91f17e6cb499441030f93bdf3ed2e4",
                "sha256": "76a444dabc2563f4a3251a3d066c2dc69b9e6a6d1adb2c1ee6bee740d02e2541"
            },
            "downloads": -1,
            "filename": "dashc-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff91f17e6cb499441030f93bdf3ed2e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17841,
            "upload_time": "2025-08-31T23:29:54",
            "upload_time_iso_8601": "2025-08-31T23:29:54.494234Z",
            "url": "https://files.pythonhosted.org/packages/b7/b0/fa8a931913611f166ebb3852bcd08bb440b0b837112c43607b3c88882b95/dashc-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e2907a9b3be9d44a312c3c5e77245343e2ff2f7745aa4983c5c84560d2369025",
                "md5": "ccee497ad6c91c508a5786e9e24c3bf6",
                "sha256": "f40a8f0290c944adbb947d2f2a13d03d46bc4988cd0bb4665f34d7eefcb00302"
            },
            "downloads": -1,
            "filename": "dashc-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ccee497ad6c91c508a5786e9e24c3bf6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22752,
            "upload_time": "2025-08-31T23:29:55",
            "upload_time_iso_8601": "2025-08-31T23:29:55.927460Z",
            "url": "https://files.pythonhosted.org/packages/e2/90/7a9b3be9d44a312c3c5e77245343e2ff2f7745aa4983c5c84560d2369025/dashc-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-31 23:29:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matthewdeanmartin",
    "github_project": "dashc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "dashc"
}
        
Elapsed time: 1.14138s