Skip to main content

A modern, type-annotated Python implementation of the Unix ls command with beautiful Rich formatting and color-coded file types

Project description

richpyls - A Python Implementation of the Unix ls Command

CI/CD Pipeline Python Version License: MIT

Code Style: Ruff Type Checked: mypy Security: Bandit Pre-commit

A modern, type-annotated Python implementation of the Unix ls command with beautiful Rich formatting, color-coded file types, and support for long format listings and hidden files.

Quality Metrics

Code Size Repo Size Last Commit

Metric Status
Test Coverage Coverage Status
Type Coverage mypy
Code Quality Ruff
Security Scan Bandit
Documentation Docs

Features

  • ๐ŸŽจ Rich Visual Output: Beautiful color-coded file types with emoji icons
  • ๐Ÿ“ Directory Listing: List files and directories in the current or specified path
  • ๐Ÿ“„ Long Format: Display detailed file information in a professional table format
  • ๐ŸŒณ Tree View: Display directories in a tree-like hierarchical format with the -t option
  • ๐Ÿ” Hidden Files: Show hidden files (starting with .) with the -a option using ๐Ÿซฃ emoji
  • ๐Ÿ“Š Size Sorting: Show top N largest files/directories sorted by size with the -s option
  • ๐Ÿƒ Fast Performance: Built with modern Python using pathlib for efficient path operations
  • ๐ŸŽฏ Type Safety: Fully type-annotated codebase with mypy validation
  • โœ… Well Tested: Comprehensive test suite with excellent coverage
  • ๐Ÿ Modern Python: Uses Python 3.13+ features and best practices

File Type Icons

The Rich output includes beautiful emoji icons for different file types:

  • ๐Ÿ Python files (.py, .pyx, .pyi)
  • โš™๏ธ Configuration files (.toml, .json, .yaml, .yml, .ini, .cfg, .conf)
  • ๐Ÿ“„ Documentation files (.md, .rst, .txt, .doc, .docx, .pdf)
  • ๐Ÿ“ฆ Archive files (.zip, .tar, .gz, .bz2, .xz, .7z, .rar)
  • ๐Ÿ–ผ๏ธ Image files (.png, .jpg, .jpeg, .gif, .bmp, .svg, .ico)
  • ๐Ÿ“ Directories
  • โšก Executable files
  • ๐Ÿ”— Symbolic links
  • ๐Ÿซฃ Hidden files (starting with .)

Installation

From PyPI (Recommended)

pip install richpyls

Once installed, you can use the richpyls command anywhere in your terminal.

From Source

Using uv (recommended)

# Clone the repository
git clone https://github.com/lpozo/richpyls.git
cd richpyls

# Install with uv
uv sync

# Run the application
uv run richpyls

Using pip

# Clone the repository
git clone https://github.com/lpozo/richpyls.git
cd richpyls

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate  # On macOS/Linux
# or
.venv\Scripts\activate     # On Windows

# Install in editable mode
pip install -e .

# Run the application
richpyls

Usage

# List files in current directory
richpyls

# List files in specific directory
richpyls /path/to/directory

# List multiple files/directories
richpyls file1.txt directory1 file2.txt

Command Options

Option Description
-l Use long listing format (shows permissions, ownership, size, date in Rich table)
-a Show all files, including hidden files (starting with .) with ๐Ÿซฃ emoji
-t Display directories in a tree-like format with Rich styling
-s N Show top N files/directories sorted by size (descending) in a Rich table
-la Combine long format with showing hidden files
-tl Combine tree format with long listing
-ta Combine tree format with showing hidden files
-sa Combine size sorting with showing hidden files

Examples

# Basic listing with Rich icons and colors
richpyls
๐Ÿ“„ README.md
โš™๏ธ pyproject.toml
๐Ÿ“ src
๐Ÿ“ tests
๐Ÿ“„ uv.lock

# Show hidden files with special emoji
richpyls -a
๐Ÿซฃ .git
๐Ÿซฃ .gitignore
๐Ÿซฃ .python-version
๐Ÿ“ .venv
๐Ÿ“„ README.md
โš™๏ธ pyproject.toml
๐Ÿ“ src
๐Ÿ“ tests
๐Ÿ“„ uv.lock

# Tree format (shows directory structure with Rich styling)
richpyls -t
โ”œโ”€โ”€ ๐Ÿ“„ README.md
โ”œโ”€โ”€ โš™๏ธ pyproject.toml
โ”œโ”€โ”€ ๐Ÿ“ src
โ”‚   โ””โ”€โ”€ ๐Ÿ“ richpyls
โ”‚       โ”œโ”€โ”€ ๐Ÿ __init__.py
โ”‚       โ””โ”€โ”€ ๐Ÿ __main__.py
โ”œโ”€โ”€ ๐Ÿ“ tests
โ”‚   โ”œโ”€โ”€ ๐Ÿ __init__.py
โ”‚   โ””โ”€โ”€ ๐Ÿ test_richpyls.py
โ””โ”€โ”€ ๐Ÿ“„ uv.lock

# Tree format with long listing and Rich table
richpyls -tl src
โ””โ”€โ”€ drwxr-xr-x  5 user staff     160B Jul 11 18:34 ๐Ÿ“ richpyls
    โ”œโ”€โ”€ drwxr-xr-x  4 user staff     128B Jul 11 18:34 ๐Ÿ“ __pycache__
    โ”‚   โ”œโ”€โ”€ -rw-r--r--  1 user staff     622B Jul 11 18:34 ๐Ÿ“„ __init__.cpython-313.pyc
    โ”‚   โ””โ”€โ”€ -rw-r--r--  1 user staff   14.8KB Jul 11 18:34 ๐Ÿ“„ __main__.cpython-313.pyc
    โ”œโ”€โ”€ -rw-r--r--  1 user staff     452B Jul 11 18:34 ๐Ÿ __init__.py
    โ””โ”€โ”€ -rw-r--r--  1 user staff   12.1KB Jul 11 18:34 ๐Ÿ __main__.py

Technologies

Dependencies

  • Python 3.13+: Modern Python with type hints and advanced features
  • click: Command-line interface creation toolkit
  • rich: Rich text and beautiful formatting for the terminal

Development Dependencies

  • pytest: Testing framework for comprehensive test coverage
  • mypy: Static type checker for Python
  • ruff: Fast Python linter and formatter
  • bandit: Security vulnerability scanner
  • pre-commit: Git hooks for automated quality checks
  • uv: Fast Python package manager and resolver

Build & Deployment

Build Status Tests

Development & Contributing

Contributions are welcome! Here's how you can set up the development environment and contribute:

Setup

  1. Fork the repository or clone directly:

    git clone https://github.com/lpozo/richpyls.git
    cd richpyls
    
  2. Reproduce the development environment:

    uv sync --dev
    
  3. Set up pre-commit hooks for code quality:

    uv run pre-commit install
    

Running Tests

# Run all tests
uv run python -m pytest

# Run tests with verbose output
uv run python -m pytest -v

# Run tests with coverage
uv run python -m pytest --cov=richpyls

Type Checking

# Check types with mypy
uv run mypy src/richpyls/

# Check all Python files
uv run mypy .

Code Quality and Formatting

The project uses automated code quality tools:

# Format code with ruff
uv run ruff format .

# Lint code with ruff
uv run ruff check . --fix

# Security scan with bandit
uv run bandit -r src/

Pre-commit hooks automatically run quality checks on every commit.

Contributing Workflow

  1. Create a feature branch: git checkout -b feature/amazing-feature

  2. Make your changes: Implement your feature or bug fix

  3. Add tests: Ensure your changes are well-tested

  4. Run quality checks:

    uv run python -m pytest          # Run tests
    uv run mypy src/richpyls/        # Type check
    uv run ruff format .             # Format code
    uv run ruff check .              # Lint code
    
  5. Commit your changes: git commit -m 'Add amazing feature'

  6. Push to the branch: git push origin feature/amazing-feature

  7. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add type hints to all new code
  • Write tests for new functionality
  • Update documentation as needed
  • Ensure all tests pass before submitting

Project Standards

The project maintains high code quality through:

  • Type annotations: All functions and variables are type-annotated
  • Comprehensive tests: Excellent test coverage with edge cases
  • Clean architecture: Well-organized code with clear separation of concerns
  • Modern Python: Uses latest Python features and best practices
  • Rich UI: Beautiful terminal output with colors, icons, and professional formatting

Build & Publishing

For information about building and publishing the package, see BUILD_PUBLISHING.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Leodanis Pozo Ramos


โญ If you found this project helpful, please give it a star!

Acknowledgments

  • Inspired by the Unix ls command
  • Built with modern Python best practices
  • Thanks to the Python community for excellent tools and libraries
  • Special thanks to the Rich library for beautiful terminal output
  • Development assisted by GitHub Copilot Chat for enhanced productivity

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

richpyls-0.1.3.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

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

richpyls-0.1.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file richpyls-0.1.3.tar.gz.

File metadata

  • Download URL: richpyls-0.1.3.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for richpyls-0.1.3.tar.gz
Algorithm Hash digest
SHA256 27a68b126ae4007cb757d43b4573331c566a3a073bcf40302428f3ba5475cc13
MD5 e5d67a3a6df21a1880dfddb6690d0c08
BLAKE2b-256 3fd3bda5832a54dd2ae4b10665d7e3459c1d73da6c2a10e3b12fe7c64d271332

See more details on using hashes here.

Provenance

The following attestation bundles were made for richpyls-0.1.3.tar.gz:

Publisher: publish.yml on lpozo/richpyls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file richpyls-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: richpyls-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for richpyls-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 84fdef27bd27c1ba0875037698f3ba230cdc74c7481927ca52bd7d8268c4a23e
MD5 e013d6ee8b66b97f597f5abf65982ed1
BLAKE2b-256 4a009192be6248bb27d29212f6447b504587b2b6a8fe632a8e450eb598e21127

See more details on using hashes here.

Provenance

The following attestation bundles were made for richpyls-0.1.3-py3-none-any.whl:

Publisher: publish.yml on lpozo/richpyls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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