Skip to content

Repository files navigation

Hy IPython REPL Fix

Overview

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.

Repository Structure

  • docs/ - Documentation and analysis
    • history/ - Historical research on builtins implementation
    • investigation.org - Investigation notes
    • repl_implementations.org - REPL implementation comparison
    • fix_proposal.org - Detailed fix proposal
  • tutorials/ - Educational materials
    • understanding_python_repls.org - Org mode tutorial with Babel support
    • src/ - Tangled Python code from tutorials
  • worktrees/ - Git worktrees for different aspects of the issue
    • reproduce-issue/ - Scripts to reproduce the original issue
    • fix-implementation/ - Implementation of the proper fix
    • monkey-patch/ - Temporary workaround using monkey patching
  • hy-repo/ - Submodule of the Hy codebase
  • ipython-repo/ - Submodule of the IPython codebase

Getting Started

Prerequisites

  • Python 3.8 or higher
  • IPython
  • Hy
  • Emacs with Org mode (for working with tutorials)

Installation

# 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

Development Workflow

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

Learning Resources

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Related Issues

About

Fix for Hy REPL when running in IPython environments - handles missing builtins.quit/exit

Topics

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages