bit-field


Namebit-field JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/Arth-ur/bitfield
SummaryA bitfield diagram renderer
upload_time2023-05-09 17:31:42
maintainer
docs_urlNone
authorArthur Gay
requires_python
licenseMIT
keywords bitfield bytefield diagram renderer svg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            A Python3 port of the javascript [bit-field library](https://github.com/drom/bitfield/) by [Aliaksei Chapyzhenka](https://github.com/drom).

This package is also available as an extension for Sphinx: [sphinxcontrib-bitfield](https://github.com/Arth-ur/sphinxcontrib-bitfield).

## Install

```sh
pip install bit_field
```

To install this package with JSON5 support:

```sh
pip install bit_field[JSON5]
```

## Library usage

```python
from bit_field import render, jsonml_stringify

reg = [
  {'bits': 8, 'name': 'data'}
]

jsonml = render(reg, hspace=888)
html = jsonml_stringify(jsonml)
# <svg...>
```

## CLI Usage

```sh
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

```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

![Heat Sink](https://raw.githubusercontent.com/Arth-ur/bitfield/master/bit_field/test/alpha.svg?sanitize=true)

### Licensing
This work is based on original work by [Aliaksei Chapyzhenka](https://github.com/drom) under the MIT license (see LICENSE-ORIGINAL).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Arth-ur/bitfield",
    "name": "bit-field",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "bitfield,bytefield,diagram,renderer,svg",
    "author": "Arthur Gay",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/10/57/7cd9318081a4e194e972a023aaa4b209c7e580a72341e6b1c4550d44f18f/bit_field-1.0.1.tar.gz",
    "platform": null,
    "description": "A Python3 port of the javascript [bit-field library](https://github.com/drom/bitfield/) by [Aliaksei Chapyzhenka](https://github.com/drom).\n\nThis package is also available as an extension for Sphinx: [sphinxcontrib-bitfield](https://github.com/Arth-ur/sphinxcontrib-bitfield).\n\n## Install\n\n```sh\npip install bit_field\n```\n\nTo install this package with JSON5 support:\n\n```sh\npip install bit_field[JSON5]\n```\n\n## Library usage\n\n```python\nfrom bit_field import render, jsonml_stringify\n\nreg = [\n  {'bits': 8, 'name': 'data'}\n]\n\njsonml = render(reg, hspace=888)\nhtml = jsonml_stringify(jsonml)\n# <svg...>\n```\n\n## CLI Usage\n\n```sh\nbit_field [options] input > alpha.svg\n```\n\n### options\n\n```\ninput        : input JSON filename - must be specified always\n--input      : input JSON filename (kept for compatibility)\n--compact    : compact rendering mode\n--vspace     : vertical space - default 80\n--hspace     : horizontal space - default 640\n--lanes      : rectangle lanes - default 2\n--bits       : overall bitwidth - default 32\n--fontfamily : - default sans-serif\n--fontweight : - default normal\n--fontsize   : - default 14\n--strokewidth: - default 1\n--hflip      : horizontal flip\n--vflip      : vertical flip\n--trim       : horizontal space available for a single character\n--uneven:    : uneven lanes\n\n--beautify   : use xml beautifier\n\n--json5      : force json5 input format (need json5 python module)\n--no-json5   : never use json5 input format\n```\n\n### alpha.json\n\n```json\n[\n    { \"name\": \"IPO\",   \"bits\": 8, \"attr\": \"RO\" },\n    {                  \"bits\": 7 },\n    { \"name\": \"BRK\",   \"bits\": 5, \"attr\": \"RW\", \"type\": 4 },\n    { \"name\": \"CPK\",   \"bits\": 1 },\n    { \"name\": \"Clear\", \"bits\": 3 },\n    { \"bits\": 8 }\n]\n```\n### alpha.svg\n\n![Heat Sink](https://raw.githubusercontent.com/Arth-ur/bitfield/master/bit_field/test/alpha.svg?sanitize=true)\n\n### Licensing\nThis work is based on original work by [Aliaksei Chapyzhenka](https://github.com/drom) under the MIT license (see LICENSE-ORIGINAL).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A bitfield diagram renderer",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/Arth-ur/bitfield"
    },
    "split_keywords": [
        "bitfield",
        "bytefield",
        "diagram",
        "renderer",
        "svg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e9912a9895e1d494fa7b4a5be891c5ba633514ef016b64598de77ce778f6ff5",
                "md5": "45cc59392982e92d46bad63db1589a34",
                "sha256": "6dd785c1665d390305288fa5069fdcbbfc4db6ec9e4a82b7376f40739d20cab7"
            },
            "downloads": -1,
            "filename": "bit_field-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "45cc59392982e92d46bad63db1589a34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9934,
            "upload_time": "2023-05-09T17:31:40",
            "upload_time_iso_8601": "2023-05-09T17:31:40.645540Z",
            "url": "https://files.pythonhosted.org/packages/0e/99/12a9895e1d494fa7b4a5be891c5ba633514ef016b64598de77ce778f6ff5/bit_field-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10577cd9318081a4e194e972a023aaa4b209c7e580a72341e6b1c4550d44f18f",
                "md5": "df2301edb7b49d7b094e6a43bba5a9b7",
                "sha256": "2dd114661dd6f393771b59478ea0d35f02e985066c1d14e6200c508e60daf900"
            },
            "downloads": -1,
            "filename": "bit_field-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "df2301edb7b49d7b094e6a43bba5a9b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8702,
            "upload_time": "2023-05-09T17:31:42",
            "upload_time_iso_8601": "2023-05-09T17:31:42.186343Z",
            "url": "https://files.pythonhosted.org/packages/10/57/7cd9318081a4e194e972a023aaa4b209c7e580a72341e6b1c4550d44f18f/bit_field-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-09 17:31:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Arth-ur",
    "github_project": "bitfield",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bit-field"
}
        
Elapsed time: 0.06235s