Skip to main content

A Python CLI utility for developers - JSONโ†”CSV conversion, pretty JSON, and URL fetch timing.

Project description

CLI Dev Toolbox

A Python CLI utility for developers to enhance productivity and streamline workflows. This toolbox provides essential tools for data conversion, JSON formatting, and HTTP operations.

๐Ÿš€ Features

  • JSON to CSV Conversion: Convert JSON files to CSV format for data analysis
  • Pretty JSON Printing: Format JSON files with proper indentation and readability
  • URL Fetching: Fetch URLs and measure response times (coming soon)

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.10 or higher
  • pip package manager

Install from source

# Clone the repository
git clone https://github.com/rahulkumar/cli-dev-toolbox.git
cd cli-dev-toolbox

# Create and activate virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package in development mode
pip install -e .

# For development (includes testing and linting tools)
pip install -e ".[dev]"

Install from PyPI (when published)

pip install cli-dev-toolbox

๐Ÿ› ๏ธ Usage

The CLI tool provides several commands to help with common development tasks:

JSON to CSV Conversion

Convert JSON files to CSV format for easier data analysis:

cli-dev-toolbox json2csv input.json output.csv

Example:

# Convert a JSON file containing employee data
cli-dev-toolbox json2csv data.json employees.csv

The converter expects JSON files with an array of objects structure, where each object represents a row in the CSV file.

Pretty JSON Printing

Format JSON files with proper indentation for better readability:

cli-dev-toolbox prettyjson input.json

Example:

# Format a JSON file for better readability
cli-dev-toolbox prettyjson config.json

URL Fetching (Coming Soon)

Fetch URLs and measure response times:

cli-dev-toolbox fetch https://example.com

๐Ÿ“ Project Structure

cli-dev-toolbox/
โ”œโ”€โ”€ cli_dev_toolbox/           # Main package directory
โ”‚   โ”œโ”€โ”€ __init__.py           # Package initialization and metadata
โ”‚   โ”œโ”€โ”€ toolbox.py            # Main CLI interface and argument parsing
โ”‚   โ”œโ”€โ”€ converters.py         # Data conversion utilities (JSONโ†”CSV)
โ”‚   โ””โ”€โ”€ fetcher.py            # HTTP fetching utilities (planned)
โ”œโ”€โ”€ docs/                     # Documentation
โ”‚   โ”œโ”€โ”€ README.md             # Documentation overview
โ”‚   โ”œโ”€โ”€ api.md                # API documentation
โ”‚   โ”œโ”€โ”€ development.md        # Development guide
โ”‚   โ””โ”€โ”€ examples.md           # Usage examples
โ”œโ”€โ”€ examples/                 # Example files
โ”‚   โ””โ”€โ”€ sample_data.json      # Sample data for testing
โ”œโ”€โ”€ tests/                    # Test suite
โ”‚   โ”œโ”€โ”€ __init__.py           # Test package initialization
โ”‚   โ”œโ”€โ”€ test_basic.py         # Basic test suite
โ”‚   โ”œโ”€โ”€ test_converters.py    # Converter module tests
โ”‚   โ””โ”€โ”€ test_toolbox.py       # CLI toolbox tests
โ”œโ”€โ”€ .github/                  # GitHub configuration
โ”‚   โ””โ”€โ”€ workflows/            # CI/CD workflows
โ”œโ”€โ”€ pyproject.toml            # Project configuration and dependencies
โ”œโ”€โ”€ requirements.txt          # Core dependencies
โ”œโ”€โ”€ requirements-dev.txt      # Development dependencies
โ”œโ”€โ”€ setup.py                  # Setup script (for compatibility)
โ”œโ”€โ”€ MANIFEST.in               # Package manifest
โ”œโ”€โ”€ Makefile                  # Development tasks
โ”œโ”€โ”€ .pre-commit-config.yaml   # Pre-commit hooks configuration
โ”œโ”€โ”€ CHANGELOG.md              # Version history
โ””โ”€โ”€ README.md                 # This file

๐Ÿงช Testing

Run the test suite to ensure everything works correctly:

# Run all tests
pytest

# Run with coverage
pytest --cov=cli_dev_toolbox

# Run with verbose output
pytest -v

# Run specific test file
pytest tests/test_converters.py

๐Ÿ”ง Development

Quick Start

# Install development dependencies
make install-dev

# Run all checks
make check-all

# Format code
make format

# Run tests
make test

Setting up development environment

  1. Fork and clone the repository
  2. Create a virtual environment: python -m venv venv
  3. Activate the virtual environment
  4. Install development dependencies: pip install -e ".[dev]"
  5. Install pre-commit hooks: pre-commit install

Adding new features

  1. Create your feature branch: git checkout -b feature/amazing-feature
  2. Make your changes and add tests
  3. Run all checks: make check-all
  4. Commit your changes: git commit -m 'Add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request

Available Make Commands

make help          # Show all available commands
make install       # Install package in development mode
make install-dev   # Install development dependencies
make test          # Run tests
make test-cov      # Run tests with coverage
make lint          # Run linting checks
make format        # Format code
make type-check    # Run type checking
make clean         # Clean build artifacts
make build         # Build package
make dist          # Create distribution files

๐Ÿ“ Dependencies

Core Dependencies

  • requests>=2.31.0: HTTP library for URL fetching operations

Development Dependencies

  • pytest>=7.4.0: Testing framework
  • pytest-cov>=4.1.0: Coverage reporting
  • black>=23.0.0: Code formatting
  • flake8>=6.0.0: Linting
  • mypy>=1.5.0: Type checking
  • twine>=4.0.0: Package uploading
  • build>=1.0.0: Package building
  • pre-commit>=3.3.0: Git hooks

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  1. Follow PEP 8 style guidelines
  2. Add tests for new features
  3. Update documentation as needed
  4. Ensure all tests pass before submitting

๐Ÿ“„ License

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

๐Ÿ‘จโ€๐Ÿ’ป Author

Rahul Kumar

๐Ÿ› Issues

If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.

๐Ÿ“ˆ Roadmap

  • Implement pretty JSON printing functionality
  • Add URL fetching with response time measurement
  • Add CSV to JSON conversion
  • Add support for different JSON structures
  • Add configuration file support
  • Add more data format conversions (XML, YAML, etc.)

Note: This project is currently in active development. Some features may be incomplete or subject to change.

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

cli_dev_toolbox-0.1.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

cli_dev_toolbox-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file cli_dev_toolbox-0.1.0.tar.gz.

File metadata

  • Download URL: cli_dev_toolbox-0.1.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for cli_dev_toolbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5e2f665f742641b7a3b9b3181dd6302d0c458c81c9aeb8cfbe636adeeb286d22
MD5 c960e85d4b932350746ce081e938fd4d
BLAKE2b-256 c32423727b06d6579a6974bbf5b42f3535abe7b8fa202daf61cd4f347f88eb1a

See more details on using hashes here.

File details

Details for the file cli_dev_toolbox-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cli_dev_toolbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 736971087fa8042c056d1ff7ce75560cdbac3286c38b40f28623f706a2a24f28
MD5 3a52e05868717efb05498c1efd0bd839
BLAKE2b-256 9f58323f4a734c6ad57816c55c25d917b597598bd05ae58ee687a05b24e90530

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