pyCANape


NamepyCANape JSON
Version 0.7.1 PyPI version JSON
download
home_page
SummaryPythonic wrapper around the VECTOR CANape API
upload_time2024-01-20 14:28:14
maintainer
docs_urlNone
author
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": "",
    "name": "pyCANape",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "CANape,Measurement,Calibration,automotive",
    "author": "",
    "author_email": "Artur Drogunow <artur.drogunow@zf.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/cd/0006038de2944bfea6b91391ea64160c108e77db9004ec052ae1ce7987a2/pyCANape-0.7.1.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.1",
    "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": "f3d2f6765e9158f45a7ced1898ce772b3634fb33f81156435a2608c5f4943376",
                "md5": "c88e446b55cb1903f06aa0581a32a8df",
                "sha256": "7b70358d5c64638772a80d2c7efb5d59ea60e477b8123162ae0c78cbe27bc354"
            },
            "downloads": -1,
            "filename": "pyCANape-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c88e446b55cb1903f06aa0581a32a8df",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 41435,
            "upload_time": "2024-01-20T14:28:12",
            "upload_time_iso_8601": "2024-01-20T14:28:12.745236Z",
            "url": "https://files.pythonhosted.org/packages/f3/d2/f6765e9158f45a7ced1898ce772b3634fb33f81156435a2608c5f4943376/pyCANape-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27cd0006038de2944bfea6b91391ea64160c108e77db9004ec052ae1ce7987a2",
                "md5": "8a232a5cbda9ac6c49ef8bd7bd9a4adb",
                "sha256": "ffdf506a3bfab46ab700d82825ca55de8ced34096f1138577a67ba9489d6b61e"
            },
            "downloads": -1,
            "filename": "pyCANape-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8a232a5cbda9ac6c49ef8bd7bd9a4adb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 39666,
            "upload_time": "2024-01-20T14:28:14",
            "upload_time_iso_8601": "2024-01-20T14:28:14.358317Z",
            "url": "https://files.pythonhosted.org/packages/27/cd/0006038de2944bfea6b91391ea64160c108e77db9004ec052ae1ce7987a2/pyCANape-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-20 14:28:14",
    "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: 0.18557s