Repository navigation
Releases: Xilleet/senpy
Release list
v0.4.0 Migrate to unified object-oriented symbol model (v0.4.0)
Refactor core & migrate to unified object-oriented symbol model
BREAKING CHANGE: Completely redesigned internal symbol storage from flat dictionaries
to typed object registries (VariableSymbol, LabelSymbol, ScreenSymbol, ImageSymbol).
Cache structure updated; bump engine version to 0.4.0.
Summary of changes:
-
Architecture:
- Created
senpy/symbols.pyfeaturing dedicated dataclasses:
VariableSymbol,LabelSymbol,ScreenSymbol, andImageSymbol. - Refactored
FileScope(models.py) andSenpyAnalyzer(analyzer.py),
eliminating 13+ fragmented flat dictionaries and sets (declared_labels,
declared_screens,symbol_declarations,symbol_types,defined_constants, etc.)
in favor of 4 unified registries:variables,labels,screens, andimages. - Streamlined
_rebuild_aggregates()boilerplate by ~60%, drastically improving
maintainability and reducing cache desynchronization risks.
- Created
-
Consumers & Integrations:
- Refactored LSP Server (
server.py) methods:completions,definition,
hover, anddocument_symbolsto directly consume the new symbol registries. - Updated Story Flow Analyzer (
flow.py) and Mermaid graph export to inspect
LabelSymbolproperties directly. - Modernized
checkers.py,python_ast.py,wiki.py,stubs.py, andcache.py
to work natively with object models.
- Refactored LSP Server (
-
Reliability & PEP 8:
- Replaced broad
contextlib.suppress(Exception)with specific, narrowed
exception tuples (SyntaxError,ValueError,TypeError,OSError,pickle.PickleError,zlib.error)
insignature.pyandcli.py.
- Replaced broad
-
Tests:
- Updated test assertions across
tests/test_analyzer.pyandtests/test_lsp.py. - All 54 test suites passing cleanly (0.90s).
- Updated test assertions across
Senpy v0.3.0 — Flow-Sensitive Dataflow, Native VS Code Outline, 40 Semantic Rules & Full F12 Navigation
This major milestone release elevates Senpy to 40 semantic rules (up from 29), introduces flow-sensitive branching analysis across if/elif/else blocks, brings native VS Code Document Symbols & Outline support, bundles instant hover documentation for 220+ Ren'Py Engine APIs, and supercharges Go-to-Definition (F12) across variables, sprites, and media files.
What's New in v0.3.0
1. Native VS Code Outline & Breadcrumbs (Ctrl+Shift+O)
- Document Symbols Provider: Your
.rpyscripts now feature a rich, interactive outline tree in the Outline (Структура) panel and editor Breadcrumbs. - Instantly navigate between
label,screen,layeredimage,image, and globaldefine/defaultdeclarations. - Use
Ctrl+Shift+O(orCmd+Shift+Oon macOS) for fuzzy quick-jump navigation across scenes in files with thousands of lines.
2. Flow-Sensitive Branching Analysis (if / elif / else & menu)
- Tracks variable definedness across branching control-flow paths without requiring whole-program execution.
- Catches variables in
MAYBE_SETstate (RPY404) that are defined in anifbranch but omitted inelseor alternative paths, preventing runtimeNameErrorand save-game corruptions. - Accurately recognizes terminal branches (
jump/return) and guaranteed definitions without false positives.
3. Instant Hover Documentation for 220+ Ren'Py Engine APIs
- Hovering over any built-in Ren'Py function (
renpy.pause,renpy.jump,renpy.music.*,renpy.random.*) or Screen Action (SetVariable,Function,Return,ShowMenu,ToggleField, etc.) now shows a rich Markdown card with parameters, signatures, gotchas, examples, and documentation links. - 100% Offline & Instant (~0.1ms): Does not query external APIs at runtime or lag your editor.
- Includes
scripts/update_renpy_api.pyto automatically sync definitions from upstream Ren'Py releases without installing the Ren'Py SDK.
4. Full-Spectrum Go-to-Definition (F12)
Pressing F12 / Ctrl+Click now resolves:
- Story labels & Screens: Jump straight to
labelorscreendeclarations. - Variables & Characters: Jump to
defaultanddefinestatements (e.g.define e = Character(...)). - Sprites & Backgrounds: Jump to
imageorlayeredimagecode definitions. - Media Assets on Disk: Jump directly to physical
.png,.webp,.ogg, and.mp3files in your workspace!
11 New Semantic Rules (29 ➔ 40 Rules Total)
| Code | Category | Severity | Description |
|---|---|---|---|
RPY107 |
State & APIs | HINT |
Deprecated Ren'Py API: Detects obsolete functions (LiveComposite, DynamicCharacter, im.*, ui.*) with 1-click QuickFix replacement. |
RPY108 |
Variables & State | ERROR / WARNING |
Type Taint Conflict: Flags fatal runtime TypeError on illegal augmented operations (str += int) and conflicting type reassignments. |
RPY109 |
Init Graph | ERROR |
Init Phase Dependency Violation: Detects functions evaluated in init python: before their declaring file loads in alphabetical order. |
RPY207 |
Screens & UI | ERROR |
Screen Parameter Mismatch: Validates argument counts and keyword parameters on use screen(...) and call screen(...). |
RPY309 |
Story Flow | WARNING |
Story Island / Subgraph Loop: Detects isolated groups of scenes referencing each other in loops but unreachable from start or system entry points. |
RPY310 |
Story Flow | ERROR |
Call Arity Violation: Catches missing required positional arguments or unexpected keyword parameters on call label(...). |
RPY404 |
Branching & Logic | WARNING |
MAYBE_SET Variable Read: Flags condition checks (if var:) or text interpolations ([var]) evaluated on variables only defined in certain branches. |
RPY505 |
Assets & Media | WARNING / ERROR |
Unregistered Audio Channel: Flags playback on unregistered audio channels and prevents audio overlap glitches from loop on voice. |
RPY601 |
Translations | ERROR |
Variable Mismatch in Translations: Catches altered or misspelled [var] tags in game/tl/ before they crash with KeyError. |
RPY602 |
Translations | WARNING |
Formatting Tag Mismatch: Detects lost or altered {b}, {color}, {i} tags between original and translated strings. |
RPY603 |
Translations | WARNING |
Empty Translation String: Detects blank new "" strings in localization files that leave player dialogue windows empty. |
Additional CLI & Tooling Upgrades
- Translation Coverage (
senpy --coverage): Auditsgame/tl/and calculates localization progress percentages per language. - GDD Wiki Generator (
senpy --export-wiki): Automatically extracts cast lists, typed variables, and story endings into a Markdown game design document. - Type Stubs (
senpy --stubs): Generates.pyitype stubs for the Ren'Py store, giving Pylance / MyPy in VS Code native autocompletion. - Crash Inspector (
senpy --traceback): Parses post-mortemtraceback.txtcrash logs and maps errors to actionable Senpy rules. - One-Click GitHub Actions (
senpy --init-ci): Generates automated pull-request scanning workflows with native GitHub CodeQL SARIF alerts. - Cache Integrity: Hardened Tier 2
.senpy_cacheinvalidation by hashing variable types, asset tags, and registered channels. - Bugfixes: Fixed CLI argument parsing for
--defaultsand--stubs, isolated local label parameters from global namespace leakage, and preventedcall screenfrom registering phantom jump targets.
Installation & Updating
Core Python Analyzer (CLI & LSP):
pip install --upgrade senpy-linterVS Code Extension:
Download senpy-vscode-0.3.0.vsix from the Assets below and install via Install from VSIX... in VS Code.
Senpy v0.2.11
This update introduces Mermaid.js story flow visualization, expands the semantic ruleset from 23 to 29 rules, upgrades audio resolution, and completely refactors the core engine architecture for lightning-fast LSP performance.
New Feature: Visual Story Flow Graphs
You can now export your visual novel’s branching narrative into clean, interactive Mermaid.js diagrams!
- Preview your story transitions, branches, and endings directly inside VS Code's Markdown preview.
- Highlight dead-ends and missing jump targets automatically.
- Run via CLI:
senpy --graphor save directly withsenpy --graph-file story.md.
6 New Semantic Rules (Now 29 Rules Total)
RPY001(Indentation Tabs): Detects accidental\ttab characters in indentation and provides an instant 4-space QuickFix auto-replacement.RPY002(Smart Quotes): Catches typographical curly quotes (“ ” ‘ ’ « ») pasted from Google Docs/Word that break Python syntax, with one-click ASCII conversion.RPY206(Premature Action Call): Warns when functions are invoked directly with parentheses inside screen actions (action my_func()), preventing side-effects during screen prediction.RPY307(Duplicate Labels): Catches duplicatelabeldeclarations across files before runtime crashes withScriptError: Name defined twice.RPY308(Label Fallthrough): Warns when scenes terminate without an explicitreturnorjump, preventing story flow from bleeding into the next label.RPY503(Unused Assets): Detects dead/unreferenced images and audio files sitting on disk to help trim your game distribution size.
Upgraded Audio Engine (RPY501)
- Full support for Ren'Py's native unquoted audio syntax:
play sound click,play music audio.ambient. - Automatic discovery of files in the
game/audio/directory (.ogg,.mp3,.opus,.wav,.flac). - Support for
define audio.*alias declarations.
Architecture & Performance
- Modular Engine: Decomposed the monolithic core into specialized domain modules (
assets,python_ast,flow,text_tags,models). - Ultra-low LSP Latency: Instantaneous (~15ms) diagnostics on every keystroke in VS Code without IDE stutters.
- Streamlined CLI: Overhauled
--helpmenu categorized into clean sections (Rules,Autofix,Visualization,Tools). - Expanded Russian and English Tsundere-mode dialogue lines.
Senpy v0.1.7
Includes the core analyzer, 29 diagnostic rules, and the VS Code extension