Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to bundle up a Mathematica package that I've written and distribute it as open source. It has a couple of dependencies that I'd like to automatically download independently from my package as well.

Is there any sort of established Mathematica package manager and package distribution site? (I'm thinking along the lines of pip for Python, gem for Ruby, nuget for .NET, hackage for Haskell, that sort of thing.)

I've seen Wolfram MathSource, and as near as I can tell its aim seems to be to collect various contributed packages from around the web into a central place, but it doesn't feel very active (maybe I'm wrong?).

share|improve this question
add comment

2 Answers 2

Why don't we make one? Here's a start -- feel free to try it at home :)

ClearAll[mfvonh, HelloWorld];
Import["http://mfvonh.me/mma/install", "Text"] // ToExpression;
mfvonh[Install, {"Testing", "HelloWorld"}];
HelloWorld[]

Hello, world! -mfvonh

You can distribute any kind of content (definitions, data, docs, etc.) this way. Here's how it works:

I run a webserver at mfvonh.me, and /mma is just a directory containing whatever I need to transfer (text files with definitions, data, etc.). The "install" file looks like this:

Import["http://mfvonh.me/mma/install", "Text"]

=

ClearAll[mfvonh];
mfvonh[dir_, args___] :=
 Module[{
   BaseURI = "http://mfvonh.me/mma",
   ValidDirQ := MatchQ[dir, _Symbol],   
   ValidArgsQ = MatchQ[{args}, {} | {{__String} .., ___Rule}],
   FromMFVONH = Import[#, "Text"] &,
   Exec = ToExpression[#] &},
  Switch[dir,
    Install, 
    Exec /@ FromMFVONH /@ (StringJoin[Riffle[{BaseURI, ##}, "/"]] & @@@
         Cases[{args}, _List])
    ] /; ValidDirQ && ValidArgsQ
  ]

So in the example {"Testing", "HellWorld"} is resolved to the corresponding path on the server, which is also just a file:

Import["http://mfvonh.me/mma/Testing/HelloWorld", "Text"]

=

SetDelayed[HelloWorld[],Print["Hello, world! -mfvonh"]]

The simple way to define dependencies would be to include a reference to them in the install script, and a generic check to see if a package has already been loaded. It would be pretty easy to build out all the features of a decent package manager. Obviously executing code off the internet introduces some security considerations.

I would be willing to take this on as a project if people would use it.

share|improve this answer
    
Talk to Leonid in chat, he's been working on one. –  Szabolcs May 28 at 23:51
1  
I also have a start at github.com/mathematica-packages/mpg, and have been sort of waiting to see whether there was even enough interest in the idea to justify more effort. Starting to look like there might be enough interest for this to work. You use mine by saying Import["https://j.mp/needs-mpg"], or if Mpg is already installed, by saying Needs[Mpg``]. It doesn't really do much yet, but I'm really proud of the bootstrap story. –  sblom May 28 at 23:52
    
@sblom If you have a chance would you please share here? Yours has some functionality that my prototype does not. –  mfvonh Jun 4 at 16:12
add comment

I'm not aware of any existing package manager. As to activity of Wolfram MathSource, let's ask Mathematica:

libraryLinks = 
  Select[
     Import[
         "http://library.wolfram.com/infocenter/search/?page=1;search_results=1;search_item_type=19&pages_count=100000", 
         "Hyperlinks"
     ], 
     StringMatchQ[#, RegularExpression[".*library.*"]] &
  ];

dates = 
   Function[{ll},
      Cases[Import[ll,"Data"], 
            _String?(StringMatchQ[#,DatePattern[{"Year", "Month", "Day"}]] &),
            Infinity]
      ] /@  libraryLinks // Flatten;

Histogram[(DateList /@ dates)[[All, 1]], {1}]

Mathematica graphics

Indeed, it doesn't seem to be too busy lately.

share|improve this answer
    
Nice method/chart. I wonder why the collapse. –  Mr.Wizard Jul 10 '12 at 14:56
1  
@Mr.Wizard might have something to do with the launch of Wolfram Demonstrations. I believe that happened somewhere in 2006. There are now over 8000 demonstrations and only about 1800 MathSource entries. –  Sjoerd C. de Vries Jul 10 '12 at 15:18
    
Perhaps, but there used to be a lot of (re)usable packages posted to MathSource. Demonstrations are neat, but hardly a substitute. –  Mr.Wizard Jul 10 '12 at 15:29
    
mr.wizard Agreed, but I imagine many of the package authors have moved over. –  Sjoerd C. de Vries Jul 10 '12 at 15:40
1  
Absolutely, it would be very good if such a central service would exist. If something is started now, I think it probably would need to be at least as good as existing services/repositories AND be readily availabe from Mathematica, like an app-store with search + public review + one click installation. WRI offered repositories based on svn a few years ago but I don't even know if that service still exists, it certainly wasn't attractive enough. An feature that would certainly attract me as a developer would be a distributed version control well suited for notebooks (=not line based) :-) –  Albert Retey May 28 '13 at 12:27
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.