# Help/examples of using pycyphal2 with dsdl types

**URL:** <https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874>\
**Category:** PyCyphal\
**Created:** [July 20, 2026, 3:13pm UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874 "2026-07-20T15:13:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![legokol](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/legokol/32/1766_2.png) [@legokol](https://forum.opencyphal.org/u/legokol)\
**Post date:** [July 20, 2026, 3:13pm UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874/1 "2026-07-20T15:13:36Z")

</div>

I’m just getting into cyphal, which I want to use with can bus to work with some devices. So, there’s pycyphal and pycyphal2, with the latter being simpler. To get more familiar with it I tried to reimplement thermostat demo from pycyphal1, but failed on multiple occasions. So there are a few questions:

1. Should I really choose pycyphal2 right now for writing new software, or v1 might be preferable
2. If I should, there’s a couple of things:  
2.1. I might serialize\deserialize dsdl types using nunavut support, but serialization returns list of memoryviews - how would I publish it?  
2.2 What about heartbeat?  
2.3. I understand, that cynic is preferable and not yakut, but may I still use it to be sure about backward compatibility? So far I wasn’t able to either subscribe or publish from/to running pycyphal2 demo using yakut.  
Help will be very appreciated 🙂

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [July 20, 2026, 5:07pm UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874/2 "2026-07-20T17:07:27Z")

</div>

I would go with Cyphal v1.1. It is not yet stable, but I think that the radical usability improvements realized in the new version should offset the risk of instability for many real projects. This means that yes, you should choose pycyphal2.

> [@legokol](#):
>
> I might serialize\deserialize dsdl types using nunavut support, but serialization returns list of memoryviews - how would I publish it?

Concatenate them: `publish_this = b''.join(X.serialize())`.

> [@legokol](#):
>
> What about heartbeat?

Cyphal v1.1 no longer requires the heartbeat or any other application-layer behaviors. Obviously it doesn’t mean that you can’t use it – do it if you need it. Or don’t use DSDL at all and choose MsgPack ~~or JSON~~. Cyphal v1.1 does not attempt to anticipate the requirements of the application. That said, in my honest biased opinion, DSDL is a very good format and in embedded applications it doesn’t have many strong competitors.

You might already know that DSDL will not be part of the future Cyphal specifications; they will evolve as separate projects from now on.

> [@legokol](#):
>
> I understand, that cynic is preferable and not yakut, but may I still use it to be sure about backward compatibility? So far I wasn’t able to either subscribe or publish from/to running pycyphal2 demo using yakut.

Sure. To enable backward compatibility you should name your topics like `1234#1234`, where 1234 is the subject-ID. Yakut should see them on Cyphal/CAN.

You might have noticed that PyCyphal2 ships some usage examples, those might be a better starting point than trying to port the old PyCyphal demo.

---

<div class="post-metadata">

**Author:** ![legokol](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/legokol/32/1766_2.png) [@legokol](https://forum.opencyphal.org/u/legokol)\
**Post date:** [July 21, 2026, 6:53am UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874/3 "2026-07-21T06:53:59Z")

</div>

Thanks for the detailed response!

I have seen the examples provided with pycyphal 2 and they’re great, I just wish there was an example with dsdl, because I think it will be a common use case.

One more question: you pointed out that yakut would see devices on pycyphal/CAN, is UDP not an option for debugging, or should it work as well?

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [July 21, 2026, 10:22am UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874/4 "2026-07-21T10:22:54Z")

</div>

> [@legokol](#):
>
> I just wish there was an example with dsdl, because I think it will be a common use case.

DSDL is just a serialization format so the only change would be that you add a serialize/deserialize call, that’s it. If you have a specific question about DSDL integration, share it here. I think it should be straightforward, you just need to invoke Nunavut manually to generate Python serialization code. Or if you don’t want to generate any code, you can just use PyDSDL directly, it can serialize/deserialize dynamically, see [PyDSDL usage — PyDSDL 1.25.0.rc1 documentation](https://pydsdl.readthedocs.io/en/latest/pages/pydsdl.html#pydsdl.serialize)

You may also want to look at [GitHub - OpenCyphal-Garage/cynic: Cyphal Network Investigation Console · GitHub](https://github.com/OpenCyphal-Garage/cynic)

> [@legokol](#):
>
> you pointed out that yakut would see devices on pycyphal/CAN, is UDP not an option for debugging, or should it work as well?

UDP works perfectly but is not compatible with Cyphal/UDP v1.0 because it hasn’t been stabilized yet. Cyphal/CAN v1.0 is the only stable transport hence it is the only one that we maintain backward compatibility with.

---

<div class="post-metadata">

**Author:** ![legokol](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/legokol/32/1766_2.png) [@legokol](https://forum.opencyphal.org/u/legokol)\
**Post date:** [July 24, 2026, 1:35pm UTC](https://forum.opencyphal.org/t/help-examples-of-using-pycyphal2-with-dsdl-types/2874/6 "2026-07-24T13:35:50Z")

</div>

Huge thanks, I was able to somewhat replicate thermostat part of pycyphal v1 demo with pycyphal2 (skipping least squares part ang gain part). I thought I would leave some remarks on conversion and dsdl stuff here, so it can help someone else.

1. I compiled dsdl to python with nnvg and included it directly
2. Publishing cyphal type with serialization looks like this:

```py
message = b"".join(
    nunavut_support.serialize(
        uavcan.si.unit.voltage.Scalar_1(
            voltage_value
        )
    )
)
await pub_v_cmd(Instant.now() + 1.0, message)

```

1. Reading looks like this ( **message**  **needs to be converted to list**!):

```py
async for m in sub_t_pv:
    temperature = nunavut_support.deserialize(
            uavcan.si.sample.temperature.Scalar_1, [m.message]
    )

```
