Recommended setup for developing packages

package
development

#1

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.


#2

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


#3

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:


#4

you are aware of git branch?


#5

Yes.


#6

I also use symlinks.


#7

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


#8

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


#9

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


#10

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.


#11

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?


#12

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).


#13

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?


#14

further discussed in a juleps issue:

https://github.com/JuliaLang/Juleps/issues/31


#15

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.


#16

How can you do this please?


#17

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


#18

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?


#19

Something like

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

man ln is your friend.


#20

no, you are!! Thank you.