A Python3 port of the javascript bit-field library by Aliaksei Chapyzhenka.
This package is also available as an extension for Sphinx: sphinxcontrib-bitfield.
Install
pip install bit_field
To install this package with JSON5 support:
pip install bit_field[JSON5]
Library usage
from bit_field import render, jsonml_stringify
reg = [
{'bits': 8, 'name': 'data'}
]
jsonml = render(reg, hspace=888)
html = jsonml_stringify(jsonml)
# <svg...>
CLI Usage
bit_field [options] input > alpha.svg
options
input : input JSON filename - must be specified always
--input : input JSON filename (kept for compatibility)
--compact : compact rendering mode
--vspace : vertical space - default 80
--hspace : horizontal space - default 640
--lanes : rectangle lanes - default 2
--bits : overall bitwidth - default 32
--fontfamily : - default sans-serif
--fontweight : - default normal
--fontsize : - default 14
--strokewidth: - default 1
--hflip : horizontal flip
--vflip : vertical flip
--trim : horizontal space available for a single character
--uneven: : uneven lanes
--beautify : use xml beautifier
--json5 : force json5 input format (need json5 python module)
--no-json5 : never use json5 input format
alpha.json
[
{ "name": "IPO", "bits": 8, "attr": "RO" },
{ "bits": 7 },
{ "name": "BRK", "bits": 5, "attr": "RW", "type": 4 },
{ "name": "CPK", "bits": 1 },
{ "name": "Clear", "bits": 3 },
{ "bits": 8 }
]
alpha.svg
Licensing
This work is based on original work by Aliaksei Chapyzhenka under the MIT license (see LICENSE-ORIGINAL).
Release files for bit-field 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bit_field-1.0.1.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bit_field-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / bit_field-1.0.1.tar.gz
| Download URL | bit_field-1.0.1.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2dd114661dd6f393771b59478ea0d35f02e985066c1d14e6200c508e60daf900
|
|
BLAKE2b-256 checksum How to use checksums |
10577cd9318081a4e194e972a023aaa4b209c7e580a72341e6b1c4550d44f18f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / bit_field-1.0.1-py3-none-any.whl
| Download URL | bit_field-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dd785c1665d390305288fa5069fdcbbfc4db6ec9e4a82b7376f40739d20cab7
|
|
BLAKE2b-256 checksum How to use checksums |
0e9912a9895e1d494fa7b4a5be891c5ba633514ef016b64598de77ce778f6ff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|