WhyML is a powerful CLI tool for converting manifests to various application formats including PWAs, SPAs, mobile apps, and more. This guide provides comprehensive installation and setup instructions.
git clone https://github.com/dynapsys/whyml.git
cd whyml
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows:
# venv\Scripts\activate
# Install all required dependencies
pip install -r requirements.txt
# Install additional dependencies for advanced scraping
pip install cachetools # Required for advanced scraping features
# Install WhyML in editable mode
pip install -e .
whyml --help
whyml --version
# This will be available when published to PyPI
pip install whyml
whyml validate test-manifest.yaml
whyml convert --from test-manifest.yaml --to output.html -as html
whyml generate pwa -f test-manifest.yaml -o ./my-pwa
whyml serve -f test-manifest.yaml -p 8080
WhyML provides several powerful CLI commands:
| Command | Description | Example |
|---|---|---|
validate |
Validate manifest files | whyml validate manifest.yaml |
convert |
Convert manifests to various formats | whyml convert --from manifest.yaml --to app.html -as html |
generate |
Generate complete application artifacts | whyml generate pwa -f manifest.yaml -o ./pwa-app |
serve |
Start development server | whyml serve -f manifest.yaml -p 8080 |
run |
Start production server with Caddy | whyml run -f manifest.yaml --tls-provider letsencrypt |
scrape |
Advanced website scraping with structure simplification | whyml scrape https://example.com --simplify-structure -o manifest.yaml |
| Format | Description | File Extension |
|---|---|---|
html |
Static HTML application | .html |
react |
React JSX component | .jsx |
vue |
Vue single-file component | .vue |
php |
PHP application | .php |
| Type | Description | Output |
|---|---|---|
pwa |
Progressive Web App | Complete PWA with service worker, manifest, offline page |
spa |
Single Page Application | SPA with router and navigation |
docker |
Docker configuration | Dockerfile, docker-compose.yml, .dockerignore |
tauri |
Desktop application | Rust-based desktop app with web frontend |
apk |
Mobile application | Capacitor project for Android/iOS |
caddy |
Production server config | Caddy reverse proxy configuration |
WhyML supports environment variables and .env files:
# Create .env file
echo "API_URL=https://api.example.com" > .env
echo "APP_NAME=MyApp" >> .env
# Use in conversion
whyml convert --from manifest.yaml --to app.html -as html --env-file .env
You can use JSON or YAML configuration files:
# config.yaml
cache_size: 2000
cache_ttl: 7200
enable_validation: true
optimize_output: true
whyml convert --from manifest.yaml --to app.html -as html --config config.yaml
WhyML uses YAML-based manifests with the following structure:
metadata:
title: "My Application"
description: "A sample application"
version: "1.0.0"
author: "Your Name"
structure:
- element: "div"
class: "header"
content: "Welcome to My App"
children:
- element: "nav"
class: "navigation"
content: "Navigation"
styles:
- selector: ".header"
properties:
background-color: "#007bff"
color: "white"
padding: "20px"
- selector: ".navigation"
properties:
margin: "10px 0"
whyml generate pwa -f manifest.yaml -o ./my-pwa --config pwa-config.yaml
# Generate Caddy configuration
whyml run -f manifest.yaml --caddy-config Caddyfile --tls-provider letsencrypt
# Start with custom domain
whyml run -f manifest.yaml --host myapp.com --tls-provider letsencrypt
whyml serve -f manifest.yaml --watch -p 3000
# Basic website scraping
whyml scrape https://example.com -o manifest.yaml
# Structure simplification for complex sites
whyml scrape https://blog.example.com \
--max-depth 3 \
--flatten-containers \
--simplify-structure \
-o simplified.yaml
# Selective section extraction for monitoring
whyml scrape https://competitor.com \
--section analysis \
--section metadata \
-o monitoring.yaml
# Testing workflow for migration projects
whyml scrape https://legacy-site.com \
--test-conversion \
--output-html modernized.html \
-o migration-test.yaml
# Convert multiple formats
whyml convert --from manifest.yaml --to app.html -as html
whyml convert --from manifest.yaml --to app.jsx -as react
whyml convert --from manifest.yaml --to app.vue -as vue
whyml convert --from manifest.yaml --to app.php -as php
# Deactivate and recreate if needed
deactivate
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
# Use different port
whyml serve -f manifest.yaml -p 8081
# Ensure proper permissions
chmod +x $(which whyml)
# Reinstall dependencies
pip install --force-reinstall -r requirements.txt
structure propertywhyml validate to identify specific issues--optimize-output for production builds.env files for configuration management# Clone and setup
git clone https://github.com/dynapsys/whyml.git
cd whyml
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
pip install -e .
# Run tests
python -m pytest tests/
# Run with development dependencies
pip install -r requirements-dev.txt
whyml/
├── whyml/ # Main package
│ ├── __init__.py
│ ├── cli.py # CLI interface
│ ├── processor.py # Main processing logic
│ ├── generators.py # Code generators
│ ├── server.py # Development server
│ ├── caddy.py # Caddy integration
│ └── converters/ # Format converters
├── tests/ # Test suite
├── docs/ # Documentation
├── examples/ # Usage examples
└── requirements.txt # Dependencies
/docs directory/examples directoryHappy building with WhyML! 🚀