Git based Package Manager for MATLAB
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
.gitattributes
.gitignore
LICENSE
README.md
_config.yml
package.json

README.md

PackMan

PackMan aims to bring dependency management, similar to what npm does for Node.js, to MATLAB. It is a fork of and improves on DepMat.

Usage guide

Let's say you have a MATLAB project and you want to be able to use external packages in your code. An external package can be any git repository for which you have read access (e.g. any public repository on GitHub).

One time setup

You will need to do the following once, to enable package management with PackMan for your project:

  • Make sure there is no directory called 'external' at the root directory of your project
  • Copy "installDeps.m" to the root directory of your project
  • (Optional) Copy "getDepList.m" to the root directory of your project.

Done! Your project is now equipped with dependency management.

Add/remove dependencies

You will need to do the following any time you want to add/remove a dependency

  • (Option 1) Update the list of dependencies in a file called package.json (for R2016b and later). PackMan will create a package.json file the first time you call "installDeps.m". Each dependency can have the fields listed in the following sample "package.json":
{
 "dependencies":{
  "PackMan":{
   "Name":"PackMan",
   "Branch":"master",
   "Url":"https://github.com/OmidS/PackMan.git",
   "FolderName":"PackMan",
   "Commit":"",
   "GetLatest":true
  }
 }
}
  • (Option 2) Modify "getDepList.m" to make sure it lists the dependencies that you want. It is good to also have PackMan itself in the dependency list (uncomment line 10 of getDepList.m)

Note: when removing any repositories, it is best to delete the 'external' directory completely so that PackMan starts fresh.

Install/update dependencies

You will need to do the following to install or update dependencies

  • Run the following command (this will install/update all dependencies)
>> installDeps;

Add dependencies to the path

You will need to run the following to add the dependencies to the MATALAB path before running your code

  • Now before running you code, add dependencies to the path by calling:
>> pm = installDeps;
>> addpath(pm.genPath());

You can also gracefully remove all dependencies from the path by calling:

>> rmpath(pm.genPath());

Complete example:

See the following sample repository for a complete usage example for PackMan: https://github.com/OmidS/matlabPackManSample

Credits

PackMan was forked from a great repository called DepMat, by Tom Doel.