A collection of practical Python CLI tools
Project description
๐ฆ Available on PyPI
Python CLI Tools
A collection of practical, well-tested command-line utilities implemented in Python. This project demonstrates modular CLI tool development with a clean src/ layout, comprehensive testing, and easy distribution via PyPI.
Table of Contents
Features
- Modular Design: Each tool is isolated in its own package under
src/, promoting maintainability and reusability. - Comprehensive Testing: Unit tests with
pytestensure reliability and facilitate refactoring. - Console Scripts: Tools are installable as command-line scripts via
pyproject.toml. - Minimal Dependencies: Only essential libraries are used, with
requestsfor network operations. - Cross-Platform: Compatible with Windows, macOS, and Linux.
- Open Source: Licensed under MIT, encouraging contributions and modifications.
Project Structure
python-cli-tools/
โโโ src/
โ โโโ file_organizer/
โ โ โโโ __init__.py
โ โ โโโ file_organizer.py
โ โโโ password_generator/
โ โ โโโ __init__.py
โ โ โโโ password_generator.py
โ โโโ weather_cli/
โ โโโ __init__.py
โ โโโ weather_cli.py
โโโ tests/
โ โโโ __init__.py
โ โโโ test_file_organizer.py
โ โโโ test_password_generator.py
โ โโโ test_weather_cli.py
โโโ docs/
โ โโโ usage_examples.md
โโโ .github/
โ โโโ workflows/
โ โโโ tests.yml
โโโ CHANGELOG.md
โโโ LICENSE
โโโ README.md
โโโ pyproject.toml
โโโ requirements.txt
โโโ .gitignore
Installation
Prerequisites
- Python 3.10 or higher
pipfor package management
Quick Install
-
Clone the repository:
git clone https://github.com/wrogistefan/python-cli-tools.git cd python-cli-tools
-
Create and activate a virtual environment:
python -m venv .venv # On Windows (PowerShell) .venv\Scripts\Activate.ps1 # On macOS/Linux source .venv/bin/activate
-
Install dependencies and the package in editable mode:
pip install -r requirements.txt pip install -e .
This installs the tools as console scripts: file-organizer, password-generator, and weather-cli.
Usage
After installation, run the tools directly from the command line:
file-organizer <directory>
password-generator
weather-cli --city "New York"
Alternatively, run as Python modules:
python -m file_organizer.file_organizer <directory>
python -m password_generator.password_generator
python -m weather_cli.weather_cli --city "New York"
Tools
File Organizer
Organizes files in a specified directory into subdirectories based on their file extensions.
Usage:
file-organizer <directory>
Example:
file-organizer ./downloads
Sample Output:
Moved: report.pdf -> ./downloads/pdf
Moved: photo.jpg -> ./downloads/jpg
Moved: README -> ./downloads/no_extension
Source: src/file_organizer/file_organizer.py
Password Generator
Generates secure, customizable random passwords with options for length and character sets.
Usage:
password-generator [options]
Options:
-l, --length: Specify password length (default: 12)--no-digits: Exclude digits--no-specials: Exclude special characters
Examples:
password-generator
password-generator -l 16 --no-specials
Sample Output:
k9F3nAq2Zo1LmV7$
Source: src/password_generator/password_generator.py
Weather CLI
Fetches and displays real-time weather data for a specified location using the Open-Meteo API.
Usage:
weather-cli --city <city_name>
weather-cli --lat <latitude> --lon <longitude>
Examples:
weather-cli --city "New York"
weather-cli --lat 37.075 --lon 15.286
Sample Output:
๐ Location: Syracuse, Italy (37.07542, 15.28664)
๐ค๏ธ Current Weather:
๐ก๏ธ Temperature: 12.9ยฐC
๐จ Wind Speed: 2.5 km/h
๐งญ Wind Direction: 270ยฐ
โฑ๏ธ Observation Time: 2025-12-25T17:45
Source: src/weather_cli/weather_cli.py
For more detailed examples, see docs/usage_examples.md.
Testing
Run the test suite using pytest:
pytest
Tests are located in the tests/ directory and cover all tools to ensure functionality and prevent regressions.
Development
Building for Distribution
To build wheel and source distributions:
pip install build
python -m build
Artifacts will be created in the dist/ directory.
Code Quality
- Use
blackfor code formatting (configured inpyproject.toml). - Follow PEP 8 style guidelines.
- Maintain high test coverage.
Adding New Tools
- Create a new package under
src/. - Implement the tool in a module with a
main()function. - Add console script entry in
pyproject.toml. - Write comprehensive tests in
tests/. - Update documentation.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature-name. - Write tests for new functionality.
- Ensure all tests pass:
pytest. - Commit your changes:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature-name. - Open a pull request.
Please read the contributing guidelines if available, and ensure your code adheres to the project's standards.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
ลukasz Perek
This project serves as a portfolio piece demonstrating practical CLI development, modular Python packaging, and the transition into software engineering and AI freelancing. git add README.md
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 Distributions
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 python_cli_tools-0.2.5-py3-none-any.whl.
File metadata
- Download URL: python_cli_tools-0.2.5-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
023efcf375f8824a91330d4d698a70097b17437d5232cdd125611ab2e0fd4e1c
|
|
| MD5 |
073818c360a05160003f396e336e2a70
|
|
| BLAKE2b-256 |
8fb08097e984b407b7e4a5580a8838385cbc975522d30ef74efbb52689781891
|