objdictgen


Nameobjdictgen JSON
Version 3.5.2 PyPI version JSON
download
home_pagehttps://github.com/Laerdal/python-objdictgen
SummaryCanFestival Object Dictionary tool
upload_time2024-09-12 15:08:50
maintainerNone
docs_urlNone
authorSvein Seldal
requires_python<4,>=3.10
licenseNone
keywords build development canopen canfestival object dictionary od
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Objdictgen (`odg`)

This is python tools for working with Object Dictionary (OD) files for
the CanFestival communication library. CanFestival is an open source
implementation of the [CANopen](https://www.can-cia.org/canopen/)
communication protocol.

This repo is located:

> https://github.com/Laerdal/python-objdictgen

objdictgen includes tools to generate c code that works in tandem with a
canfestival library. This tool has been built to work together with the
Laerdal Medical fork for the canfestival library:

> https://github.com/Laerdal/canfestival-laerdal

objdictgen is a tool to parse, view and manipulate files containing object
dictionary (OD). An object dictionary is entries with data and configuration
in CANopen devices. The `odg` executable is installed. It supports
reading and writing OD files in `.json`/`.jsonc` format, in legacy XML `.od`
and `.eds` files. It can generate c code for use with the canfestival library.


## Install

To install into a virtual environment `venv`. Check out this repo and go to
the top in a command-prompt (here assuming Windows and git bash):

    $ py -3 -mvenv venv
    $ venv/Scripts/python -mpip install --upgrade pip setuptools   # Optional
    $ venv/Scripts/pip install objdictgen[ui]    # [ui] will install GUI tools

After this `venv/Scripts/odg.exe` (on Windows) will exist and can be called
from anywhere to run it.

The `[ui]` suffix to `pip install` will install the wx dependency needed
for the UI `odg edit`. If no UI is needed, this suffix can be omitted.

## `odg` command-line tool

`odg` is a command-line tool which is installed when the python package
`objdictgen` is installed.

Invocation:

    $ odg <options>
    $ python -mobjdictgen <options>   # <-- If odg is unavailable

`odg --help` and `odg <command> --help` exists and shows the command options.
The most useful commands are:

    $ odg list <od-files...>              # List contents of the OD
    $ odg convert <od-file1> <od-file2>   # Convert OD file
    $ odg convert <od-file> <c-file>      # Convert OD to c code
    $ odg diff <od-file1> <od-file2>      # Show differences between OD


### Legacy commands

The legacy commands `objdictgen` and `objdictedit` are no longer available. The
commands are available under `odg gen` and `odg edit` respectively.


## JSON schema

[src/objdictgen/schema/od.schema.json](src/objdictgen/schema/od.schema.json)
provides a JSON schema for the JSON OD format. This can be used for validation
in editors.

To use the schema in **VS Code**, the following configuration must be added to
your `settings.json`. After this is is installed, IntelliSense will show field
descriptions, help with values and validate the file.

```json
    "json.schemas": [
      {
        "fileMatch": [
          "**.jsonc"
        ],
        "url": "./src/objdictgen/schema/od.schema.json"
      }
    ],
```

## Conversion

The recommended way to convert existing/legacy `.od` files to the new JSON
format is:

    $ odg generate <file.od> <file.jsonc> --fix --drop-unused [--nosort]

The `--fix` option might be necessary if the OD-file contains internal
inconsistencies. It is safe to run this option as it will not delete any active
parameters. The `--drop-unused` will remove any unused *profile* and *DS-302*
parameter that might be used in the file.


## Motivation

The biggest improvement with the new tool over the original implementation is
the introduction of a new `.jsonc` based format to store the object dictionary.
The JSON format is well-known and easy to read. The tool use jsonc,
allowing comments in the json file. `odg` will process the file in a repeatable
manner, making it possible support diffing of the `.jsonc` file output. `odg`
remains 100% compatible with the legacy `.od` format on both input and output.

The original objdictedit and objdictgen tool were written in legacy python 2 and
and this is a port to python 3.

This tool is a fork from upstream canfestival-3-asc repo:

> https://github.com/Laerdal/canfestival-3-asc


## Making objdictedit excutable

To be able build an executable that can be run from anywhere:

    $ pip install pyinstaller
    $ pyinstaller packaging/objdictedit.spec

The file `dist/objdictedit.exe` can now be used anywhere. It does not need any
pre-installed software.


## License

Objdictgen has been based on the python tool included in CanFestival. This
original work from CanFestival is:

    Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD

The Python 3 port and tool improvements have been implemented under

    Copyright (C) 2022-2024 Svein Seldal, Laerdal Medical AS

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Laerdal/python-objdictgen",
    "name": "objdictgen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.10",
    "maintainer_email": null,
    "keywords": "build, development, canopen, canfestival, object dictionary, od",
    "author": "Svein Seldal",
    "author_email": "sveinse@seldal.com",
    "download_url": "https://files.pythonhosted.org/packages/5a/0b/93bbc6832b7a1e2d1ad8cebf2d0be3d548c43efc1cc8caedfc630b008a6f/objdictgen-3.5.2.tar.gz",
    "platform": null,
    "description": "# Objdictgen (`odg`)\n\nThis is python tools for working with Object Dictionary (OD) files for\nthe CanFestival communication library. CanFestival is an open source\nimplementation of the [CANopen](https://www.can-cia.org/canopen/)\ncommunication protocol.\n\nThis repo is located:\n\n> https://github.com/Laerdal/python-objdictgen\n\nobjdictgen includes tools to generate c code that works in tandem with a\ncanfestival library. This tool has been built to work together with the\nLaerdal Medical fork for the canfestival library:\n\n> https://github.com/Laerdal/canfestival-laerdal\n\nobjdictgen is a tool to parse, view and manipulate files containing object\ndictionary (OD). An object dictionary is entries with data and configuration\nin CANopen devices. The `odg` executable is installed. It supports\nreading and writing OD files in `.json`/`.jsonc` format, in legacy XML `.od`\nand `.eds` files. It can generate c code for use with the canfestival library.\n\n\n## Install\n\nTo install into a virtual environment `venv`. Check out this repo and go to\nthe top in a command-prompt (here assuming Windows and git bash):\n\n    $ py -3 -mvenv venv\n    $ venv/Scripts/python -mpip install --upgrade pip setuptools   # Optional\n    $ venv/Scripts/pip install objdictgen[ui]    # [ui] will install GUI tools\n\nAfter this `venv/Scripts/odg.exe` (on Windows) will exist and can be called\nfrom anywhere to run it.\n\nThe `[ui]` suffix to `pip install` will install the wx dependency needed\nfor the UI `odg edit`. If no UI is needed, this suffix can be omitted.\n\n## `odg` command-line tool\n\n`odg` is a command-line tool which is installed when the python package\n`objdictgen` is installed.\n\nInvocation:\n\n    $ odg <options>\n    $ python -mobjdictgen <options>   # <-- If odg is unavailable\n\n`odg --help` and `odg <command> --help` exists and shows the command options.\nThe most useful commands are:\n\n    $ odg list <od-files...>              # List contents of the OD\n    $ odg convert <od-file1> <od-file2>   # Convert OD file\n    $ odg convert <od-file> <c-file>      # Convert OD to c code\n    $ odg diff <od-file1> <od-file2>      # Show differences between OD\n\n\n### Legacy commands\n\nThe legacy commands `objdictgen` and `objdictedit` are no longer available. The\ncommands are available under `odg gen` and `odg edit` respectively.\n\n\n## JSON schema\n\n[src/objdictgen/schema/od.schema.json](src/objdictgen/schema/od.schema.json)\nprovides a JSON schema for the JSON OD format. This can be used for validation\nin editors.\n\nTo use the schema in **VS Code**, the following configuration must be added to\nyour `settings.json`. After this is is installed, IntelliSense will show field\ndescriptions, help with values and validate the file.\n\n```json\n    \"json.schemas\": [\n      {\n        \"fileMatch\": [\n          \"**.jsonc\"\n        ],\n        \"url\": \"./src/objdictgen/schema/od.schema.json\"\n      }\n    ],\n```\n\n## Conversion\n\nThe recommended way to convert existing/legacy `.od` files to the new JSON\nformat is:\n\n    $ odg generate <file.od> <file.jsonc> --fix --drop-unused [--nosort]\n\nThe `--fix` option might be necessary if the OD-file contains internal\ninconsistencies. It is safe to run this option as it will not delete any active\nparameters. The `--drop-unused` will remove any unused *profile* and *DS-302*\nparameter that might be used in the file.\n\n\n## Motivation\n\nThe biggest improvement with the new tool over the original implementation is\nthe introduction of a new `.jsonc` based format to store the object dictionary.\nThe JSON format is well-known and easy to read. The tool use jsonc,\nallowing comments in the json file. `odg` will process the file in a repeatable\nmanner, making it possible support diffing of the `.jsonc` file output. `odg`\nremains 100% compatible with the legacy `.od` format on both input and output.\n\nThe original objdictedit and objdictgen tool were written in legacy python 2 and\nand this is a port to python 3.\n\nThis tool is a fork from upstream canfestival-3-asc repo:\n\n> https://github.com/Laerdal/canfestival-3-asc\n\n\n## Making objdictedit excutable\n\nTo be able build an executable that can be run from anywhere:\n\n    $ pip install pyinstaller\n    $ pyinstaller packaging/objdictedit.spec\n\nThe file `dist/objdictedit.exe` can now be used anywhere. It does not need any\npre-installed software.\n\n\n## License\n\nObjdictgen has been based on the python tool included in CanFestival. This\noriginal work from CanFestival is:\n\n    Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD\n\nThe Python 3 port and tool improvements have been implemented under\n\n    Copyright (C) 2022-2024 Svein Seldal, Laerdal Medical AS\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "CanFestival Object Dictionary tool",
    "version": "3.5.2",
    "project_urls": {
        "Homepage": "https://github.com/Laerdal/python-objdictgen"
    },
    "split_keywords": [
        "build",
        " development",
        " canopen",
        " canfestival",
        " object dictionary",
        " od"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e2bf9f314947545fa41e979573f1a53944a3eb050f1c7bc4c3f6ffce1a546f4",
                "md5": "a114bf0f8623c933bb22fdca72587608",
                "sha256": "9c007a640b4a7e15e25ce90cfc55144601a9e593e654839018878c914cfc0b08"
            },
            "downloads": -1,
            "filename": "objdictgen-3.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a114bf0f8623c933bb22fdca72587608",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.10",
            "size": 155078,
            "upload_time": "2024-09-12T15:08:48",
            "upload_time_iso_8601": "2024-09-12T15:08:48.698366Z",
            "url": "https://files.pythonhosted.org/packages/8e/2b/f9f314947545fa41e979573f1a53944a3eb050f1c7bc4c3f6ffce1a546f4/objdictgen-3.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a0b93bbc6832b7a1e2d1ad8cebf2d0be3d548c43efc1cc8caedfc630b008a6f",
                "md5": "eedab42bab8e25eb0aa8d7afb3972e27",
                "sha256": "c7072d8934a7e63887c33cad5ecd19710cde2c28968db93637f592fe8a848aef"
            },
            "downloads": -1,
            "filename": "objdictgen-3.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "eedab42bab8e25eb0aa8d7afb3972e27",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.10",
            "size": 160858,
            "upload_time": "2024-09-12T15:08:50",
            "upload_time_iso_8601": "2024-09-12T15:08:50.561659Z",
            "url": "https://files.pythonhosted.org/packages/5a/0b/93bbc6832b7a1e2d1ad8cebf2d0be3d548c43efc1cc8caedfc630b008a6f/objdictgen-3.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-12 15:08:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Laerdal",
    "github_project": "python-objdictgen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "objdictgen"
}
        
Elapsed time: 0.77249s