repl-friendly-import-patching
CommunityFix Python imports in REPLs
Authortankygranny05
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill ensures that Python scripts can correctly import modules from parent or grandparent directories, even when run in interactive environments like PyCharm, IPython, or Jupyter notebooks where the __file__ variable might not be defined.
Core Features & Use Cases
- Dynamic
sys.pathmodification: Automatically adds project root directories to Python's import path. - REPL compatibility: Gracefully handles environments where
__file__is undefined, preventing import errors. - Use Case: You're developing a Python project with a structure like
project_root/src/utils.pyandproject_root/scripts/my_script.py. This Skill allowsmy_script.pyto importutilswithout manual path manipulation, whether run directly or in a Jupyter notebook.
Quick Start
Apply this Python code snippet at the beginning of your script to ensure imports from parent directories work correctly in any environment.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: repl-friendly-import-patching Download link: https://github.com/tankygranny05/agent-box/archive/main.zip#repl-friendly-import-patching Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.