{"id":26069,"library":"parcel-transformer-transcrypt","title":"Parcel Transcrypt Transformer","description":"A Parcel v2 transformer plugin that converts Python files to JavaScript using the Transcrypt transpiler. Version 1.0.3 is current, with no active release cadence. Unlike other Python-to-JS bridges, this integrates directly with Parcel's build pipeline, enabling bundling, code splitting, and HMR. Requires Transcrypt (Python transpiler) installed in a virtual environment; Python version must match Transcrypt version. Supports custom CLI arguments and output directory configuration.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/TranscryptOrg/parcel-transformer-transcrypt","tags":["javascript","python","parcel","transcrypt","plugin","transformer","transpiler"],"install":[{"cmd":"npm install parcel-transformer-transcrypt","lang":"bash","label":"npm"},{"cmd":"yarn add parcel-transformer-transcrypt","lang":"bash","label":"yarn"},{"cmd":"pnpm add parcel-transformer-transcrypt","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Plugin runs only within Parcel v2 build system (peer dependency)","package":"parcel","optional":false},{"reason":"Runtime dependency — the Python-to-JS transpiler (installed via pip, not npm)","package":"transcrypt","optional":false}],"imports":[{"note":"This is a Parcel transformer plugin, not a library. No JS imports required.","wrong":"import parcelTransformerTranscrypt from 'parcel-transformer-transcrypt'","symbol":"default (plugin registration)","correct":"no JavaScript import needed; configure in .parcelrc"},{"note":"Configure in .parcelrc under transformers, not plugins.","wrong":"{\n  \"plugins\": [\"parcel-transformer-transcrypt\"]\n}","symbol":"Parcel config (JSON)","correct":"{\n  \"transformers\": {\n    \"*.py\": [\"parcel-transformer-transcrypt\"]\n  }\n}"},{"note":"Configuration goes in package.json under 'parcel-transformer-transcrypt' key, not in a separate file.","wrong":"\"parcel-transformer-transcrypt\": {\n  \"version\": \"3.9\"\n}","symbol":"Package config (JSON)","correct":"\"parcel-transformer-transcrypt\": {\n  \"transcryptVersion\": \"3.9\",\n  \"watchAllFiles\": true,\n  \"command\": \"python -m transcrypt\",\n  \"arguments\": [\"--nomin\", \"--map\"]\n}"}],"quickstart":{"code":"# Create a basic Python file (example.py)\nprint('Hello from Python!')\n\n# Initialize project and install dependencies\nnpm init -y\nnpm install parcel --save-dev\nnpm install parcel-transformer-transcrypt --save-dev\n\n# Set up Python virtual environment with Transcrypt (Python 3.9)\npython3.9 -m venv venv\nsource venv/bin/activate\npip install transcrypt\n\n# Configure .parcelrc\ncat > .parcelrc << 'EOF'\n{\n  \"extends\": [\"@parcel/config-default\"],\n  \"transformers\": {\n    \"*.py\": [\"parcel-transformer-transcrypt\"]\n  }\n}\nEOF\n\n# Create an HTML entry that imports the Python module\ncat > index.html << 'EOF'\n<!DOCTYPE html>\n<html><body>\n<script type=\"module\" src=\"./example.py\"></script>\n</body></html>\nEOF\n\n# Build with Parcel\nnpx parcel build index.html","lang":"javascript","description":"Sets up a Parcel project with Python-to-JS support: installs parcel and transformer, creates Python file and HTML entry, configures .parcelrc, and runs build."},"warnings":[{"fix":"Use compatible Python/Transcrypt versions as documented.","message":"Python version must match Transcrypt version (e.g., Python 3.9 with Transcrypt 3.9, Python 3.7 with Transcrypt 3.7.16). Mismatch causes transpilation errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Python 3.9 and Transcrypt 3.9 or later.","message":"Transcrypt 3.7 is outdated and may have security vulnerabilities. Use Python 3.9 + Transcrypt 3.9+.","severity":"deprecated","affected_versions":"<=3.7"},{"fix":"Use Transcrypt 3.9+ for --outdir support.","message":"The --outdir argument is ignored for Transcrypt 3.7. Output directory customization only works with 3.9 and above.","severity":"gotcha","affected_versions":">=3.7 <3.9"},{"fix":"Ensure `python` in PATH points to the correct version, or set 'transcryptVersion' in package.json config.","message":"The transformer automatically detects Python and Transcrypt versions by running `python --version` and `transcrypt --help`. If multiple Python versions are installed, it may pick the wrong one.","severity":"gotcha","affected_versions":"all"},{"fix":"Activate the virtual environment before running Parcel, or specify full path in 'command' config.","message":"Transcrypt must be installed in a Python virtual environment, not globally. The transformer assumes 'python' and 'transcrypt' commands are available in the build environment.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install parcel-transformer-transcrypt --save-dev`","cause":"Package not installed or not listed in devDependencies","error":"Error: Cannot find module 'parcel-transformer-transcrypt'"},{"fix":"Check Python & Transcrypt versions are compatible (3.9 with 3.9). Re-run build with --verbose.","cause":"Python file not transpiled correctly, possibly due to version mismatch","error":"Module script failed because the module is not a valid JavaScript module"},{"fix":"Upgrade to Transcrypt 3.9+ or remove --outdir from arguments.","cause":"Using Transcrypt 3.7 which doesn't support --outdir","error":"Transcrypt: error: unrecognized arguments: --outdir"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}