Skip to content

Python implementation of NCodec.#22

Open
timrulebosch wants to merge 6 commits intoboschglobal:mainfrom
jsmidtbosch:fmpy
Open

Python implementation of NCodec.#22
timrulebosch wants to merge 6 commits intoboschglobal:mainfrom
jsmidtbosch:fmpy

Conversation

@timrulebosch
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AutomotiveBus should be installed as a dependency directly from the whl file (rather than duplicated code).
https://github.com/boschglobal/automotive-bus-schema/releases/download/v1.0.16/automotive_bus_schema-1.0.16-py3-none-any.whl

@timrulebosch timrulebosch requested a review from Copilot November 10, 2025 08:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a Python implementation of the NCodec library for automotive bus communication, providing encoding/decoding functionality for PDU (Protocol Data Unit) and CAN (Controller Area Network) messages using FlatBuffers serialization.

Key changes:

  • Complete Python package structure with codec implementations for PDU and CAN protocols
  • Comprehensive test suite covering codec construction, interface polymorphism, and message serialization/deserialization
  • FMPy integration example demonstrating FMU (Functional Mock-up Unit) simulation with NCodec

Reviewed Changes

Copilot reviewed 76 out of 87 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
extra/python/src/ncodec/*.py Core codec implementation including PDU/CAN codecs, interface abstractions, and MIME type handling
extra/python/src/AutomotiveBus/**/*.py Auto-generated FlatBuffers Python bindings for stream/frame/signal/register protocols
extra/python/tests/*.py Unit tests for PDU codec, CAN codec, and codec factory interface
extra/python/pyproject.toml Package configuration defining dependencies and build metadata
dse/ncodec/examples/fmpy/* FMPy integration example with C wrapper and simulation script

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

SomeIpMetadata.AddReturnCode(self.builder, adapter.return_code)
return SomeIpMetadata.End(self.builder)

def emitIpMessageMetdata(self, msg: PduMessage) -> any:
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Metdata' to 'Metadata' in method name.

Suggested change
def emitIpMessageMetdata(self, msg: PduMessage) -> any:
def emitIpMessageMetadata(self, msg: PduMessage) -> any:

Copilot uses AI. Check for mistakes.
elif codec_type == "can":
return CodecFactory.create_can_codec(MimeMap, Stream, ModelName, SimulationTime)
else:
raise ValueError(f"Unsupported codec type: {codec_type}")
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message uses 'Unsupported codec type' but test expects 'unsupported type' (lowercase, no 'codec' word). This inconsistency will cause test failure.

Suggested change
raise ValueError(f"Unsupported codec type: {codec_type}")
raise ValueError(f"unsupported type: {codec_type}")

Copilot uses AI. Check for mistakes.
version = "0.0.1"
description = "Python implementation of the dse.ncodec project."
authors = [
{ name = "Your Name", email = "your.email@example.com" }
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder author information should be replaced with actual project contact details.

Suggested change
{ name = "Your Name", email = "your.email@example.com" }
{ name = "Jane Doe", email = "jane.doe@projectdomain.com" }

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants