Package Development in Julia

  • Start out by developing as a simple set of files to be included, say “/home/henry/devel/MyCode.jl”
    • use by calling: julia> include(“/home/henry/devel/MyCode.jl”)
  • When ready to make it a real package
    • Create a git repo with the name of the package, e.g. “MyPkg”, in ‘~/.julia/dev’:
      • cd /home/henry/.julia/dev
      • julia> generate MyPkg
      • cd MyPkg
      • git init
      • git add -A
      • git commit -m’init’
    • Add it to the repo management
      • julia> ] develop /home/henry/.julia/dev/MyPkg
    • Add the files to that freshly made package
      • echo “module MyPkg” > /home/henry/.julia/dev/MyPkg/src/MyPkg.jl
      • cat /henry/devel/MyCode.jl >> /home/henry/.julia/dev/MyPkg/src/MyPkg.jl
      • echo “end” > /home/henry/.julia/dev/MyPkg/src/MyPkg.jl
    • Add dependencies
      • ] activate .
      • add LinearAlgebra
      • add …
      • restart julia
      • ] resolve
  • Now the package is available as
    • using MyPkg
  • When you are ready for sharing it with friends
    • create a (private) repo on github: MyPkg
    • git push –set-upstream git@github.com:vonDonnerstein/MyPkg.git master
  • other people can start using it
    • by clone-ing the repo to their ~/.julia/dev and
    • ] develop ~/.julia/dev/MyPkg


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *