opticka icon indicating copy to clipboard operation
opticka copied to clipboard

Dependency handling

Open Ccccraz opened this issue 8 months ago • 3 comments

Hi, as the number of dependencies involved increases, if managing them is a problem now, for example:

matmoteGO will provide the ability to communicate with cogmoteGO. And I think it should only provide the most basic communication capabilities. More complex functions should be implemented at other levels. matmoteGO depends on: iandol/matlab-zmq. If the project structure is managed using git submodule, it will be:

+matmoteGO
└── matlab-zmq/ (submodule)

If later, opticka uses matmoteGO to develop more complex controls, then opticka's dependencies will be:

+opticka
└── +matmoteGO/ (submodule)
    └── matlab-zmq/ (submodule)

And I believe it is important for opticka to maintain the ability to directly use ZMQ, so it needs to directly depend on matlab-zmq. Therefore, the dependencies of optika will be:

+opticka
├── matlab-zmq/ (submodule)
└── +matmoteGO/ (submodule)
    └── matlab-zmq/ (submodule)

This will cause matlab-zmq to be imported repeatedly. This is clearly not an ideal state.

Ccccraz avatar May 05 '25 06:05 Ccccraz

So what other options do we have?

I currently prefer to package the library-like repositories into Matlab toolboxes. For example, matmoteGO and matlab-zmq

Ccccraz avatar May 05 '25 06:05 Ccccraz

I at least never used to be a fan of traditional user-made MATLAB toolboxes, they have limitations. To be honest I haven't previously considered packaging for MATLAB and recently we now have MATLAB package manager:

https://www.mathworks.com/help/matlab/matlab-package-manager.html https://www.mathworks.com/help/matlab/matlab_prog/use-the-matlab-package-manager-to-organize-and-distribute-code.html https://www.mathworks.com/products/mpm.html

My brute force approach is just copy dependent files and manually update them when needed. This keeps opticka self contained and limited external updates. So three options:

  1. Brute force
  2. Git submodules
  3. MATLAB package

?

iandol avatar May 05 '25 06:05 iandol

I've found the following two solutions:

  1. Using the mpm provided by the official Matlab, although it's confusing that cloud repository is not supported, it should be feasible through the following structure:

repository structure:

opticka
├── repository
│   ├── matlab-zmq (submodule)
│   └── matmoteGO (submodule)
└── addOptickaToPath.m
% addOptickaToPath.m
mpmAddRepository("repository","path\to\repository",Position="begin");
mpminstall("matlab-zmq",Verbosity="detailed");
mpminstall("matmoteGO ",Verbosity="detailed");
  1. Use https://github.com/mobeets/mpm, but I'm not sure about its reliability and its ability to handle complex dependency relationships. It still needs to be tested.

Anyway, this matter is not urgent. We can wait until the main functions are completed and then continue.

Ccccraz avatar May 05 '25 07:05 Ccccraz