Recommended setup for developing packages



When I work on my own Julia packages, I currently do a Pkg.clone(...) from my git repository to install the package with all its dependencies and register it to the package system. After that I delete the package folder in the .julia directory and create a symlink with the same name, pointing to a local clone of the original git repository.
This way I can work on the package and I can test the changes in the REPL/notebooks/scripts immediately.

This workflow however seems quite odd and I wanted to know how you are dealing with this.


Why don’t you work straight in the .julia directory? You can symlink to it.


I don’t like entangling my work with other stuff, especially when other scripts are acting in that folder. Also I might forget about it when wiping the .julia directory e.g. :wink:


you are aware of git branch?




I also use symlinks.


OK so this approach seems not to be so awkward :wink:


I just work in the folder directly on a dev branch. I don’t see what should talk against doing that.


You could also update the JULIA_LOAD_PATH variable with your package folder. Later it can be used as an installed package.


I do essentially the same, but have a bash script that deletes the .julia folders and creates the necessary symlinks. This let’s me restart my .julia folder from scratch easily.


Is there any magic behind Pkg.add/Pkg.clone to “register” a package, or is it sufficient to have a folder with the package in the .julia folder?


I set JULIA_PKGDIR to where I want the packages I develop to live (along with their dependencies). My ~/.julia does not contain any packages. This allows me to have separate pkgdirs for separate projects, which could otherwise have resulted in conflicting version requirements.

I then have a couple of convenient bash aliases in my ~/.bashrc:

alias julia-pkgdir='export JULIA_PKGDIR=`pwd`'
alias rbd-devel='cd ~/code/RigidBodyDynamics && julia-pkgdir && cd v0.6/RigidBodyDynamics'

The first simply sets JULIA_PKGDIR to your current directory. The second sets JULIA_PKGDIR and cds to the main package I’m working on in one simple command, so I can get to work (just an example).


Everybody’s got their own little bash script it seems :slight_smile: Perhaps we will have a more standardized workflow with Pkg3 and it’s immutable package installs?


further discussed in a juleps issue:


I use symlinks too, but I symlink from ~/.julia/v0.6 to directories in ~dev/julia. That way if I wipe ~/.julia, my development work doesn’t disappear.


How can you do this please?


Eg using ln in the command line, assuming you are on Linux or OS X.


I was looking for a MWE :sweat_smile: More precisely, if my package (e.g. PDMP) is in /Users/rveltz/dev/julia/PDMP.jl how do I symlimk things?


Something like

ln -s /Users/rveltz/dev/julia/PDMP.jl ~/.julia/v0.6/PDMP

man ln is your friend.


no, you are!! Thank you.