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
132 votes
9 answers
28k 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 ...
  • 6,400
108 votes
4 answers
11k 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 ...
70 votes
3 answers
3k 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 ...
  • 229k
55 votes
1 answer
2k 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 ...
  • 229k
53 votes
2 answers
8k 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 ...
  • 229k
52 votes
1 answer
4k 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?...
  • 11.6k
51 votes
3 answers
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 ...
  • 111k
45 votes
6 answers
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 ...
  • 6,373
42 votes
7 answers
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 ...
  • 423
41 votes
3 answers
4k 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 ...
  • 3,117
41 votes
5 answers
1k views

Best practices for using the Testing Framework

I am looking for best practices and recommended workflows for using the Testing Framework. For example, lets say I am developing a Mathematica package for other users, it is hosted on GitHub and I ...
  • 6,423
39 votes
3 answers
14k 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.
  • 491
38 votes
3 answers
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 ...
  • 10.8k
38 votes
4 answers
2k 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. ...
  • 5,272
38 votes
3 answers
17k 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 ...
37 votes
2 answers
2k views

When to use Get vs Needs

When should I use << vs Needs? I just always use Needs as ...
  • 2,195
35 votes
2 answers
744 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: ...
  • 8,514
35 votes
1 answer
2k 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 ...
  • 5,241
33 votes
2 answers
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 ...
33 votes
0 answers
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 ...
  • 14.7k
31 votes
2 answers
868 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 ...
  • 229k
30 votes
1 answer
3k 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?
  • 229k
29 votes
1 answer
730 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, ...
  • 3,708
27 votes
1 answer
733 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 ...
  • 266k
27 votes
1 answer
722 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 ...
  • 1,697
26 votes
6 answers
4k 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, ...
  • 45.9k
26 votes
3 answers
4k 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. ...
  • 1,821
26 votes
3 answers
4k 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 ...
  • 1,121
25 votes
3 answers
1k views

Package organization

When writing a Mathematica package Foo, with functions f1, f2 and f3, one can use the template: ...
25 votes
1 answer
690 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 ...
  • 13.7k
25 votes
2 answers
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 ...
  • 8,601
24 votes
4 answers
3k 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
2 answers
2k 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 ...
  • 45.9k
24 votes
2 answers
2k 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 ...
  • 6,555
24 votes
1 answer
3k 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 ...
  • 2,095
23 votes
4 answers
1k 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 ...
  • 6,400
23 votes
1 answer
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 (...
23 votes
2 answers
511 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 ...
  • 45.9k
22 votes
2 answers
543 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 ...
  • 229k
22 votes
1 answer
3k 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 ...
  • 40.1k
22 votes
1 answer
589 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
1 answer
758 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 ...
  • 229k
21 votes
2 answers
11k views

Using Mathematica for tensor analysis

Has anybody used tensors in Mathematica? How to properly work with them? I find Mathematica not very friendly in this field, as I am defining my own functions for lowering & raising indices, ...
  • 1,463
21 votes
1 answer
469 views

How to Develop Paclets in Workbench Considering the Recent Changes in PacletInfo.wl Format and Supporting Functions?

WRI Technical Support [CASE:4868964] Preamble So far I am using Wolfram Workbench (i.e., a plugin to the Eclipse IDE) to develop packages collecting often used Wolfram Language functionality. For ...
  • 12.7k
20 votes
3 answers
5k views

How do I create a package from an existing notebook?

I have a notebook containing some functions, for example: f[x_] := 2*x g[x_] := x^2 Now I would like to convert this notebook to a package, ...
  • 287
20 votes
2 answers
3k 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 ...
  • 8,601
19 votes
2 answers
529 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 ...
  • 1,501
19 votes
2 answers
910 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
2 answers
3k views

How to unload automatically loaded packages?

I know that this has been discussed here (How do I clear all user defined symbols?), but my case is somewhat different. How does one unload packages during runtime that were loaded with the start of ...
19 votes
1 answer
875 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 ...

1
2 3 4 5
17