Do packages replace or supplement toolboxes from R2024b?

15 次查看(过去 30 天)
In the 2024b release notes: "A package is a collection of MATLAB® code, related files, and a package definition file." There's a new set of tools to create and manage packages.
On the other hand, from the help center: "You can package MATLAB® files to create a toolbox to share with others. These files can include MATLAB code, data, apps, examples, and documentation. When you create a toolbox, MATLAB generates a single installation file (.mltbx) that enables you or others to install your toolbox." There's a tool for packaging toolboxes.
These seem remarkably similar concepts, which makes me wonder why both things now exist. Do packages simply replace user-written toolboxes, or do toolboxes retain some useful features which are not shared by packages? Are there situations where I should choose one over the other, or is the newer mechanism superior in general?
It looks like packages can analyse dependencies and pull needed packages along with them, and maybe they integrate with repositories better than toolboxes, but I might have missed something else significant. As far as I can see, the package documentation ignores toolboxes.
It would be nice to understand what is happening here, and which mechanism I should adopt for distributing related code files.
(Note that MATLAB used the term package in a different way in the past, to mean what is now a namespace. I'm asking about the new package mechanism as of 2024b.)

采纳的回答

Adam Sifounakis
Adam Sifounakis 2025-1-28
Hi David!
This is a great question!
"Packages" are an evolution of the existing "toolbox packaging" capabilities we have today. Packages are meant to tackle the same use cases as toolboxes, but enable more robust package management-like features/capabilities using the MATLAB Package Manager (MPM). Packages will be our future-facing technology, we will eventually migrate all of our "toolbox" technology to work seamlessly with "packages," and the terms "packages" and "toolboxes" will be used interchangeably in the future.
Compared to today's "toolbox packaging" capabilities, these are some of the targeted benefits/features of packages:
  • more robust mechanism for dependency declaration between packages
  • automated dependency resolution and installation
  • robust MATLAB Package Manager (MPM) API for scripted/automated workflows
  • ability to create custom/private package repositories
  • and more...
All of that being said, "packages" are still a work in progress, and we're working hard to get them to a place where they can be a full replacement of the "toolbox" capabilities we have today. This is we haven't made a huge splash about them just yet. 😅
We'd love for you to give them a try and give us feedback! 😁
So, should you use toolboxes or packages today? Well, it depends...
You should use "packages" if:
  • all of your end-users are using R2024b or later
  • you need scripted installation and dependency management
  • you are ok with defining / working with package metadata without a UI
  • you are ok with (for now) being limited to create your own disk-based / network storage-based package repository
  • you want to be an early adopter and provide us feedback
You should use "toolboxes" if:
  • you need to support end-users on MATLAB R2024a and earlier (since MPM/packages were released in R2024b)
  • you prefer UI-based tools to define/update package metadata
In the future, "packages" will be the technology that powers all toolboxes, and we're excited to be keep releasing features to improve the package/toolbox experience in MATLAB. 😁

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Debugging and Analysis 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by