How chaitu-ycr/py_canoe works
Project Type and Purpose
• This is an open-source Python library (py_canoe) that provides a high-level API for controlling the Vector CANoe tool via its COM/automation interface. Users write Python scripts that import py_canoe to drive CANoe configurations, start/stop measurements, manipulate signals/logging, compile CAPL nodes, and more.
High-Level File Structure (ignoring .github and tests)
• mkdocs.yml
• docs/… ← Documentation source (MkDocs)
• pyproject.toml ← Packaging metadata for PyPI
• scripts/*.bat ← Windows batch scripts (build wheel, deploy docs, run tests)
• py_canoe/ ← Core library
• __init__.py
• py_canoe.py ← Facade/API layer exposing CANoe class and wait()
• py_canoe_utils/ ← Utility modules
– logging_collection.py
– py_canoe_logger.py
• README.md, LICENSE, SECURITY.md, CODE_OF_CONDUCT.md
Key Components
a. Python Client Code
– Your own test scripts or application that import py_canoe and invokes methods (e.g., open(), start_measurement()).
b. py_canoe Library
– API Layer (py_canoe.py): exposes CANoe class, wraps COM calls.
– Utils (py_canoe_utils): logging collection, internal logger.
c. Vector CANoe Application
– Runs as an external process; exposes COM automation interface.
d. CAN Hardware / Offline Data
– Physical CAN bus or offline log files (.blf).
e. File System
– Configuration files (.cfg, .cdd, .dbc, .arxml, .ldf), log files, CAPL source, database files.
f. CI/CD & Packaging
– GitHub Actions workflows (lint, publish to PyPI), MkDocs site deployment, batch scripts for manual automation.
Interactions & Data Flows
1. Python Client → py_canoe API
• Calls CANoe.open(), start_measurement(), etc.
2. py_canoe API → COM Automation
• Internally uses win32com.client (or equivalent) to drive CANoe.
3. COM Automation ↔ Vector CANoe App
• Opens config, controls measurement, retrieves data.
4. Vector CANoe ↔ CAN Bus / Offline Logs
• Sends/receives frames to/from hardware or reads/writes .blf files.
5. py_canoe_utils → Logging Collection
• Manages logging blocks, collects statistics.
6. File System ↔ CANoe / py_canoe
• Reads config, writes logs, saves configurations.
7. CI/CD Pipelines → Repository
• On push: Lint, build & publish package, deploy docs.
Architectural Patterns & Design Principles
• Facade Pattern: py_canoe.py hides low-level COM complexity behind simple method calls.
• Separation of Concerns: clear split between API surface (py_canoe.py), utilities (logging, internal logger), docs, packaging, and CI/CD scripts.
• Extensibility: additional utility modules can be plugged under py_canoe_utils.
Technologies & Frameworks
• Python ≥3.9
• Windows COM Automation (win32com)
• MkDocs for documentation
• GitHub Actions for CI/CD
• PyPI for distribution
• Batch scripts for local automation