Pythonic wrapper around the VECTOR CANape API
Project description
pyCANape
This is a pythonic wrapper around the VECTOR CANape API. The documentation is available here.
Example usage
Open and close CANape
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
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
# 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:
# 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:
# format the code with black
black .
# run the linter
ruff check --fix src
# run the type checker
mypy .
# build the documentation
python -m sphinx -Wan --keep-going docs build
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyCANape-0.6.0.tar.gz
(27.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyCANape-0.6.0-py3-none-any.whl
(33.6 kB
view details)
File details
Details for the file pyCANape-0.6.0.tar.gz.
File metadata
- Download URL: pyCANape-0.6.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cefc8ff23326e48c987b439b37da3093805bf07560f513ed2d00a39af647b31
|
|
| MD5 |
7ee94a1620c0faa255e98eb16a2b6ce5
|
|
| BLAKE2b-256 |
137ecbb9c6c3ae91e295dfe4378122dee4ed79b7a2436fbc28d026faf84fbe1d
|
File details
Details for the file pyCANape-0.6.0-py3-none-any.whl.
File metadata
- Download URL: pyCANape-0.6.0-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
036318643d6cf061a1a076d0471dd8de708e15f3dd66c8f0e52a35e8c5a77321
|
|
| MD5 |
4796974c1db05481c0c916faa3230c82
|
|
| BLAKE2b-256 |
e19dd32b141e5ca54c0c746b734bcdd2f3b3cf0a4b176376cb5943f99b989b19
|