Skip to main content

CLI tool for managing linting, formatting and testing

Project description

🧹 Tidy CLI ✨

Keep your code clean and robust!

Python Versions GitHub PyPI Latest Release License - MIT Gmail LinkedIn


Platforms

Mac OS Linux Windows


Tidy CLI simplifies your development process by combining essential tools like ruff, mypy, pydoclint, and pytest into a single, easy-to-use command-line interface. Perfect for maintaining code quality and running tests across Python projects of any size.

✨ Key Features

  • 🔧 Unified Linting: Combines ruff, mypy, and pydoclint in one command
  • 🎨 Smart Formatting: Automatic code formatting with ruff
  • 🧪 Integrated Testing: Run pytest with coverage reporting
  • ⚡ Auto-fix: Automatically fix linting issues where possible
  • 🔄 Interactive Mode: Review and apply fixes interactively
  • 📊 Flexible Execution: Target specific files, directories, or entire projects
  • ⚙️ Configurable: Skip tools, customize paths, and adapt to your workflow

🚀 Installation

With pip

# Using pip
pip install tidy-cli

With uv (recommended)

uv pip install tidy-cli
uv add tidy-cli

Requirements

  • Python 3.10+
  • Works on Linux, macOS, and Windows

🏃 Quick Start

1. Get a Feeling

# See what you are dealing with
tidy-cli
# Deep dive on what you are dealing with
tidy-cli --help
# Install auto-completion for easier usage
tidy-cli --install-completion
# Set up tidy-cli for your project
tidy-cli init

The settings are about:

  • The Pytest folder path, just type . if no chdir is made when running tests.
  • The location of the pyproject.toml file relative to the Pytest folder path.
  • The default path to lint if no other path is passed (e.g., src if one wants to lint the entire src folder as default).
  • The path to the pyproject.toml relative to the cwd when running the lint commands.

2. Run Code Quality Checks

# Lint your entire project (i.e., on the default lint path)
tidy-cli lint run

# Auto-fix (fixable) issues
tidy-cli lint run --fix

3. Run Tests

# Run all tests with coverage
tidy-cli pytest run

That's it! Tidy CLI will handle the rest.

📖 Usage Guide

Code Quality & Linting Commands

# Run all linters (ruff, mypy, pydoclint)
tidy-cli lint run

# Target specific files or directories (relative to the default path/folder)
tidy-cli lint run src/my_module
tidy-cli lint run my_module/file.py # if src has been chosen as default path/folder

# Interactive mode (i.e., you are prompted if to run a specific linter/formatter/checker)
tidy-cli lint run --interactive

# Auto-fix issues where possible
tidy-cli lint run --fix

# Skip specific linters
tidy-cli lint run --skip-mypy
tidy-cli lint run --skip-pydoclint

Testing Commands

# Run all tests with coverage
tidy-cli pytest run

# Run specific test files
tidy-cli pytest run tests/test_example.py

# Show detailed test output on a path (logs can be displayed only on path runs)
tidy-cli pytest run tests/test_example.py --logs

CLI Configuration

# Initialize settings for all tools
tidy-cli init

# Initialize specific tool settings
tidy-cli lint init
tidy-cli pytest init

# Show current version
tidy-cli version

⚙️ Configuration

Tidy CLI stores settings in local/tidy_cli_settings.json with sensible defaults:

{
  "lint_default_path": "src",
  "lint_config_path": "pyproject.toml",
  "pytest_default_path": "tests",
  "pytest_config_path": "pyproject.toml"
}

Tool Configuration

Configure the underlying tools in your pyproject.toml:

[tool.ruff]
lint.select = [
    "I", 
    "E", 
    "F", 
    "W", 
    "C90",
    "N", 
    "D", 
]

[tool.mypy]
python_version = "3.11"
ignore_missing_imports = true

[tool.pydoclint]
style = "sphinx"

[tool.coverage.run]
omit = [
    "tests/*",
]

🤝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run the tests: tidy-cli pytest run
  5. Run the linters: tidy-cli lint run --fix
  6. Commit your changes: git commit -m 'Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. Open a Pull Request

Development Setup

git clone https://github.com/alfredo-cinelli/tidy-cli.git
cd tidy-cli
uv venv .venv --python=3.12
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv sync --group dev
uv pip install -e .

📋 Changelog

See CHANGELOG.md for a detailed history of changes.

🐛 Issues & Support

📄 License

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

🙏 Acknowledgments

  • Ruff - Fast Python linter and formatter
  • MyPy - Static type checker
  • Pydoclint - Docstring linter
  • Pytest - Testing framework

Made with ❤️ for the Python community

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

tidy_cli-0.1.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

tidy_cli-0.1.3-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tidy_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tidy_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cc21ad39c8c2667972e41c8191842dc54c3dba87a139ead2d82de2a7e89df004
MD5 4355c72de963f2bd261f81252ca5f7d0
BLAKE2b-256 0b77ecaf00142c9dd4417bb474d9c1f318fe6cf5249231e24a1e048fb31a0232

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidy_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tidy_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e37a642c465ef8b23dae4c3645aa49a03621a65cd1505e7600a03e71e7d84032
MD5 00dfc8d74f174916c1b37f29d8014400
BLAKE2b-256 11af9fd722f3b6d4ecaaa66c75730bf452d9fd0a89b3feb69449beb027f27535

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