skillfed

cantools

CAN BUS tools.

cantools v42.0.3 1.2M downloads/30d#4,235 on PyPI2,267
Permissive license MIT Active released

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 on this page — 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

cantools on PyPI

pip

pip install cantools

uv

uv add cantools

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 5 — bitstruct, python-can, textparser, argparse_addons, crccheck
Maintenance actively maintained — 40 days since the last release
Last repo commit
First released
Downloads 1,193,654/month — #4,235 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cantools-42.0.3-py3-none-any.whl

Keywords: can, can bus, arxml, dbc, kcd, automotive

License :: OSI Approved :: MIT License

Tags

CAN bus message encoding decodingDBC file parserautomotive CAN toolsCAN message multiplexingcandump decoderCAN bus monitorARXML KCD parservehicle diagnostics DID
automotivecan-busdiagnostics

More Software Development packages