Cortical Labs Application Packager
This module is a command-line tool only and cannot be imported directly.
Usage:
python -m cl.app.pack [target_directory]
Without arguments, packages the application in the current directory. With a path argument, packages the application at that path.
The packager performs the following validation steps:
Folder name validation - Verifies the application folder name:
- Contains only alphanumeric characters, hyphens, underscores, and periods
- Warns if using the
cl-prefix (reserved for system applications)
Structure validation - Checks for required files:
info.jsondefault.jsonsrc/__init__.py
info.json validation - Validates application metadata:
- File is valid JSON
- Contains required fields:
name,version,description,author,config_version - Field types are correct (strings and integer for
config_version)
Web visualisation validation - If
web/directory exists:- Both
vis.htmlandvis.mjsmust be present together vis.mjsmust defineconst dataStreams = [...]vis.mjsmust definefunction createVisualiser(uniqueId, div)
- Both
Import validation - Verifies the application code:
- The application can be imported without errors
- An
applicationvariable is defined insrc/__init__.py - The
applicationis an instance ofcl.app.BaseApplication - The application's config class can be retrieved
Configuration validation - Validates configuration files:
default.jsonis valid JSON with required fields (name,timeout_s)- All
presets/*.jsonfiles are valid JSON with required fields - All configuration files can be deserialized using the application's config class
- No duplicate config names across default and presets
Packaging - Creates a ZIP archive containing the application folder. The following are automatically excluded:
- OS-generated files (
.DS_Store,Thumbs.db, etc.) - Python cache (
__pycache__,*.pyc) - Hidden directories (starting with
.) - Version control directories (
.git,.svn,.hg) - Editor/IDE files (
.vscode,.idea)
- OS-generated files (
The output ZIP is created in the parent directory of the target,
named <folder_name>.zip.
Note: A warning (not error) is issued if the uncompressed package size exceeds 100 MB.
Example:
Package an application:
cd my-app python -m cl.app.pack # Creates ../my-app.zip