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
- Fork and clone the repository
- Create a virtual environment:
python -m venv venv - Activate the virtual environment
- Install development dependencies:
pip install -e ".[dev]" - Install pre-commit hooks:
pre-commit install
Adding new features
- Create your feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run all checks:
make check-all - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - 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
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐จโ๐ป Author
Rahul Kumar
- Email: pkrk14@gmail.com
- GitHub: @your-username
๐ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e2f665f742641b7a3b9b3181dd6302d0c458c81c9aeb8cfbe636adeeb286d22
|
|
| MD5 |
c960e85d4b932350746ce081e938fd4d
|
|
| BLAKE2b-256 |
c32423727b06d6579a6974bbf5b42f3535abe7b8fa202daf61cd4f347f88eb1a
|
File details
Details for the file cli_dev_toolbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cli_dev_toolbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
736971087fa8042c056d1ff7ce75560cdbac3286c38b40f28623f706a2a24f28
|
|
| MD5 |
3a52e05868717efb05498c1efd0bd839
|
|
| BLAKE2b-256 |
9f58323f4a734c6ad57816c55c25d917b597598bd05ae58ee687a05b24e90530
|