Collaborating on Existing Packages

by Martin D. Maas, Ph.D

A great way to contribute to the open-source community is to share you fixes and enhacements to existing packages.

Contributing to an existing open-source Julia package can be a great way to learn new skills, share your own skills, improve a piece of software you rely upon on a daily basis, and build experience (you’ll get code reviews and feedback from good developers), some reputation… And besides, it can be a fun way to spend your time!

Let’s go over a quick overview of the mechanics of how to do this in Julia.

Step 1: Fork the Desired Package

Go over to Github and fork the desired package.

It’s also customary to create an issue to discuss the proposed changes or new features before implementing them, to get feedback and to make sure your contribution will be appreciated by the project mantainers, who might have other ideas.

Step 2: Clone and Activate the Development Environment

As a second step, the repository has to be cloned into our local system.

We will then have two installed versions of the same package: the registered version, and the development version.

We could clone the package repository using git clone, and then activate the development environment. Actually, this two steps can be accomplished with a single command:

Pkg.develop(url="address of your fork repo")

If you then import the package (i.e. using somePackage) it will load the version you’ve just cloned.

Step 3: Switch From Development and Registered Versions

To go back and use the registered version of the package, just do from a REPL

] free somePackage

The next time we want to switch back to the your development version of the package, activate the development environment by doing:

] dev somePackage

The package manager will switch back to the version of the package sitting in the package development directory.

Note that the default Julia package development directory for a Linux system is ~/.julia/dev. It can be set to be somewhere else using the environment variable JULIA_PKG_DEVDIR. In a Windows system, this is very similar.

Step 4: Work in your local copy

Work in your local copy, and push to your fork.

Step 5: Create a Pull Request

The final step is to create a pull request, and reference the issue you’ve created.

Conclusion

This is the basic mechanics on how to collaborate on an existing package.

For more info, see the developing package section of the package manager docs