Questions tagged [packages]

Questions on Mathematica packages, which are self-contained bundles of Mathematica code that add new functions and other functionality.

Filter by
Sorted by
Tagged with
111
votes
9answers
22k views

Creating Mathematica packages

I'm building a package to help me write packages and their documentation. In this post I explained how to make a package and its documentation. In the answer I provided I describe how to build a very ...
90
votes
4answers
7k views

What are the recommended settings for git when using with Mathematica projects?

Background I'm relatively new to git — currently overseeing an offshore .NET-based development project on GitHub within a private business account, but little experience beyond that. I'd like to set ...
62
votes
3answers
2k views

How to distribute Mathematica packages as paclets?

Mathematica does have a nice package manager. Packages are called paclets, and they can be managed using the functions from the PacletManager` context. How can I ...
48
votes
3answers
3k views

How to distribute proprietary Mathematica code

If I want to make package-code completely unreadable, in a way that the end-user can only call my functions, but has no way to re-engineer my definitions, how would I do that? I know I can use ...
48
votes
1answer
1k views

PacletInfo.m documentation project

Packages can be made into paclets, which provides easy distribution and versioning. The paclet metadata is in the PacletInfo.m file. The PacletInfo settings also ...
48
votes
1answer
3k views

What is the difference between a .wl package and a .m package?

In Mathematica 10.x, one now has both .wl Wolfram Language Packages and .m Wolfram Mathematica Packages. What's the difference?...
44
votes
6answers
1k views

Mathematica package manager

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 ...
44
votes
2answers
5k views

What is a “Paclet”?

I often see references to "paclets", for example the PacletManager` context, the PacletInfo.m file in some packages and next to ...
39
votes
7answers
1k views

How symbol lookup actually works

Bug introduced in V6 and fixed in V11.3 The behavior indeed changed but now the documentation is clear about it. This code is inconsistent with the description from Power Programming with ...
38
votes
3answers
3k views

Computational Bayesian analysis in Mathematica: Any plans to develop MCMC?

Does anyone know if there are any plans to develop an MCMC capability in Mathematica? My reasoning for asking is that as it stands, I can't seem to find any 'out-of-the-box' functions/capabilities ...
37
votes
3answers
12k views

Differential geometry add-ons for Mathematica

I need a differential geometry tool for Mathematica. Is there any add-on? Unfortunately, Mathematica does not include such functionality or I can not find it.
35
votes
1answer
1k views

Why are all the lines commented when I create a Mathematica script?

When I created a Mathematica script, I found that all my lines were commented out (when opened with vi or gedit or any other ...
34
votes
2answers
2k views

When to use Get vs Needs

When should I use << vs Needs? I just always use Needs as ...
33
votes
3answers
2k views

How to load a package without naming conflicts?

This question applies to any package, but I encountered this problem while working with graphs. There are symbols in the Combinatorica package (such as ...
33
votes
2answers
649 views

What's the difference between these two ways of specifying dependent packages?

What's the difference between these two ways of specifying dependent packages? Method 1: BeginPackage["foo`bar`", {"xxx`", "yyy`"}] Method 2: ...
33
votes
0answers
3k views

Custom package development: Basic steps [duplicate]

Every once in a while, I write a generic function that I use quite often for months to come. However, package development in Mathematica is not very well documented from what I can tell, and I was not ...
32
votes
2answers
13k views

How to install packages?

This is always a problem when I distribute my packages to colleagues working on different platforms. I have my packages installed into a private directory and I autoload some of them when Mathematica ...
31
votes
2answers
2k views

What are recommended guidelines for developing packages?

This might be of general interest – I have different questions regarding naming conventions, contexts, subcontexts, shadowing, etc., but I do feel that they are closely related, thus I don't really ...
30
votes
4answers
1k views

Declaring Package with dependencies in multiples files?

I am new to using Mathematica where I write most of my code in packages. So to get the hang of it I am trying to set up an example of what a project might actually look like. ...
29
votes
1answer
655 views

Creating a package of special plots

In my work as a math teacher, I create lots of graphs to illustrate ideas. I have lots of math books and will often try to duplicate a particular style of graph. Below, one very simple example, ...
27
votes
1answer
652 views

In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1 This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4 In Mathematica 10.1.0 and 10.3.0 ...
25
votes
1answer
633 views

Pop-up appeared and then disappeared during first documentation search in 11.2

After installing Mathematica 11.2, the first time I searched for something in the help center a pop-up appeared and then disappeared. It didn't appear on a subsequent search, even if I restarted ...
25
votes
1answer
566 views

Can code optimize code?

Are there functions, programs or packages that deal with optimizing mathematica code i.e. re-writing ineffecive or convoluted code. -This question has haunted me since I joined SE. The background for ...
24
votes
3answers
3k views

Listing the functions defined in a package

Assume that I know a package's (Context?) name that is loaded. Now I want to list the functions defined in this package. How can I do it? I remember that I found a way once, but I cannot re-find it. ...
24
votes
4answers
2k views

How to program a F::argx message?

How useful is it to program a user-built function in a package to produce a red warning message F::argx if you give the wrong number of arguments to that function? ...
24
votes
2answers
2k views

Mathematica vs. $\LaTeX$? Replacement for Legacy “Authoring Tools” package?

I'd rather write in Mathematica than in $\LaTeX$, but it's not really practical, especially for big works (> 100 pages) without good tooling. I'm just starting to look into what's available for big ...
24
votes
1answer
433 views

What to be aware when using new-style package?

A new package format is described in this post. This format does not use BeginPackage and Begin. Instead, each package file is ...
24
votes
1answer
2k views

What is available for editing Mathematica source code with Emacs?

I can find several Emacs libraries for Mathematica, but I'm not aware of a clear favourite, a definitive list, or of a library which is actively maintained and developed. None of these appear to be in ...
23
votes
4answers
960 views

Defining functions in stylesheets

Is there a way to define functions in a stylesheet? So far I have managed to write my stylesheets without the need to use my own custom functions or definitions. For instance, maybe I have some color ...
23
votes
3answers
938 views

Package organization

When writing a Mathematica package Foo, with functions f1, f2 and f3, one can use the template: ...
23
votes
2answers
1k views

Sharing small code snippets

As part of my never-ending goal of getting Mathematica code to be as easily shared as python packages I was recently thinking about how to make code easy to share. So what's are some good ways to ...
23
votes
2answers
1k views

How safe is Encode?

How safe is an encoded package (using locked, etc)? If I don't specify a personal key, I understand that the encoding key must be somewhere in the Mathematica program itself, and so it is not a ...
22
votes
3answers
3k views

Generate a Random Polygon

Does some package exist with a function that takes a parameter $n$ and generates a random 2D $n$-sided simple polygon (convex or non-convex), possibly within a certain bounding box? It does not ...
22
votes
3answers
3k views

Best Practice to write ::usage for own package functions

I'm writing an own package with Mathematica, that I would like to make available for others. In order to do that (and for my own usage of the package), I would like to write ...
22
votes
1answer
2k views

How can I install packages distributed as .paclet files?

I downloaded a Mathematica package. It came as a file with the .paclet extension. How can I install or uninstall it?
22
votes
1answer
1k views

What is the proper method to load a Mathematica package inside a DynamicModule

I have a DynamicModule that requires loading of Mathematica packages. The usual methods do not seem to apply (...
22
votes
1answer
504 views

$Path hijacked by PacletManager?

Summary: Since Mathematica version 6, the PacletManager seems to have engineered an escalating hijack of the $Path variable. Add-on packages need to have a ...
22
votes
2answers
411 views

Building a convenient package distribution system

The PacletManager is nice, but it's not really a low-effort system to work with. Installing a package can be made pretty easy, but only if the location from which ...
22
votes
1answer
592 views

How to clean up temporary files when the kernel exits?

There are Mathematica packages that must create temporary files to function. If we are implementing such a package ourselves, how can we ensure that the temporary files will get cleaned up when the ...
21
votes
5answers
2k views

Making a website with Mathematica

I know many people here have various websites associated with them and I'm guessing do at least some of the development of that stuff in Mathematica. I recently fell down that rabbit hole myself, ...
20
votes
2answers
2k views

How to make a parallel auto-generated .m package from Initialization cells?

according to the documentation at ref/InitializationCell, When you first save a notebook that contains initialization cells, you have the option to make a ...
20
votes
2answers
416 views

Second argument of BeginPackage with nested package loading

I naively thought that the second argument of BeginPackage can simply be used to ensure the loading and availability in the ...
19
votes
2answers
840 views

Automated testing for compatibility with older Mathematica versions

I have several packages which I actively develop and maintain. I try to stay up to date with new releases of Mathematica and usually update within a couple of months of a new version coming out. As a ...
19
votes
1answer
715 views

How can I include functions from a package into a CDF file?

I am building an application which I would like to deploy as a CDF file, and I am struggling to make the CDF exports work correctly with functions pulled from a .m package file. What are good/best ...
18
votes
2answers
492 views

Mathematica “prelude”

Is there any way to have the functions from a mathematica file be loaded on startup? For example, in this excellent answer, Jens helps me out and gives me some functions for creating legends for ...
18
votes
3answers
554 views

What is the purpose of tags like :Name:, :Context:, etc. in packages?

I noticed that all of the packages that come with Mathematica start with a header that is in a standard format. (See e.g. the header of NIntegrateUtilities` at the ...
18
votes
1answer
2k views

How to get the directory of a package?

I have a package that I have placed in the $BaseDirectory\Applications directory so that Needs can find it. I have a logo in ...
18
votes
2answers
277 views

How to find out what files are touched when Get is called?

Is there a way to capture all package files touched whenever a package is called via Get, Needs, ...
18
votes
1answer
475 views

What are Package` context symbols for?

The Package` context contains the following: What is the use of these undocumented functions? I am looking for a concise description of the syntax and purpose of ...
18
votes
2answers
299 views

How to find the package file that stores a certain symbol?

Is it possible to figure out in what file a certain packaged symbol lives in (assuming there is no shadowing between multiple identical symbol names)? I would like to have a function that if, given a ...