# Making a Mathematica package manager?

I'd like to get a serious discussion started about a package manager. This has come up elsewhere, and many people have implemented their own solutions. It would be nice to have a standardized way to deploy and distribute Mathematica code to anyone.

I also imagine we could distribute other content this way. For example, one thing I think would be nice, if there were interest, would be to collate information from this site and serve it as a package that includes tools and supplemental documentation.

-
It might be better to follow halirutan's lead and make this a self-answered question (Q. Can we create a package manager? A. Yes we can...) with an associated chat room for discussions. As currently posed it's not clear what would constitute a "correct" answer and it risks being closed as primarily opinion based. –  Simon Woods Jun 4 '14 at 15:46
Have you looked at ProjectInstaller by @LeonidShifrin. It's not a full blown package management system, but installer like that could be a part of such system. –  jkuczm Jun 11 '14 at 14:18
@jkuczm Since you brought this up, let me just mention that I do have Mathematica package manager under development, but it has to incorporate a number of things to become really useful for Mathematica code. In particular, in my framework, the package manager is only a part of the larger infrastructure aimed to enable people to easily share and reuse Mathematica code. Given this fresh initiative, I will publish my ideas in a separate answer some time soon (currently in the hospital and not fully functional). –  Leonid Shifrin Jun 12 '14 at 11:27
@LeonidShifrin Can't wait to see it. I hope you'll get well soon. –  jkuczm Jun 12 '14 at 18:39
@jkuczm Thanks! –  Leonid Shifrin Jun 12 '14 at 18:45

I've prototyped a package downloading system (Mapt) that supports multiple versions, and will show its basic functionality below. Does it work? would you use it? what needs to change? what else would you want it to do? what packages do you want? do you want to work on this project together? do you have an alternative way of doing this?

Get[ "http://mfvonh.me/mapt" ] ;
??Mapt

It is not yet installed locally:

Mapt[ Path ]

None

It can be installed anywhere in $Path. Mapt[ Install ] True Then it can be loaded with Needs[ "Mapt" ] if it is not in an Autoload folder: FindFile[ "Mapt" ] D:\Program Files\Wolfram Research\Mathematica\9.0\AddOns\Autoload\Mapt\init.m These are the available packages: Mapt[ List ] {"HelloWorld", "LevelScheme"} And basic installation: Mapt[ Get , "HelloWorld" ] True Packages can then be loaded like this: Needs["HelloWorldCurrent"] ??HelloWorld All available versions of a package can be listed: Mapt[ VersionNumber , "HelloWorld" , All ] {1.0, 1.1} A specific version can be installed: Mapt[ Get , "HelloWorld" , "1.0" ] True Multiple versions can be on the disk: Needs[ "HelloWorldVersion1$0" ]
??HelloWorld

A more complex package:

Mapt[ Get , "LevelScheme" ]

Fetching LevelScheme...

Extracting...

Initializing...

Done

Needs[ "LevelSchemeCurrent" ]

Figure[{
SetOptions[Lev, Thickness -> 3, Color -> Red],
SetOptions[Trans, ArrowType -> ShapeArrow, FillColor -> LightGray],
Lev[lev1, 0, 2, 0],
Lev[lev2, 1, 2, 100],
Lev[lev3, 0, 2, 200],
Trans[lev2, 0.5, lev1, 0.9, Width -> 10],
Trans[lev3, 0.5, lev1, 0.5, Width -> 20]},
PlotRange -> {{0, 2}, {-10, 210}},
ImageSize -> 72*{3, 3}]

To install the package Mapt creates a temporary directory, sets it, and then just pulls a small script:

Import[Mapt[Path,"Mapt-Packages"]<>"LevelScheme/install-LevelScheme-3.53.m","Text"]

=

Module[
{ progress , update } ,
Print[ "Fetching LevelScheme... " ] ;
progress = 0 ;
update[ _ , "progress" , { now_ , total_ , __ } ] :=
progress = now / total // Quiet ;
URLSaveAsynchronous[
"http://scidraw.nd.edu/levelscheme/versions/LevelScheme-3.53.zip" ,
"ls.zip" ,
update ,
"Progress" -> True ] ;
While[ progress < 1 , Pause[ .1 ] ] ;
Print[ "Extracting..." ] ;
ExtractArchive[ "ls.zip", Directory[ ] ] ;
SetDirectory[ "LevelScheme" ] ;
URLSave[
Mapt[ Path , "Mapt-Packages" ] <> "LevelScheme/3.53/init.m" ,
"init.m" ] ;
Print[ "Initializing..." ] ;
Mapt[ Initialization , "LevelScheme" , "3.53" ] ;
Print[ "Done." ] ] ;

I would like to get a project going on GitHub, so if you are interested in working on it please chime in.

-
I'm totally in to help with this. I'll start (resume) lurking in the Mathematica stack exchange chat room when I can. –  sblom Jun 4 '14 at 18:21
Interested too, though I still can't find spare time for a project I've promised to participate in already. :-\ Email me anytime to remind of this, the address is in my profile. –  Akater Jun 5 '14 at 12:18