pyCANape


NamepyCANape JSON
Version 0.7.2 PyPI version JSON
download
home_pageNone
SummaryPythonic wrapper around the VECTOR CANape API
upload_time2024-06-24 21:19:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords canape measurement calibration automotive
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyCANape

[![PyPI - Version](https://img.shields.io/pypi/v/pycanape.svg)](https://pypi.org/project/pycanape)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pycanape.svg)](https://pypi.org/project/pycanape)
[![Documentation Status](https://readthedocs.org/projects/pycanape/badge/?version=latest)](https://pycanape.readthedocs.io/en/latest/?badge=latest)

This is a pythonic wrapper around the VECTOR CANape API.
The documentation is available [here](https://pycanape.readthedocs.io/en/latest).

## Example usage

### Open and close CANape
````python
import pycanape

canape = pycanape.CANape(
    project_path="C:\\Users\\Public\\Documents\\Vector CANape 17\\Examples\\XCPDemo",
    modal_mode=True,
)
canape.exit(close_canape=True)
````

### Create Module
````python
from pycanape import DriverType, Channels

# Create XCPsim module
xcpsim = canape.create_module(
    module_name="XCPSim",
    database_filename=r"C:\Users\Public\Documents\Vector CANape 17\Examples\XCPDemo\XCPsim.a2l",
    driver=DriverType.ASAP3_DRIVER_XCP,
    channel=Channels.DEV_CAN1,
    go_online=True,
)
````

### Calibration
````python
# get scalar (0D) calibration object
scalar_obj = xcpsim.get_calibration_object("map1Counter")

# read scalar value
print(scalar_obj.value)

# set scalar value
scalar_obj.value = 2.0

# get axis (1D) calibration object
axis_obj = xcpsim.get_calibration_object("Curve1")

# read axis length
axis_dim = axis_obj.dimension

# read axis values
print(axis_obj.axis)

# set axis values
axis_obj.axis = [0] * axis_dim
````

## How to contribute

Setup your development environment:
```shell script
# clone the repository
git clone https://github.com/zariiii9003/pycanape.git

# install pyCANape in editable mode with all development dependencies
pip install -e .[dev,doc]

# install the pre-commit hook
pre-commit install
```

After you implement your changes you should run the static code analysis and check the documentation:
```shell script
# install pycanape in editable mode
python -m pip install -e .[dev,doc]

# format the code with black
black .

# run the linter
ruff check --fix src

# run the type checker
mypy .

# run the tests
python -m pytest --cov-config=./pyproject.toml --cov=pycanape  --cov-report=term --cov-report=html

# build the documentation
python -m sphinx -Wan --keep-going docs build
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyCANape",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "CANape, Measurement, Calibration, automotive",
    "author": null,
    "author_email": "Artur Drogunow <artur.drogunow@zf.com>",
    "download_url": "https://files.pythonhosted.org/packages/e1/df/205a0bbe8f960595888f2f12e165cfbae90703546dab601fd1061e885d05/pycanape-0.7.2.tar.gz",
    "platform": null,
    "description": "# pyCANape\r\n\r\n[![PyPI - Version](https://img.shields.io/pypi/v/pycanape.svg)](https://pypi.org/project/pycanape)\r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pycanape.svg)](https://pypi.org/project/pycanape)\r\n[![Documentation Status](https://readthedocs.org/projects/pycanape/badge/?version=latest)](https://pycanape.readthedocs.io/en/latest/?badge=latest)\r\n\r\nThis is a pythonic wrapper around the VECTOR CANape API.\r\nThe documentation is available [here](https://pycanape.readthedocs.io/en/latest).\r\n\r\n## Example usage\r\n\r\n### Open and close CANape\r\n````python\r\nimport pycanape\r\n\r\ncanape = pycanape.CANape(\r\n    project_path=\"C:\\\\Users\\\\Public\\\\Documents\\\\Vector CANape 17\\\\Examples\\\\XCPDemo\",\r\n    modal_mode=True,\r\n)\r\ncanape.exit(close_canape=True)\r\n````\r\n\r\n### Create Module\r\n````python\r\nfrom pycanape import DriverType, Channels\r\n\r\n# Create XCPsim module\r\nxcpsim = canape.create_module(\r\n    module_name=\"XCPSim\",\r\n    database_filename=r\"C:\\Users\\Public\\Documents\\Vector CANape 17\\Examples\\XCPDemo\\XCPsim.a2l\",\r\n    driver=DriverType.ASAP3_DRIVER_XCP,\r\n    channel=Channels.DEV_CAN1,\r\n    go_online=True,\r\n)\r\n````\r\n\r\n### Calibration\r\n````python\r\n# get scalar (0D) calibration object\r\nscalar_obj = xcpsim.get_calibration_object(\"map1Counter\")\r\n\r\n# read scalar value\r\nprint(scalar_obj.value)\r\n\r\n# set scalar value\r\nscalar_obj.value = 2.0\r\n\r\n# get axis (1D) calibration object\r\naxis_obj = xcpsim.get_calibration_object(\"Curve1\")\r\n\r\n# read axis length\r\naxis_dim = axis_obj.dimension\r\n\r\n# read axis values\r\nprint(axis_obj.axis)\r\n\r\n# set axis values\r\naxis_obj.axis = [0] * axis_dim\r\n````\r\n\r\n## How to contribute\r\n\r\nSetup your development environment:\r\n```shell script\r\n# clone the repository\r\ngit clone https://github.com/zariiii9003/pycanape.git\r\n\r\n# install pyCANape in editable mode with all development dependencies\r\npip install -e .[dev,doc]\r\n\r\n# install the pre-commit hook\r\npre-commit install\r\n```\r\n\r\nAfter you implement your changes you should run the static code analysis and check the documentation:\r\n```shell script\r\n# install pycanape in editable mode\r\npython -m pip install -e .[dev,doc]\r\n\r\n# format the code with black\r\nblack .\r\n\r\n# run the linter\r\nruff check --fix src\r\n\r\n# run the type checker\r\nmypy .\r\n\r\n# run the tests\r\npython -m pytest --cov-config=./pyproject.toml --cov=pycanape  --cov-report=term --cov-report=html\r\n\r\n# build the documentation\r\npython -m sphinx -Wan --keep-going docs build\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pythonic wrapper around the VECTOR CANape API",
    "version": "0.7.2",
    "project_urls": {
        "Documentation": "https://pycanape.readthedocs.io",
        "Homepage": "https://github.com/zariiii9003/pycanape",
        "Issues": "https://github.com/zariiii9003/pycanape/issues",
        "Source": "https://github.com/zariiii9003/pycanape"
    },
    "split_keywords": [
        "canape",
        " measurement",
        " calibration",
        " automotive"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b165195e4e2e9b725b716faf5148e7ca9a75af8d71868680d0d1c9527069eb4f",
                "md5": "6c21d894abfa5fc1457ea71ad20c5686",
                "sha256": "257b8e1d669b9c018e97f88c5cd7bd6895086f54ab988e8a4151f3d6f4a643cf"
            },
            "downloads": -1,
            "filename": "pyCANape-0.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c21d894abfa5fc1457ea71ad20c5686",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 41621,
            "upload_time": "2024-06-24T21:19:14",
            "upload_time_iso_8601": "2024-06-24T21:19:14.266333Z",
            "url": "https://files.pythonhosted.org/packages/b1/65/195e4e2e9b725b716faf5148e7ca9a75af8d71868680d0d1c9527069eb4f/pyCANape-0.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1df205a0bbe8f960595888f2f12e165cfbae90703546dab601fd1061e885d05",
                "md5": "946b26e5525c4b2453b144f97479a557",
                "sha256": "35eb99076b57b018556ce834a782ab2e2662fbca65e5b662e7a8f5874f1ac29e"
            },
            "downloads": -1,
            "filename": "pycanape-0.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "946b26e5525c4b2453b144f97479a557",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 39840,
            "upload_time": "2024-06-24T21:19:15",
            "upload_time_iso_8601": "2024-06-24T21:19:15.923669Z",
            "url": "https://files.pythonhosted.org/packages/e1/df/205a0bbe8f960595888f2f12e165cfbae90703546dab601fd1061e885d05/pycanape-0.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-24 21:19:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zariiii9003",
    "github_project": "pycanape",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pycanape"
}
        
Elapsed time: 3.78746s