A template python command line package.
Project description
Overview
This is the package template that we use internally when creating new python cli based tools. It has all of the basic functionality and workflows needed to create, build and publish new package to PyPI.
This package provides a command-line utility for processing and handling various tasks using a set of predefined arguments and configurations. The project aims to serve as a baseline for developing similar command-line applications.
It includes features such as argument parsing, configuration management, and a modular structure to facilitate scalable and maintainable code development.
We also provide 2 other templates which we use.
Features
- Modular Architecture: Organize your code into modules for better maintainability.
- Argument Parsing: Easily handle command-line arguments using
argparse
. - Configuration Management: Generate configuration objects from command-line arguments.
- Custom Exceptions: Implement custom exceptions for specific error handling.
Installation
To install the cli package, clone the repository and navigate to the project directory:
git clone https://github.com/DevelopersToolbox/template-package-cli.git
cd template-package-cli
It is recommended to use a virtual environment to manage dependencies. You can create and activate a virtual environment using the following commands:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
Install the required dependencies:
pip install -r requirements.txt
Usage
To run the cli package, execute the main
function from the main script:
python -m wolfsoftware.template_package_cli.main --required <value>
Command-Line Arguments
The application supports several command-line arguments:
-h, --help
: Show help message and exit.-d, --debug
: Enable debug mode for verbose output.-v, --verbose
: Enable verbose output to show scan results as they come in.-V, --version
: Show the program's version number and exit.-i, --optional-integer
: An optional integer argument (default: 2).-s, --optional-string
: An optional string argument (default: "me").-r, --required
: A required string argument.
Example usage:
python -m wolfsoftware.template_package_cli.main -r "required_value" -i 10 -s "optional_string"
Project Structure
The project is organized as follows:
template-package-cli/
├── wolfsoftware/
│ └── template_package_cli/
│ ├── __init__.py
│ ├── cli.py
│ ├── config.py
│ ├── exceptions.py
│ ├── globals.py
│ └── main.py
├── README.md
├── setup.py
└── requirements.txt
wolfsoftware/template_package_cli
: Contains the core modules of the application.cli.py
: Handles the command-line arguments and main program flow.config.py
: Handles configuration creation from command-line arguments.exceptions.py
: Handles custom exceptions.globals.py
: Defines global constants used across the application.main.py
: The main script that orchestrates argument parsing and program execution.
requirements.txt
: Lists the dependencies required for the project.README.md
: The file you are currently reading.
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
File details
Details for the file wolfsoftware_template_package_cli-0.1.2.tar.gz
.
File metadata
- Download URL: wolfsoftware_template_package_cli-0.1.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cc5f38024aa5f02b46e804b9006d0e5783c74e83e56ed7b34283bed3d77c140 |
|
MD5 | 2ecf7b381e642b2793f8606de88cfe0a |
|
BLAKE2b-256 | ffae06027cb8f79d58a2e1b494442f1584a25524966fc0ae0f26ea85d3e07107 |
File details
Details for the file wolfsoftware.template_package_cli-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: wolfsoftware.template_package_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f2a0edef4b5241ec008482ab0f91b1342317c2745c1ffb48d0374d70e92c341 |
|
MD5 | f2f682b285320b747dcba663f0caf19f |
|
BLAKE2b-256 | 7496cb22ff1bbac7bf48f68df2a43dad2b8348c282e3cb1ff83b78f4dd3ef6ff |