Skip to main content

Python Terminal Emulator with Enhanced Developer Utilities

Project description

CMosSkillAV2 Terminal Emulator

A Python package that provides an enhanced terminal emulator with built-in file operations, Python execution, and developer utilities.

Features

  • File Operations: Built-in commands for managing files and directories (cd, ls, mkdir, touch, rm, cat)
  • Python Execution: Run Python scripts or execute Python code directly in the terminal
  • Package Management: Manage Python packages with built-in pip integration
  • Syntax Highlighting: Color-coded output for better readability
  • Tab Completion: Command and path completion with Tab key
  • Command History: Navigate through previously entered commands

Installation

pip install cmosskillav2

Usage

After installation, you can start the terminal emulator with:

cmosskillav2

Or you can run it as a module:

python -m cmosskillav2

Auto-Launch Features

CMosSkillAV2 version 0.2.2 introduces powerful and reliable auto-launch capabilities:

1. Auto-Import Launch

When imported in interactive Python sessions, the terminal automatically launches:

# In an interactive Python session
import cmosskillav2  # The terminal will automatically launch

You can disable this behavior by setting:

export CMOSSKILLAV2_AUTO_LAUNCH=0

2. Auto-Console Launch

After installation, CMosSkillAV2 automatically activates whenever you start a new Python console/REPL without having to explicitly import it. This makes it instantly available in any Python interactive session.

This works in:

  • Standard Python REPL (python without arguments)
  • Interactive Python sessions (python -i script.py)
  • IPython and Jupyter environments
  • Any Python environment with PYTHONINSPECT set

You can disable the auto-console feature by setting:

export CMOSSKILLAV2_AUTO_CONSOLE=0

Both auto-launch features are especially useful for enhancing Python REPL environments, IPython, and Jupyter notebooks with terminal capabilities.

How Auto-Console Works

The package uses a dual approach for maximum reliability:

  1. sitecustomize.py: Installed in the site-packages directory, this module is automatically imported when Python starts. It detects interactive mode and can trigger the terminal.

  2. .pth file mechanism: A special .pth file with embedded Python code that executes when Python starts, providing a secondary activation method.

The system intelligently examines the Python environment to determine if it's appropriate to launch the terminal, avoiding activation during package installation, testing, or when running scripts non-interactively.

Advanced Configuration Options

CMosSkillAV2 provides several environment variables to control its behavior:

# Disable automatic launch when importing the package
export CMOSSKILLAV2_AUTO_LAUNCH=0

# Disable automatic launch in Python console
export CMOSSKILLAV2_AUTO_CONSOLE=0

# Enable debug output for tracing activation logic
export CMOSSKILLAV2_DEBUG=1

# Force terminal launch even in non-interactive mode (for testing)
export CMOSSKILLAV2_FORCE_LAUNCH=1

Debugging Auto-Launch Features

You can enable debugging output for the auto-launch functionality by setting:

export CMOSSKILLAV2_DEBUG=1

This will display detailed information about the Python environment and the decision-making process for auto-launching the terminal.

Demo Scripts

The package includes demo scripts that show how the auto-launch features work:

# Display auto-launch capabilities and configuration options
python demo_autolaunch.py

# Test interactive mode (terminal should launch after script completes)
python -i demo_autolaunch.py

# Test auto-launch detection and troubleshooting
python test_auto_console.py

# Test with debug output
CMOSSKILLAV2_DEBUG=1 python -i test_auto_console.py

Available Commands

File Operations

  • cd [directory] - Change directory
  • ls [directory] - List directory contents
  • mkdir [-p] directory - Create directory
  • touch file [file2 ...] - Create empty file(s)
  • rm [-r] file_or_directory - Remove file(s) or directory
  • cat file [file2 ...] - Display file contents

Python Execution

  • python script.py [args] - Execute Python script file
  • >>> [python_code] - Execute Python code inline
  • pyshell - Start interactive Python shell

Package Management

  • pip install package - Install Python package
  • pip uninstall package - Uninstall Python package
  • pip list - List installed packages
  • pip freeze - Output installed packages in requirements format

Shell Built-ins

  • help [command] - Display help for commands
  • exit or quit - Exit the shell
  • clear - Clear the terminal screen

Contributing

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmosskillav2-0.2.3.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmosskillav2-0.2.3-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file cmosskillav2-0.2.3.tar.gz.

File metadata

  • Download URL: cmosskillav2-0.2.3.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for cmosskillav2-0.2.3.tar.gz
Algorithm Hash digest
SHA256 8eed8f39a138239a81b0a229702807b2ed852d4b5137b4948916051805b4987a
MD5 443af35b9e26cb01671e5bae8be15ae2
BLAKE2b-256 b1487fc26f38c0b5022359a7f8ea832982f188f673a5d49cf7d6c07b3bc66e75

See more details on using hashes here.

File details

Details for the file cmosskillav2-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: cmosskillav2-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for cmosskillav2-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0105b0d7a09c2c67ffb005a173957f1de298a72907b90db6919d890c087d476
MD5 00ced847fac5b5fb656528cd2395a7fd
BLAKE2b-256 b0244a1e82ab0ac2fc0aee3d8beceae6a9749c4d644c4805199061ab7824f3e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page