Skip to main content

pybasemkit

Python base module kit: YAML/JSON I/O, structured logging, CLI tooling, shell execution, and remote pydevd debug support.

PyPi PyPI Status License pypi format downloads
GitHub Github Actions Build Release Contributors Last Commit GitHub issues GitHub closed issues
Code style-black imports-isort
Docs API Docs formatter-docformatter style-google

Docs and Tutorials

Wiki

CLI Tooling

basemkit.base_cmd.BaseCmd is the standard base class for every BITPlan command line interface. It provides the house-standard options -a/--about, -d/--debug, --debugServer/--debugPort (remote pydevd), -f/--force, -q/--quiet, -v/--verbose and -V/--version plus consistent exit codes (0 = OK, 1 = KeyboardInterrupt, 2 = Exception). Downstream projects must subclass it instead of using plain argparse.

The canonical pattern - a Version dataclass and a BaseCmd subclass:

from dataclasses import dataclass

from basemkit.base_cmd import BaseCmd

import mytool


@dataclass
class Version:
    """Version information for mytool."""

    name: str = "mytool"
    version: str = mytool.__version__
    date: str = "2026-08-02"
    updated: str = "2026-08-02"
    description: str = "what mytool does"
    authors: str = "Wolfgang Fahl"
    doc_url: str = "https://wiki.bitplan.com/index.php/Mytool"
    chat_url: str = "https://github.com/WolfgangFahl/mytool/discussions"
    cm_url: str = "https://github.com/WolfgangFahl/mytool"


class MytoolCmd(BaseCmd):
    """mytool command line interface."""

    def __init__(self):
        super().__init__(Version())

    def add_arguments(self, parser):
        """Add tool arguments to the given parser."""
        super().add_arguments(parser)
        parser.add_argument("--input", help="input file")

    def handle_args(self, args) -> bool:
        """Handle parsed arguments."""
        handled = super().handle_args(args)
        if not handled and args.input:
            # tool logic here
            handled = True
        return handled


def main(argv=None) -> int:
    """CLI entry point."""
    cmd = MytoolCmd()
    exit_code = cmd.run(argv)
    return exit_code

Register the entry point in pyproject.toml:

[project.scripts]
mytool = "mytool.mytool_cmd:main"

Live examples: gov-service, ProfiWiki, djvu-viewer, ngwidgets.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybasemkit-0.2.5.tar.gz (38.2 kB view details)

Uploaded Source

Built Distribution

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

pybasemkit-0.2.5-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file pybasemkit-0.2.5.tar.gz.

File metadata

  • Download URL: pybasemkit-0.2.5.tar.gz
  • Upload date:
  • Size: 38.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pybasemkit-0.2.5.tar.gz
Algorithm Hash digest
SHA256 17e0b2b88ffc591d023b69ae5d81d417010fc30977e33f8faee851467591f210
MD5 36526ad44425b8e8efae000629a73917
BLAKE2b-256 f7c38495d0afe4df6dbbf989fb251c50ee383db2cdfbe49cbee9fe55ac523706

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybasemkit-0.2.5.tar.gz:

Publisher: upload-to-pypi.yml on WolfgangFahl/pybasemkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pybasemkit-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: pybasemkit-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pybasemkit-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3ae73dc8258e06c6174471fe26c570721d2b9ddfca19a78f09e49d8a6a028c13
MD5 bfee434eac7b183765d87eaa996a1a54
BLAKE2b-256 35d4ce671da6371f9ae26b59e6d4054f83d6004f4e20710542778f3f85a7ffe1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybasemkit-0.2.5-py3-none-any.whl:

Publisher: upload-to-pypi.yml on WolfgangFahl/pybasemkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page