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:
# 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
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
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
File details
Details for the file pycanape-0.8.1.tar.gz.
File metadata
- Download URL: pycanape-0.8.1.tar.gz
- Upload date:
- Size: 49.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f9fb19d8e0ed8d39073b6f87ae9e88e55490ed32e0d1698f02543325398d003
|
|
| MD5 |
6002aa6df2804e1cd25cbe22a66c9e95
|
|
| BLAKE2b-256 |
4a24ab6d26c9718384325c62a36660e87c528f867de201c2e964b9113639a66f
|
Provenance
The following attestation bundles were made for pycanape-0.8.1.tar.gz:
Publisher:
ci.yml on zariiii9003/pycanape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycanape-0.8.1.tar.gz -
Subject digest:
1f9fb19d8e0ed8d39073b6f87ae9e88e55490ed32e0d1698f02543325398d003 - Sigstore transparency entry: 314682295
- Sigstore integration time:
-
Permalink:
zariiii9003/pycanape@635a28901a9bc56b65e97d0820e855656d6ce6cb -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/zariiii9003
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@635a28901a9bc56b65e97d0820e855656d6ce6cb -
Trigger Event:
push
-
Statement type:
File details
Details for the file pycanape-0.8.1-py3-none-any.whl.
File metadata
- Download URL: pycanape-0.8.1-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e23536cfb36deb1ccd64bf6aaf1e601f52a50f61b8dede0bc311188a8235ba2
|
|
| MD5 |
b2467460008b3fcf43ff69ebca61cc39
|
|
| BLAKE2b-256 |
62b6f12a93ef0851a4dd434127f96866c0f3478838b2d689369e6b12316ae7d0
|
Provenance
The following attestation bundles were made for pycanape-0.8.1-py3-none-any.whl:
Publisher:
ci.yml on zariiii9003/pycanape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycanape-0.8.1-py3-none-any.whl -
Subject digest:
5e23536cfb36deb1ccd64bf6aaf1e601f52a50f61b8dede0bc311188a8235ba2 - Sigstore transparency entry: 314682304
- Sigstore integration time:
-
Permalink:
zariiii9003/pycanape@635a28901a9bc56b65e97d0820e855656d6ce6cb -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/zariiii9003
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@635a28901a9bc56b65e97d0820e855656d6ce6cb -
Trigger Event:
push
-
Statement type: