CoCoSim icon indicating copy to clipboard operation
CoCoSim copied to clipboard

Python3 ?

Open omrischwarz opened this issue 2 years ago • 5 comments

The install_cocosim script requires a Python 2 installation, which is getting more difficult to keep up. Is there a path to upgrading?

omrischwarz avatar Mar 13 '24 21:03 omrischwarz

Hi @omrischwarz,

Thanks for bringing this up and for your interest in CoCoSIm. I have yet to fully assess compatibility with Python 3, but my expectation is that it shouldn't be too much of a problem to switch to it.

For the time being, you can use the installation script by first modifying the line in the following link

https://github.com/NASA-SW-VnV/CoCoSim/blob/5c1597ab725d9bf8a790e4194d5d54460a6584c9/scripts/bash_utils#L381

to

[[ ${version:0:1} = 3 ]] && version_ge "$version" "$python_required_version"

I will leave this issue open until I have fully tested Python 3. Let me know if you encounter any further issues.

Best Regards,

Andreas

andreaskatis avatar Mar 14 '24 02:03 andreaskatis

I can confirm that the spacer pip module is available in python3 now, so you have nothing anchoring cocosim to Python 2 any more.

My next challenge is to fill the gaps so I can generate Rust code with CocoSim. lustrec won't compile because I'm on a Mac with homebrew and OPAM won't find the zstd library as configured. But I'm working on it. Is lustrec the component that is used for generating rust code?

omrischwarz avatar Mar 18 '24 15:03 omrischwarz

Hi @omrischwarz ,

Thank you for the information about python. As far as Rust code generation is concerned, Kind 2 is used and not LustreC. You can read more details about it here:

https://kind.cs.uiowa.edu/kind2_user_docs/v2.1.1/9_other/4_rust_compilation.html

It's also highly experimental, so any feedback on this part would be greatly appreciated.

andreaskatis avatar Mar 18 '24 21:03 andreaskatis

My use case is pretty simple: I am contending with a Simulink model that is wrapped by some C code to handle a SCADA protocol. Right now there's a race condition in the communications side. If instead of generating C code I can transpire it into Rust, and that code is light on the unsafe sections, then isolating the race conditions should become a lot easier. It's speculative work, so I'm proceeding slowly.

omrischwarz avatar Mar 19 '24 13:03 omrischwarz

I'm back to toying with this functionality, and can report that Kind2 2.3.0 declines to compile CoCoSim's Sudoku example because it has assertions rather than contracts.

omrischwarz avatar Jun 23 '25 23:06 omrischwarz

Hi @omrischwarz ,

I am closing this issue as I updated the installation script so that it doesn't force the installation of Python 2 in ebb91b7dfbc52bfe5074766281fd3fb8446976c9 .

If you have further updates on your Rust use case please don't hesitate to open up a discussion thread here.

andreaskatis avatar Feb 16 '26 16:02 andreaskatis