This repository investigates and fixes an issue with Hy’s REPL when used within IPython, as reported in Hy GitHub Issue #2646.
The issue occurs when attempting to launch the Hy REPL from within IPython, resulting in an AttributeError: module 'builtins' has no attribute 'quit'
error.
docs/
- Documentation and analysishistory/
- Historical research on builtins implementationinvestigation.org
- Investigation notesrepl_implementations.org
- REPL implementation comparisonfix_proposal.org
- Detailed fix proposal
tutorials/
- Educational materialsunderstanding_python_repls.org
- Org mode tutorial with Babel supportsrc/
- Tangled Python code from tutorials
worktrees/
- Git worktrees for different aspects of the issuereproduce-issue/
- Scripts to reproduce the original issuefix-implementation/
- Implementation of the proper fixmonkey-patch/
- Temporary workaround using monkey patching
hy-repo/
- Submodule of the Hy codebaseipython-repo/
- Submodule of the IPython codebase
- Python 3.8 or higher
- IPython
- Hy
- Emacs with Org mode (for working with tutorials)
# Clone the repository with submodules
git clone --recurse-submodules https://github.com/aygp-dr/hy-ipython-repl-fix.git
cd hy-ipython-repl-fix
# Set up a virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
This repository uses git worktrees to organize different aspects of the investigation and solution:
# Create and checkout a worktree for issue reproduction
git worktree add --detach worktrees/reproduce-issue
cd worktrees/reproduce-issue
git checkout -b reproduce-issue
# Create and checkout a worktree for the fix implementation
git worktree add --detach worktrees/fix-implementation
cd worktrees/fix-implementation
git checkout -b fix-implementation
# Create and checkout a worktree for the monkey patch
git worktree add --detach worktrees/monkey-patch
cd worktrees/monkey-patch
git checkout -b monkey-patch
Contributions are welcome! Please feel free to submit a Pull Request.
- Hy GitHub Issue #2646 - The original issue report
- CPython Issue #119856 - Related CPython issue about quit/exit handling