--- id: cantools version: "42.0.3" license: MIT license_treatment: permissive maintenance: active --- # cantools — CAN BUS tools. License: permissive · Maintenance: active · Downloads: 1.2M/mo ## What it is and what it does Cantools is a Python library for working with CAN (Controller Area Network) bus systems, primarily used in automotive applications. It reads and parses multiple database formats—DBC, KCD, SYM, ARXML 3 & 4, and CDD—that define the structure of CAN messages and signals. Once a database is loaded, the library provides high-level APIs to encode Python dictionaries into raw CAN frame bytes and decode incoming CAN frames back into human-readable signal values, handling both simple and multiplexed signals automatically. Beyond the core encode/decode functionality, cantools includes command-line tools for real-world CAN bus work: a decoder that parses candump output (the standard Linux CAN capture format), a monitor for live bus observation, a plotter that visualizes signal values over time using matplotlib, and a C code generator for embedded systems. The library depends on bitstruct for bit-level manipulation, python-can for bus communication, textparser for format parsing, argparse_addons for CLI extensions, and crccheck for diagnostic frame validation. Use it for: - Decode candump logs from vehicle testing or diagnostics without manual frame parsing. - Build Python scripts to send and receive CAN messages on a test bench or simulator. - Parse automotive ARXML or DBC files to extract message and signal definitions for documentation or code generation. - Implement diagnostic DID (Data IDentifier) encoding/decoding for vehicle communication protocols. - Monitor live CAN bus traffic and plot signal trends for debugging or validation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Cantools parses automotive CAN bus database files (DBC, KCD, SYM, ARXML, CDD) and provides encoding/decoding of CAN messages with support for multiplexing, diagnostics, and command-line tools for monitoring and visualization. Yes. Cantools is well-maintained, actively developed, carries no security vulnerabilities, and has low install friction. It is the standard choice for CAN bus work in Python and covers the full workflow from database parsing through encoding, decoding, and visualization. Install it if you work with automotive CAN systems, vehicle diagnostics, or need to process CAN bus captures. ## Install pip install cantools uv add cantools poetry add cantools ## Installing cantools Before you install: Low friction: pure Python wheel with five straightforward runtime dependencies. Actively maintained with a recent release; last commit 2026-08-14 and 2267 repository stars indicate steady development. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install cantools import cantools db = cantools.database.load_file('motohawk.dbc') message = db.get_message_by_name('ExampleMessage') data = message.encode({'Temperature': 250.1, 'Enable': 1}) decoded = db.decode_message(message.frame_id, data) Requires Python >= 3.10. Optional matplotlib dependency for plot subcommand must be installed separately with cantools[plot]. Verify before relying: - Whether the C source code generator is production-ready or primarily for reference. - Performance characteristics when handling large or complex ARXML files. - Extent of support for ARXML 3 vs. ARXML 4 features and known limitations. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags CAN bus message encoding decoding, DBC file parser, automotive CAN tools, CAN message multiplexing, candump decoder, CAN bus monitor, ARXML KCD parser, vehicle diagnostics DID, automotive, can-bus, diagnostics [View on SkillFed](https://skillfed.io/packages/cantools) · [View on PyPI](https://pypi.org/project/cantools/)