Inklets: OctoPy snippets
A VS Code activity-bar sidebar for a plotting-first OctoPy catalogue. Each
card shows a small SVG plot preview, the function name, required and optional
parameters, and actions for insertion and copying the import.
Getting started
- Install the packaged VSIX with Extensions: Install from VSIX, or open
this extension's folder in VS Code and press F5 to launch an Extension
Development Host.
- Open a Python file, then select the OctoPy icon in the activity bar.
The sidebar loads the packaged catalogue immediately. Browsing and inserting
do not require Python, the Python extension, or OctoPy to be installed. To
inspect the API currently installed in the selected Python environment, run
OctoPy: Refresh Catalogue from Current Python Installation from the
Command Palette (Ctrl+Shift+P) or select the refresh button. The extension
does not probe Python automatically.
The bundled catalog is generated from OctoPy 0.18.0 at commit
b993997c85093142412d7c8a5714a9b400c75b51. Run
OctoPy: Use Packaged Catalogue to discard an installed-environment
refresh for the current extension session.
Inserting snippets
- Plotting first: the Plotting collection opens by default. Switch
collections to inspect fitting, measurement, electronics, dimensions,
methods, styling, SI units, and constants.
- Compact parameters: required parameter chips are always included in an
inserted call. Check an optional parameter chip to include it.
- Plot previews: line, scatter, fit, bands, error-bar, Bode, and generic API
cards have lightweight SVG previews that work offline.
- Import controls: copy an import without changing the editor, or enable
Add import before insertion to include it with a call.
- Check Add import statement to insert the matching import immediately
before the snippet at the cursor. An identical import line already in the
document is not inserted again.
Run the inserted code in an environment with octopy installed:
python -m pip install octopy.
Development
Run the JavaScript tests with npm test. To package the extension for local
installation, use npx @vscode/vsce package and install the resulting VSIX via
VS Code's Extensions: Install from VSIX command.
The catalog is pinned to the OctoPy version and source commit shown above.
Use Python 3.12, as in the publishing workflow, with that OctoPy version
installed to regenerate and verify it. Python versions can format signatures
differently:
python src/catalog.py --output src/default-catalog.json
python src/catalog.py --check
When updating the catalog, change both pins in src/catalog.py, update the
version and source commit here and in LICENSE.md, then run npm test.