Base conversion command line utility.
Project description
convbase
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23bfff02aba952778939d402eb376dd720c2a8f991e5aa74fd35c3b9bdc61078
|
|
| MD5 |
54f4b6540d45cd3eabc343a99fccff58
|
|
| BLAKE2b-256 |
7f41628fda93cecf3fd08a6c894aa1ce3e065ac8985a709e50b0f65a26bfacee
|
Provenance
The following attestation bundles were made for convbase-1.0.0.tar.gz:
Publisher:
cd.yml on jkomalley/convbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convbase-1.0.0.tar.gz -
Subject digest:
23bfff02aba952778939d402eb376dd720c2a8f991e5aa74fd35c3b9bdc61078 - Sigstore transparency entry: 1054449251
- Sigstore integration time:
-
Permalink:
jkomalley/convbase@28a892af341e3e06a602fff92bc0495a83e4a57d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jkomalley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@28a892af341e3e06a602fff92bc0495a83e4a57d -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9b6b7d464248067f0b0a82e7caa4cf13c1d6fa423e466de6cbfdbc5cf17712e
|
|
| MD5 |
684ec413b1786cf65e5b4ad3250a45b0
|
|
| BLAKE2b-256 |
3585ecbc5d4dd6cf295b5c6cf806f37f83108035ead6ad6f9789ee94af8e34e7
|
Provenance
The following attestation bundles were made for convbase-1.0.0-py3-none-any.whl:
Publisher:
cd.yml on jkomalley/convbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convbase-1.0.0-py3-none-any.whl -
Subject digest:
c9b6b7d464248067f0b0a82e7caa4cf13c1d6fa423e466de6cbfdbc5cf17712e - Sigstore transparency entry: 1054449304
- Sigstore integration time:
-
Permalink:
jkomalley/convbase@28a892af341e3e06a602fff92bc0495a83e4a57d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jkomalley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@28a892af341e3e06a602fff92bc0495a83e4a57d -
Trigger Event:
release
-
Statement type: