mpm Simple Matlab package management inspired by p开源项目

我要开发同款
匿名用户2021年11月23日
51阅读
所属分类、应用工具、科研计算工具
授权协议MIT License

作品详情

MatlabPackageManager(mpm)

AsimplepackagemanagerforMatlab(inspiredbypip).DownloadspackagesfromMatlabCentral'sFileExchange,GitHubrepositories,oranyotherurlpointingtoa.zipfile.

Quickstart

Download/clonethisrepoandaddittoyourMatlabpath(usingaddpath).Nowtrythefollowing:

mpminstall[package-name]:installpackagebynamempmuninstall[package-name]:removepackage,ifinstalledmpmsearch[package-name]:searchforpackagegivenname(checksGithubandMatlabFileExchange)mpmfreeze:listsallpackagescurrentlyinstalledmpminit:addsallinstalledpackagestopath(runwhenMatlabstartsup)MoredetailsInstallasinglepackage

Install(searchesFileExchangeandGithub):

>>mpminstallexport_fig

Wheninstalling,mpmchecksforafileinthepackagecalledinstall.m,whichitwillrunafterconfirming(oradd--forcetoauto-confirm).Italsochecksforafilecalledpathlist.mwhichtellsitwhichpaths(ifany)toadd.

InstallaGithubrelease(bytag,branch,orcommit)

Bytag:

>>mpminstallmatlab2tikz-t1.0.0

Bybranch:

>>mpminstallmatlab2tikz-tdevelop

Bycommit:

>>mpminstallmatlab2tikz-tca56d9f

Uninstall

>>mpmuninstallmatlab2tikz

Whenuninstalling,mpmchecksforafileinthepackagecalleduninstall.m,whichitwillrunafterconfirming(oradd--forcetoauto-confirm).

Searchwithoutinstalling:

>>mpmsearchexport_fig

Installfromaurl:

>>mpminstallcovidx-uhttps://www.mathworks.com/matlabcentral/fileexchange/76213-covidx

OR:

>>mpminstallexport_fig-uhttps://github.com/altmany/export_fig.git

(NotethatwhenspecifyingGithubrepourlsyoumustaddthe'.git'totheurl.)

Installlocalpackage:

>>mpminstallmy_package-upath/to/package--local

Theabovewillcopypath/to/packageintothedefaultinstalldirectory.Toskipthecopy,add-etotheabovecommand.

Overwriteexistingpackages:

>>mpminstallmatlab2tikz--force

Install/uninstallpackagesinaspecificdirectory:

>>mpminstallmatlab2tikz-d/Users/mobeets/mypath

Notethatthedefaultinstallationdirectoryismpm-packages/.

Environments("Collections")

mpmhasrudimentarysupportformanagingcollectionsofpackages.Tospecifywhichcollectiontoacton,use-c[collection_name].Defaultcollectionis"default".

>>mpminstallcbrewer-ctestUsingcollection"test"Collecting'cbrewer'...Foundurl:https://www.mathworks.com/matlabcentral/fileexchange/58350-cbrewer2?download=trueDownloadinghttps://www.mathworks.com/matlabcentral/fileexchange/58350-cbrewer2?download=true...>>mpminit-ctestUsingcollection"test"Addingtopath:/Users/mobeets/code/mpm/mpm-packages/mpm-collections/test/cbrewerAddedpathsfor1package(s).Installingmultiplepackagesfromfile>>mpminstall-i/Users/mobeets/example/requirements.txt

Specifyingarequirementsfileletsyouinstallorsearchformultiplepackagesatonce.See'requirements-example.txt'foranexample.Makesuretoprovideanabsolutepathtothefile!

Toautomaticallyconfirminstallationwithoutbeingprompted,set--approve.Notethatthisisonlyavailablewheninstallingpackagesfromfile.

Whatitdoes

Bydefault,mpminstallsallMatlabpackagestothedirectorympm-packages/.(Youcaneditmpm_config.mtospecifyacustomdefaultinstallationdirectory.)

IfyourestartMatlab,you'llwanttorunmpminittore-addallthefoldersintheinstallationdirectorytoyourMatlabpath.Betteryet,justrunmpminitfromyourMatlabstartupscript.

Troubleshooting

Becausethere'snostandarddirectorystructureforaMatlabpackage,automaticallyaddingpathscangetabitmessy.Whenmpmdownloadsapackage,itaddsasinglefolderwithinthatpackagetoyourMatlabpath.Ifthereareno*.mfilesinthepackage'sbasedirectory,itlooksinfolderscalled'bin','src','lib',or'code'instead.Youcanspecifythenameofaninternaldirectorybypassinginan-norinternaldirargument.Toinstallapackagewithoutmodifyinganypaths,set--nopaths.Ortoaddallsubfoldersinapackagetothepath,set--allpaths.

Mpmkeepstrackofthepackagesit'sdownloadedinafilecalledmpm.mat,withineachinstallationdirectory.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论