npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

matpack

v2.1.1

Published

Command Line tools for npm matlab packages

Downloads

2

Readme

matpack

A command line tool for quickly starting a new MATLAB package that uses the Node package manager (NPM) for its package / dependency management.

Quick Start

If you don't know what Node, NPM, or MATLAB are, this section is not for you.

  1. Get the matpack executable
$ npm install -g matpack
  1. Run it and give it your MATLAB package name and your NPM package name.
$ matpack
> +TestPackage
> test-package
  1. You can publish your package immediately (assuming the name is available)
$ npm publish
  1. Now you can run a smoke test of your MATLAB package. Just go to a new directory and then:
$ npm install test-package
$ cd node_modules
$ matlab
> TestPackage.test

If the above isn't crystal clear hopefully the following will help. If it doesn't, please let me know, I'd love to spend time improving the docs.

The Big Idea

Node

Javascript is one of the most widely used programming languages in the world due to the fact that it is one of the 3 core technologies of the internet (the other two are HTML and CSS). Node provides a non-browser environment to run javascript.

As such, Node has become the go-to source for developing and collaborating on javascript packages across the world-wide web.

Package Management

The idea of creating little modular tools that do their job well is common practice in modern programming. The process is straightforward:

  1. Develop (write code for) the tool you want to create.
  2. Give the tool a version number (e.g. 2.0.1) and bump that version number whenever you modify the tool according to semver standards.
  3. Publish that tool so that others can use it in their projects.

In order for the above process to work we need a 3rd party platform that can host copies of the tool to redistribute and that platform needs to be aware of the version of each copy. Unfortunately no such platform exists for MATLAB so with matpack we'll be using NPM to accomplish this.

Dependency Management

As the community grows and more tools become available and tools get updated we'll start running into dependency problems. This happens when tool1 publishes a version 1.0.0 and then tool2 starts using it. Later tool1 updates a lot and bumps to version 2.0.0. When folks download tool2 they also need to download version 1.0.0 of tool1 instead of the latest version in order for tool2 to work properly.

As you can imagine this kind of thing can get quite complex with hundreds of dependencies. This is the second thing that MATLAB is missing and that NPM can provide for us.

How to use it

Once you have a grasp of basic concepts like modular package development, version control, and package / dependency management you're ready to create your first MATLAB package. This tool is here to provide a skeleton for that package.

  1. Install Node
  2. npm install -g matpack
  3. matpack

This will bring up a prompt asking for the MATLAB name of your package and the NPM name. The fact that there are two names is a big deal. Unfortunately there is a major conflict between the way NPM handles package names and the way MATLAB handles them. NPM requires that they be URL safe (no special characters in the name like +) and MATLAB requires that the folder name begin with a + in order to mark it as a package.

The (bad) solution (for now) is to have your npm package rename itself after it installs. For example, if you install a MATLAB package like Critter. Then npm will install it with the name critter and then rename it to +Critter so that MATLAB can use its contents. This introduces an important problem: with the original name critter now gone, other NPM tools like prune, update, and uninstall will not work because they will not be able to find the package! So please be aware of this problem and send in suggestions to improve the situation here.

Anyways, once you've entered in both names you're done, this package will do the rest of the work for you and you'll have a bonafide NPM / MATLAB package ready to go.

When you want it to go live on the npm servers just give the command npm publish (assuming you have a free account set up with them) and voila, people all over the world will be able to instantly use your great MATLAB code!

Suggestions

This is a totally new and experimental idea, please send me suggestions for how I can improve the learning curve for scientists new to package management or any other aspect of the project!

Learn More

There is a lot more to learn on the topic of good package design and maintenance. Please read the npm docs, the MATLAB package docs, and google around to get into this world of reusable maintainable software development. Your investment in learning this principles will pay huge dividends throughout your programming life.