Skip to content

nafiul-afk/viper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


🐍 Viper

A minimal, dark-themed Python compiler for Linux.

Just Python 3 + Tkinter. No Electron. No bloat. Zero dependencies.

Features β€’ Quick Start β€’ Architecture β€’ Shortcuts β€’ Contributing


Why Viper?

Most Python IDEs are heavy, slow, or require dozens of dependencies. Viper is the opposite β€” a clean Python package that gives you everything needed to write and run Python code on Linux. No setup wizards. No configuration files. No internet required.

Features

Editor

Feature Description
Multi-tab editing Open and switch between multiple files without saving
Syntax highlighting Keywords, builtins, strings, comments, decorators, numbers
Line numbers With active line indicator
Current line highlight Subtle dark highlight on cursor line
Auto-indent Smart indentation after : blocks
Auto-close Brackets ()[]{} and quotes ""''
Find bar Search with match count and prev/next navigation
Zoom Ctrl+/- to resize editor font (8–28px)

Terminal

Feature Description
Run code F5 to execute, real-time stdout/stderr streaming
Inline input() Type directly next to the prompt in the output area β€” just like a real terminal
pip install Install packages directly from the terminal
Expression eval Type Python expressions for quick evaluation
Command history Arrow keys to cycle through previous commands

Workflow

Feature Description
No forced saving Open, edit, and run files freely β€” save when you want
Multi-file open Select multiple files at once from the file dialog
Content-hash tracking Only marks files as modified when content actually changes
Tab management Close tabs with βœ•, prompted to save only when needed

Quick Start

git clone https://github.com/nafiul-afk/viper.git
cd viper
make run

Install System-Wide

sudo make install    # installs to /usr/local
viper                # launch from anywhere

Install via pip

pip install -e .     # editable install
viper                # launch from anywhere

Uninstall

sudo make uninstall
# or
pip uninstall viper-ide

Requirements

Python 3.8+ with Tkinter:

# Ubuntu / Debian
sudo apt install python3-tk

# Fedora
sudo dnf install python3-tkinter

# Arch
sudo pacman -S tk

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    app.py                        β”‚
β”‚  Main window β€’ Toolbar β€’ Shortcuts β€’ File I/O    β”‚
β”‚  Process management β€’ pip runner                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚              editor.py                     β”‚  β”‚
β”‚  β”‚  Tab bar β€’ Gutter β€’ Text widget            β”‚  β”‚
β”‚  β”‚  Syntax highlighting β€’ Find bar            β”‚  β”‚
β”‚  β”‚  Auto-close β€’ Content-hash dirty tracking  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚             terminal.py                    β”‚  β”‚
β”‚  β”‚  Output display β€’ Inline process input     β”‚  β”‚
β”‚  β”‚  Command history β€’ Tag-based coloring      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   theme.py    β”‚          constants.py            β”‚
β”‚  Color scheme β”‚  Keywords β€’ Builtins β€’ Patterns  β”‚
β”‚  30 tokens    β”‚  Font chains β€’ Regex builder     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design Decisions

  • Content-hash dirty tracking β€” Tkinter's <<Modified>> event fires on tag operations (syntax highlighting, line highlighting), causing false "unsaved changes" dialogs. Viper uses hash(content) comparison instead, eliminating false positives entirely.

  • Per-keysym auto-close bindings β€” A catch-all <Key> binding blocks text input on some Tkinter/Tcl versions. Viper binds <KeyPress-parenleft>, <KeyPress-bracketleft>, etc. individually to avoid this.

  • Threaded I/O β€” Subprocess stdout/stderr are read in daemon threads using os.read() for immediate output (no newline buffering). The main thread polls the queue every 50ms, keeping the UI responsive during code execution.

  • Inline input() I/O β€” When a process is running, the terminal output area becomes editable. A Tkinter text mark tracks the boundary between program output and user input. The write() method uses a save-insert-restore pattern so that program output arriving mid-typing is placed correctly before the user's pending keystrokes.

Keyboard Shortcuts

Shortcut Action
F5 Run code
Ctrl+S Save
Ctrl+N New tab
Ctrl+O Open file(s)
Ctrl+W Close tab
Ctrl+F Find
Ctrl+D Duplicate line
Ctrl+/ Toggle comment
Ctrl++ Zoom in
Ctrl+- Zoom out
Ctrl+0 Reset zoom
Tab Indent
Shift+Tab Unindent
↑ / ↓ Terminal history

Project Structure

viper/
β”œβ”€β”€ viper/
β”‚   β”œβ”€β”€ __init__.py         # Package metadata
β”‚   β”œβ”€β”€ __main__.py         # Entry point
β”‚   β”œβ”€β”€ app.py              # Main application (~360 lines)
β”‚   β”œβ”€β”€ editor.py           # Code editor (~435 lines)
β”‚   β”œβ”€β”€ terminal.py         # Terminal widget (~215 lines)
β”‚   β”œβ”€β”€ theme.py            # Color scheme (37 lines)
β”‚   └── constants.py        # Language constants (63 lines)
β”œβ”€β”€ run.py                  # Convenience launcher
β”œβ”€β”€ pyproject.toml          # Modern Python packaging
β”œβ”€β”€ Makefile                # Build / install / uninstall
β”œβ”€β”€ CHANGELOG.md            # Release history
β”œβ”€β”€ CONTRIBUTING.md         # Contribution guidelines
β”œβ”€β”€ LICENSE                 # MIT License
β”œβ”€β”€ README.md
└── .gitignore

Philosophy

One theme. One purpose. Zero compromise.

Viper is not trying to be VS Code. It is a focused tool for writing and running Python on Linux β€” nothing more, nothing less. Every feature exists because it removes friction, not because it looks good on a feature list.

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT β€” see LICENSE


Built with 🐍 by Nafiul Islam

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors