|
| 1 | +# Jupyterize - Quick Start Guide |
| 2 | + |
| 3 | +## Installation |
| 4 | + |
| 5 | +```bash |
| 6 | +pip install nbformat |
| 7 | +``` |
| 8 | + |
| 9 | +## Basic Usage |
| 10 | + |
| 11 | +```bash |
| 12 | +# Convert a file (creates example.ipynb) |
| 13 | +python build/jupyterize/jupyterize.py example.py |
| 14 | + |
| 15 | +# Specify output location |
| 16 | +python build/jupyterize/jupyterize.py example.py -o notebooks/example.ipynb |
| 17 | + |
| 18 | +# Enable verbose logging |
| 19 | +python build/jupyterize/jupyterize.py example.py -v |
| 20 | +``` |
| 21 | + |
| 22 | +## What It Does |
| 23 | + |
| 24 | +Converts code example files → Jupyter notebooks (`.ipynb`) |
| 25 | + |
| 26 | +**Automatic:** |
| 27 | +- ✅ Detects language from file extension |
| 28 | +- ✅ Selects appropriate Jupyter kernel |
| 29 | +- ✅ Excludes `EXAMPLE:` and `BINDER_ID` markers |
| 30 | +- ✅ Includes code in `HIDE_START`/`HIDE_END` blocks |
| 31 | +- ✅ Excludes code in `REMOVE_START`/`REMOVE_END` blocks |
| 32 | +- ✅ Creates separate cells for each `STEP_START`/`STEP_END` block |
| 33 | + |
| 34 | +## Supported Languages |
| 35 | + |
| 36 | +| Extension | Language | Kernel | |
| 37 | +|-----------|------------|--------------| |
| 38 | +| `.py` | Python | python3 | |
| 39 | +| `.js` | JavaScript | javascript | |
| 40 | +| `.go` | Go | gophernotes | |
| 41 | +| `.cs` | C# | csharp | |
| 42 | +| `.java` | Java | java | |
| 43 | +| `.php` | PHP | php | |
| 44 | +| `.rs` | Rust | rust | |
| 45 | + |
| 46 | +## Input File Format |
| 47 | + |
| 48 | +```python |
| 49 | +# EXAMPLE: example_id |
| 50 | +# BINDER_ID optional-binder-id |
| 51 | +import redis |
| 52 | + |
| 53 | +# STEP_START connect |
| 54 | +r = redis.Redis() |
| 55 | +# STEP_END |
| 56 | + |
| 57 | +# STEP_START set_get |
| 58 | +r.set('foo', 'bar') |
| 59 | +r.get('foo') |
| 60 | +# STEP_END |
| 61 | +``` |
| 62 | + |
| 63 | +## Output Structure |
| 64 | + |
| 65 | +Creates a Jupyter notebook with: |
| 66 | +- **Preamble cell** - Code before first `STEP_START` |
| 67 | +- **Step cells** - Each `STEP_START`/`STEP_END` block |
| 68 | +- **Kernel metadata** - Automatically set based on language |
| 69 | +- **Step metadata** - Step names stored in cell metadata |
| 70 | + |
| 71 | +## Common Issues |
| 72 | + |
| 73 | +**"Unsupported file extension"** |
| 74 | +→ Use a supported extension (.py, .js, .go, .cs, .java, .php, .rs) |
| 75 | + |
| 76 | +**"File must start with EXAMPLE: marker"** |
| 77 | +→ Add `# EXAMPLE: <id>` (or `//` for JS/Go/etc.) as first line |
| 78 | + |
| 79 | +**"Input file not found"** |
| 80 | +→ Check file path is correct |
| 81 | + |
| 82 | +## Testing |
| 83 | + |
| 84 | +```bash |
| 85 | +# Run automated tests |
| 86 | +python build/jupyterize/test_jupyterize.py |
| 87 | +``` |
| 88 | + |
| 89 | +## More Information |
| 90 | + |
| 91 | +- **User Guide**: `build/jupyterize/README.md` |
| 92 | +- **Technical Spec**: `build/jupyterize/SPECIFICATION.md` |
| 93 | +- **Implementation**: `build/jupyterize/IMPLEMENTATION.md` |
| 94 | + |
0 commit comments