Skip to main content

DevelopersToolbox logo
Github Build Status License Created
Release Released Commits since release

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.

Release files for wolfsoftware.template-package-cli 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wolfsoftware.template-package-cli 0.1.2
File Size Uploaded
wolfsoftware_template_package_cli-0.1.2.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wolfsoftware.template-package-cli 0.1.2
File Interpreter ABI Platform
wolfsoftware.template_package_cli-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / wolfsoftware_template_package_cli-0.1.2.tar.gz

Download URL wolfsoftware_template_package_cli-0.1.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0cc5f38024aa5f02b46e804b9006d0e5783c74e83e56ed7b34283bed3d77c140
BLAKE2b-256 checksum
How to use checksums
ffae06027cb8f79d58a2e1b494442f1584a25524966fc0ae0f26ea85d3e07107
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / wolfsoftware.template_package_cli-0.1.2-py3-none-any.whl

Download URL wolfsoftware.template_package_cli-0.1.2-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f2a0edef4b5241ec008482ab0f91b1342317c2745c1ffb48d0374d70e92c341
BLAKE2b-256 checksum
How to use checksums
7496cb22ff1bbac7bf48f68df2a43dad2b8348c282e3cb1ff83b78f4dd3ef6ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page