Repository navigation
Releases
v2.0.0
[v2.0.0] - 2025-06-07
Added
- Modular architecture using mixins:
HistoryMixin,FileLoaderMixin,AliasMixin - Meta-commands now implemented as extensible strategy objects (subclass
BaseCommand) - Alias system: persistent, validated, with tab completion, listing, and removal
- Flexible CLI: history, alias, log, prompt, hello sentence, interpreter, file, and run command
- Full unit and integration test suite for each component and feature
- Documentation: user guide, interpreter API, architecture overview
Changed
- Refactored core into separate, focused modules for maintainability
- Test coverage increased and simplified
- Error handling improved across all file, alias, and command operations
- CLI and REPL logic now completely decoupled from the interpreter
Fixed
- Robust file I/O, cross-platform compatibility (history, clear screen, paths)
- Consistent alias expansion, handling of edge cases and user errors
v1.0.0
[1.0.0] – 2025-06-06
Added
- Full alias system with support for:
.alias @NAME = EXPRESSIONto define symbolic aliases.unalias @NAMEto remove existing aliases- Persistent storage of aliases via
.repl_aliases(loaded and saved automatically) - Strict substitution with error reporting on undefined aliases
- Inline alias expansion (
@name) with safe substitution in interpreter input - Alias completion:
@...names are now included in tab-completion .aliascommand with no arguments lists all active aliases- Aliases now persist across REPL sessions, like history
- Aliases are expanded within
.load,--file, and--runsources - History tracking improved to avoid duplicate entries (e.g., with
@Xor!N) - Unit test coverage for:
- Alias substitution and protection
- Error handling for undefined and malformed aliases
- History interaction with
.alias,.unalias,.load, and!N
Changed
.loadnow supports alias definitions in input files (.alias @X = ...)- The REPL no longer crashes if an alias is undefined; instead, a clear
Alias error: ...is shown .helpand tab completion dynamically reflect current alias list- Alias definitions in
.aliasnow expand other aliases during assignment (e.g.,.alias @X = @Y or Z) - Tab completion now unified across aliases, meta-commands, and interpreter keywords
Fixed
- Commands from
.loador--filewere not tracked in history — now correctly logged - Previously, repeating the same input (e.g.,
@Z) added duplicate entries — now deduplicated - Alias references like
@A1are no longer partially expanded (e.g.,(True)1) - Fixed inconsistent behavior when
.aliaswas used within init files or scripts
Development
- Added full alias checklist covering edge cases, substitutions, and persistence
GenericREPLcleaned and documented: inline comments clarified for core REPL logic- Alias handling centralized and unit-tested (
expand_aliases,handle_alias_command) - Finalized and documented
add_history_once()method to protect REPL history integrity
Version 0.2.0
Changelog
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.2.0] – 2025-06-01
Added
- New
.load <file>command to execute external batch files from within the REPL. - Added
.clearmeta-command to clear the terminal screen usingos.system("clear"). - Added
.reloadmeta-command to re-execute the original--fileinit file. - Added CLI option
--runto execute a single command before entering interactive mode. - Added CLI option
--fileto preload an init file (now also accessible via.reload). - Tab completion now supports meta-commands (
.help,.exit, etc.). - Comment lines (starting with
#) and empty lines are skipped in file loading. - History recall improved: commands like
!3replace their entry correctly. GenericREPLnow exposes a reusableload_file()method shared by.reload,.load, and--file.
Changed
- All file-based command executions (
--file,.reload,.load) now use a unified logic with consistent behavior and error reporting. - Errors raised by interpreter evaluation are now caught and reported per line (with file context where applicable).
- The REPL now exits gracefully on EOF and keyboard interrupts, and prints user-friendly messages.
Fixed
.reloadpreviously printed a "not implemented" message; it now functions as expected..loadused to evaluate only the last line due to indentation bug — now fixed.- Unit tests for
.metacommands were missing — now included and fully passing. test_keyboard_interruptandtest_eof_exitnow simulate real conditions correctly and avoid infinite loops.
Development
- Source code reorganized into
src/layout for modern packaging. - Makefile targets for
install,format,lint, andtest. - Switched to
pyproject.tomlfor all configuration (no longer usingsetup.cfg). - Editable installs now use
pip install -e .[dev](PEP 660 compliant). - README now documents full usage, development, and integration of custom interpreters.
[0.1.0] – 2025-05-30
Initial release of replkit.
Features
- Base
GenericREPLclass with pluggable interpreter. - Support for history file, tab completion, meta-commands, and interpreter interface.
- CLI with
--prompt,--hello,--log,--loglevel,--history.
Initial release
replkit
replkit is a generic REPL engine for building interactive command-line environments with pluggable interpreters.
Features
- Persistent command history
- Command recall using
!N - Auto-completion for meta-commands and interpreter keywords
- Pluggable interpreter class
- Configurable logging
- Argument parsing via CLI
Installation
We recommend using a Python virtual environment.
Development mode (editable install)
This is the preferred setup for developers who want to modify and test the project locally.
# 1. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 2. Upgrade pip and setuptools
pip install --upgrade pip setuptools
# 3. Install the package in editable mode with development dependencies
pip install -e .[dev]
# 4. Run tests to validate installation
pytestThis allows you to run and test replkit directly from the source code, and use developer tools like ruff, black, and pytest.
You can then run the REPL with:
replkit --prompt "mlang> " --hello "Welcome to MiniLang!"Note: This project uses the src/ layout. All source code lives in src/replkit, and you must run tests from the project root.
Production install
This is suitable for users who only want to use the tool, not modify it.
# Install replkit with pip (from local source or GitHub)
pip install .
# Or from GitHub (public repository)
pip install git+https://github.com/serge-pierre/replkit.gitThis will install the replkit CLI command without dev tools.
Uninstall
pip uninstall replkit