Dependency management & package manager like pip in ML

88 visualizzazioni (ultimi 30 giorni)
Jan Kappen
Jan Kappen il 6 Feb 2023
Commentato: Ashley Trowell il 4 Apr 2024 alle 17:28
Hi all,
Matlab is officially still lacking a proper package manager like npm or pip. I do not understand how people structure projects with dependencies. I understand, there are
  • ML projects
  • ML toolboxes
  • several mpm versions
Toolboxes have a version number attached, projects have not. Both can be shared as a package. Projects can reference other projects, but that 1. requires the same folder structure on every developer PC and 2. requires that the correct version is checked out from the VCS (which is GIT in our case). There's no way to define "project abc@v1.2.0" as a dependency. Just folders/prj files.
How do you do complex app developments? Like a frontent GUI app that needs several self-created toolboxes and projects? The only way is to use GIT (submodules in worst case) to do dependency managment, and that's definitely a red flag.
Then, there's Matlab's mpm matlab-dockerfile/MPM.md at main · mathworks-ref-arch/matlab-dockerfile (github.com) but that's meant to be used to install different product versions and addons, and there's a third party mpm mobeets/mpm: Simple Matlab package management inspired by pip (github.com) which seems to be interesting, but there's no direct support from Mathworks.
Then, it seems like there's another mpm built-in in ML 2022b that mentions a Matlab -packages flag which is very interesting:
mpm
Error using mpm
This command is not supported when the packages feature is not enabled. Start MATLAB with the -packages command line switch.
There's no information about that. Starting ML with -packages reveals more:
Which seems to support different versions. But there's no documentation anywhere, and it's a built-in function © 2022.
What does that mean? Will there be a Mathworks' supported package manager? What exactly is a package by the way in ML? So far, packages were a synonym to namespaces, using the +package folders. How does that work together with ML projects?
I'm in the process of re-structuring code due to a migration from Bitbucket to Gitlab and I'm at a point where a proper dependency management must take place, and that must work in CI/CD, too.
Would be very happy to hear your thoughts.
Thanks,
Jan
  1 Commento
Jan Kappen
Jan Kappen il 9 Ago 2023
Any updates from Mathworks?
I'd really like to know if theres something on its way or if I have to create my own dependency manager, probably in Python.
Thanks

Accedi per commentare.

Risposte (1)

Michelle Hirsch
Michelle Hirsch il 9 Ago 2023
We are working on a package management system for MATLAB. The mpm comand you found in MATLAB was from an early beta test we ran in R2022b to flesh out some of the basic principles of the system we are designing.
I think the best bet would be for us to connect you with an appropriate expert or two at MathWorks to talk through ideas of how to best approach meeting your needs now while setting yourself up to adopt our system when it is ready. I'll email you through your author profile to make the connection.
  5 Commenti
Michelle Hirsch
Michelle Hirsch il 3 Apr 2024 alle 18:45
@Ernst van der Pols in cases it's helpful, here's some input I received from one of MathWorks consultants who has helped a lot of users set up package management tooling. He hasn't worked directly with NuGet with MLTBX, but has heard from some users who have. Here are his observations:
  • It’s pretty simple to put an mltbx in a NuGet package, I don’t know of anyone making an mltbx be a NuGet package.
  • NuGet packages can have dependencies and pull them in automatically.
  • There is no requirement in .NET for one version of any given library, so it makes no effort to resolve dependency ranges.
  • NuGet will allow you to search packages and pull the mltbx files, plus dependencies, into a folder, but can’t install them.
  • You need to write a bunch of MATLAB code to take the folder of mltbxs and install them (and with dependencies, work out which ones to install)
  • And more code to avoid downloading everything every time.
Let me know if you'd like to get on a call to discuss how our consultants might be able to help you in the short term, and to learn more about your usage to inform our future development plans. We do expect to support integration between the forthcoming MATLAB package management system and artifact repositories, but don't have a timeline yet.
Ashley Trowell
Ashley Trowell il 4 Apr 2024 alle 17:28
I'm glad to see activity on this.

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by