Skip to main content

BaseBender

CI PyPI Python License

This project provides a Python module for rebaseing strings between different digit sets (positional number systems). It also includes a command-line interface (CLI) for easy usage.

Screenshot of the GUI. Shows example conversion

Project Goal

The primary goal is to provide a flexible and efficient tool for rebaseing numbers between different digit sets.

Features

  • Flexible Digit Set Definition: Define source and target digit sets using simple strings, supporting rebaseing between standard and non-standard positional number systems (e.g., different Unicode symbol sets of varying lengths).
  • Tiered Configuration for Digit Sets: Load pre-defined digit sets from package, system, and user-specific TOML configuration files, allowing for easy extension and customization.
  • Intelligent Digit Set Discovery: Suggests relevant pre-defined digit sets based on the input string's content, enhancing usability for the GUI.
  • Dynamic Input Digit Set: Automatically derives the input digit set from the input string if not explicitly provided. In the GUI, selecting "Derived from Input" from the preset dropdown will populate the input digit set field with the currently derived digit set. When the input digit set field is empty and the input string is not empty, its placeholder text will dynamically display the derived digit set from the input string, along with a visual cue. If both the input string and input digit set field are empty, the default placeholder text will be shown.
  • Efficient Rebaseing: Utilizes bit-packing to minimize space during intermediate rebase.
  • Enhanced Error Handling: Provides clear and informative error messages across CLI, API, and GUI, with structured error responses for the API.
  • Command-Line Interface (CLI): Rebase strings directly from the terminal with improved help text and error reporting.
  • Graphical User Interface (GUI): An intuitive interface for rebaseing, featuring digit set manipulation, tooltips, and a clear status bar for error messages.
  • Flexible Rebase Behavior: Handles empty input strings, empty output digit sets, and single-character output digit sets gracefully.

Installation

Prerequisites

  • Python 3.13+
  • uv (fast Python package manager)

Setup

  1. Clone the repository:

    git clone https://github.com/mexc/base-bender.git
    cd base-bender
    
  2. Install dependencies using uv:

    uv sync
    

    This will create a virtual environment and install all project dependencies.

  3. Generate GUI resource files:

    uv run bin/generate_resources.py
    

Running the Application

This project provides several entry points for different interfaces: a command-line interface (CLI), a graphical user interface (GUI), and a web API. You can run them using uv:

  • Command-Line Interface (CLI):

    uv run basebender --help
    

    This will display the help message for the CLI. For detailed usage examples, refer to CLI Examples.

  • Graphical User Interface (GUI):

    uv run basebender-gui
    

    This will launch the desktop application.

  • Web API:

    uv run basebender-api
    

    This will start the FastAPI server, typically accessible at http://127.0.0.1:8000. For detailed API usage examples, refer to API Examples.

Configuration

The BaseBender supports loading pre-defined digit sets from tiered TOML configuration files. This allows for a flexible and extensible way to manage common digit sets.

Configuration File Locations (in order of precedence: User > System > Package)

  • Package Configuration:

    • Location: rebaser/resources/data/default_digit_sets.toml within the installed package.
    • Purpose: Contains a comprehensive set of standard, built-in digit sets (e.g., Binary, Decimal, Hexadecimal, Base64, ASCII Printable).
    • Example content:
      [[digit_sets]]
      name = "Binary"
      digits = "01"
      
      [[digit_sets]]
      name = "Decimal"
      digits = "0123456789"
      
  • System Configuration:

    • Location (Linux/macOS): /etc/digit_set_rebaser/digit_sets.toml
    • Location (Windows): %PROGRAMDATA%\digit_set_rebaser\digit_sets.toml
    • Purpose: Allows system administrators to define digit sets available to all users on the system.
  • User Configuration:

    • Location (Linux/macOS): ~/.config/digit_set_rebaser/digit_sets.toml
    • Location (Windows): %APPDATA%\digit_set_rebaser\digit_sets.toml
    • Purpose: Allows individual users to define their own custom digit sets or override system/package defaults.

Adding Custom Digit Sets

To add your own custom digit sets, create or edit the digit_sets.toml file in your user configuration directory (or system directory for system-wide availability). Follow the TOML format shown in the example above. Digit sets defined in higher precedence tiers will override those with the same name in lower tiers.

Usage

For detailed CLI usage examples, refer to CLI Examples. For detailed API usage examples, refer to API Examples.

Running Tests

To run the unit tests, use uv:

uv run pytest

Project Structure

This project is organized into several key directories and files at the root level. For detailed descriptions of files within subdirectories, please refer to their respective STRUCTURE.md files:

  • bin/ - Contains utility scripts for project setup and updates.
  • docs/ - Houses documentation files, including API and CLI usage examples.
  • src/ - Contains the core source code for the application, including API, CLI, GUI, and rebaser logic.
  • tests/ - Holds unit tests for the project's modules.

Root Level Files:

  • .gitattributes: Configures Git attributes for various paths.
  • .gitignore: Specifies intentionally untracked files to ignore.
  • .pre-commit-config.yaml: Configuration for pre-commit hooks to enforce code quality.
  • CONTRIBUTING.md: Guidelines for contributing to the project.
  • LICENSE: The project's license file (MIT License).
  • README.md: The main project README, providing an overview and entry point.
  • pyproject.toml: Project metadata and dependencies managed by uv.

Contributing

Contributions are welcome! Please refer to the Contribution Guidelines for more details.

License

This project is licensed under the MIT License.

Metadata

Release files for basebender 0.2.1

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

Source distribution (sdist)

Source distribution for basebender 0.2.1
File Size Uploaded Provenance
basebender-0.2.1.tar.gz 84.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for basebender 0.2.1
File Interpreter ABI Platform
basebender-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 115.9 kB

Release files / basebender-0.2.1.tar.gz

Download URL basebender-0.2.1.tar.gz
Size 84.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8f79e2b66d453bd9960701166007a5e870c6d611caa114a35ea7b3c8eec22c09
BLAKE2b-256 checksum
How to use checksums
045a4097931bc4b4d38e383a019f9e4f1cece654362808e278e33fbe4054d339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / basebender-0.2.1-py3-none-any.whl

Download URL basebender-0.2.1-py3-none-any.whl
Size 31.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e7fa002d97c5c98b982156680be2f166b9e58c708c9474c63b8c6cea63015dc
BLAKE2b-256 checksum
How to use checksums
874a784c369870266689837fa2936a6d364e5b23ef9560b7171bcc60df9ec0a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Security for basebender 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for basebender-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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