Metadata-Version: 2.1
Name: scriptcore
Version: 0.1.0
Summary: Embed subfiles (HTML, CSS, JS) inside Python scripts and display them in a native window
Author-email: ScriptCore Contributors <dev@example.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/scriptcore
Project-URL: Documentation, https://github.com/yourusername/scriptcore#readme
Project-URL: Repository, https://github.com/yourusername/scriptcore.git
Project-URL: Issues, https://github.com/yourusername/scriptcore/issues
Keywords: embed,subfiles,html,python,pyside6,viewer
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PySide6

# ScriptCore

ScriptCore is a tiny Python library and standalone script that lets you embed web assets
(HTML/CSS/JS/etc.) directly inside a Python source file.  When the Python file is run, the
`is_main="true"` subfile is extracted and rendered inside a built‑in browser window (via
QtWebEngine) or printed/text‑viewed.

## Features

- HTML/CSS/JS can live alongside Python code in `main.py`.
- Works as a standalone script or as an importable package.
- Embedded viewer uses PySide6 (`QtWebEngine`) for true web rendering.
- Also supports simple CLI extraction/listing via `scriptcore` console command.

## Installation

```powershell
pip install scriptcore          # from PyPI once published
# or for development:
pip install -e .
``` 

PySide6 is a runtime dependency; it is declared in `pyproject.toml` and will be pulled
in automatically.  On platforms where QtWebEngine is unavailable you can still use the
`parse_subfiles`/`write_subfiles_to_dir` API without the viewer.

## Usage as standalone `main.py`

Create a Python file with embedded SCRIPTCORE blocks:

```python
#!/usr/bin/env python3

import re
# (parser code omitted for brevity; see provided template)

SCRIPTCORE subfile
subfile{
    FileType=".html"
    FileID="index.html"
    is_main="true"
    {
        <h1>Hello world</h1>
    }
}
```

Run the script:

```powershell
python main.py
```

A window will open rendering the HTML.  You can copy the standalone script anywhere – it
does not need access to the package directory.

## CLI / Package API

```python
from scriptcore import parse_subfiles, write_subfiles_to_dir, launch_viewer

subs = parse_subfiles(open('main.py').read())
write_subfiles_to_dir(subs, 'out')   # extract files
launch_viewer(subs)                 # open Qt viewer
```

The console script `scriptcore` provides `--source`, `--list`, `--extract`, `--open`.

## Publishing

This project uses a minimal `pyproject.toml` (PEP 621).  To build and upload to
PyPI:

```powershell
python -m build
python -m twine upload dist/*
```

## License

MIT – see LICENSE file.
