A Python tool that packs a LiaScript course — a Markdown file together with all of its relative local dependencies — into a single ZIP archive.
- Accepts a local Markdown file, a direct URL, or a GitHub repository URL as source.
- Automatically discovers and bundles relative assets referenced in the course: images, stylesheets, scripts, audio/video files, and LiaScript
@importmacros. - GitHub repository URLs default to
README.mdon the default branch (resolved via the specialHEADref, so it works with bothmainandmasterbranches). - GitHub blob URLs (
github.com/.../blob/...) are automatically converted to theirraw.githubusercontent.comequivalents. - Missing or inaccessible assets produce a warning but do not abort the packaging.
- Optionally moves the finished ZIP to an upload destination.
With Poetry:
poetry add pack-liascript-courseOr install directly with pip:
pip install pack-liascript-courseOr with pipx for an isolated global install:
pipx install pack-liascript-coursegit clone https://github.com/TUBAF-IfI-LiaScript/pack_liascript_course.git
cd pack_liascript_course
poetry installAfter running poetry install, the pack-liascript-course command is available inside the Poetry environment:
poetry run pack-liascript-course <source>pack-liascript-course <source> [-o OUTPUT] [--upload DEST]
| Argument | Description |
|---|---|
source |
Source of the LiaScript course (local file path, URL, or GitHub repository URL). |
-o, --output OUTPUT |
Output ZIP file path. Defaults to <stem>.zip next to the source file (or the current directory for URLs). |
--upload DEST |
Move the generated ZIP to DEST after creation. DEST may be a file path or a directory. |
Pack a local Markdown file:
pack-liascript-course path/to/course.mdPack from a direct URL:
pack-liascript-course https://example.com/courses/intro.mdPack from a GitHub repository (uses README.md on the default branch):
pack-liascript-course https://github.com/user/my-liascript-coursePack from a specific file in a GitHub repository:
pack-liascript-course https://github.com/user/repo/blob/main/course.mdSpecify a custom output path:
pack-liascript-course course.md -o dist/my_course.zipPack and upload to a deployment directory:
pack-liascript-course course.md --upload /var/www/courses/The pack_course function can also be used directly in Python:
from pack_liascript_course import pack_liascript_course as packer
zip_path = packer.pack_course(
source="path/to/course.md", # local file, URL, or GitHub repo URL
output="dist/course.zip", # optional; defaults to <stem>.zip next to source
upload="/var/www/courses/", # optional; moves the ZIP to this path/directory
)
print(f"ZIP created at: {zip_path}")The tool scans the Markdown source for relative asset references and includes them in the ZIP, preserving the original directory structure:
- Markdown images:
 - Markdown links:
[text](path) - HTML
<img src="...">,<link href="...">,<script src="..."> - HTML
<audio>,<video>, and<source>elements - LiaScript macro imports:
@import 'macros.md'
Only relative paths are included; absolute URLs (starting with http://, https://, //, etc.) are left unchanged.