How do you develop a package without having to commit, push and pull all your changes all the time


#1

The title is my question. I am always testing my package by using MyPackage now according to documentation my LOAD_PATH is checked after Pkg.dir() is checked, where my old version of MyPackage is. I want a stable version of MyPacke in Pkg.dir() for testing and comparisons. Now whenever I want to test a change to MyPackage I will have to commit my changes, push it to some repo and then pull it again inside Pkg.dir() */MyPackage ( if I feel like wasting even more time I would use Pkg.update("MyPackage") ). I also spam the repo with useless commit messages basically being “debug”.

Now this does not seem like a sane development process to me, what am I doing wrong?


#2

You could always set JULIA_PKGDIR to have two separate package environments.

ie. use JULIA_PKGDIR=/path/to/development/pkgdir julia to run julia without touching the stable version in your usual package directory.


#3

I had problems to follow, what you actually try to do, but my recommendation would be:

  • learn git (especially about branching)
  • work for development with a local repository only.

You’ll need local git access (commandline or GUI) and put your stable version into a branch ‘stable’, and Pkg.checkout should enable you to select this branch.
The remote (any remote) repository you only need to share code. git works locally also.


#4

I typically develop in the same directory where I also keep the stable version, using “git checkout” to switch between development and stable branches. But this only works because I never need the stable version at the same time as I am working on a development branch. (In that case I guess setting the JULIA_PKGDIR environment variable would be the way to go.)

For tests that take a while to run, or that need a different OS or hardware, I’ve sometimes used git hooks. That way I can push commits to a server and it will run the tests automatically. This leads to lots of “debug” commits, but it is possible to “squash” them, to make the commit history look better.


#5

I am not sure I understand what you are doing.

I typically create a local package with Pkg.generate, and work from there. If it is production code, I work in branches, but otherwise on the master. I only commit changes to keep track of it, and do not necessarily push/pull unless I have a repo on Github.

Learning git is quite useful. Some editors have git integration (eg Emacs), which makes working with version control really seamless.


#6

Isn’t this exactly the use case for Revise.jl? If so, you’re in luck @Jackels – it was released just a few days ago :slight_smile: