Skip to main content

Base conversion command line utility.

Project description

convbase

PyPI - Status PyPI - Version PyPI - License PyPI - Python Version CI

A command-line utility for converting integers between binary, octal, decimal, and hexadecimal bases.

Installation

pip install convbase

Or with uv:

uv tool install convbase

Commands

Command Output base
bin Binary (0b)
oct Octal (0o)
dec Decimal
hex Hexadecimal (0x)

Input formats

All commands accept VALUE in any of the following formats:

Format Prefix Example
Decimal (none) 10
Binary 0b 0b1010
Octal 0o 0o12
Hexadecimal 0x 0xA

Examples

$ bin 10
0b1010
$ bin 0xFF
0b11111111

$ oct 0b1010
0o12
$ oct 0xA
0o12

$ dec 0b1010
10
$ dec 0xFF
255

$ hex 10
0xa
$ hex 0b11111111
0xff

Error handling

Passing a value that cannot be parsed as an integer exits with a non-zero status and prints an error:

$ bin hello
Error: Invalid value for 'VALUE': invalid integer: 'hello'

Development

git clone https://github.com/jkomalley/convbase
cd convbase
just setup
just all       # lint, type-check, and test

License

MIT

Project details


Download files

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

Source Distribution

convbase-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

convbase-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file convbase-1.0.0.tar.gz.

File metadata

  • Download URL: convbase-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for convbase-1.0.0.tar.gz
Algorithm Hash digest
SHA256 23bfff02aba952778939d402eb376dd720c2a8f991e5aa74fd35c3b9bdc61078
MD5 54f4b6540d45cd3eabc343a99fccff58
BLAKE2b-256 7f41628fda93cecf3fd08a6c894aa1ce3e065ac8985a709e50b0f65a26bfacee

See more details on using hashes here.

Provenance

The following attestation bundles were made for convbase-1.0.0.tar.gz:

Publisher: cd.yml on jkomalley/convbase

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

File details

Details for the file convbase-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: convbase-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for convbase-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b6b7d464248067f0b0a82e7caa4cf13c1d6fa423e466de6cbfdbc5cf17712e
MD5 684ec413b1786cf65e5b4ad3250a45b0
BLAKE2b-256 3585ecbc5d4dd6cf295b5c6cf806f37f83108035ead6ad6f9789ee94af8e34e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for convbase-1.0.0-py3-none-any.whl:

Publisher: cd.yml on jkomalley/convbase

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 Pingdom Monitoring Sentry Error logging StatusPage Status page