Dynamical systems in Julia
Thanks to https://attractivechaos.wordpress.com/2018/09/26/creating-a-new-package-in-julia/
Creating a new package
julia> cd("$(homedir())/github/Julia")
(v1.0) pkg> generate Foo
julia> mv("Foo", "Foo.jl");
julia> cd("Foo.jl")
(v1.0) pkg> activate .
Deploying it locally
(v1.0) pkg> dev .
Modifyin the startup file?
push!(LOAD_PATH, "$(homedir())/github/Julia")
Using a local package
julia> cd("$(homedir())/github/Julia/Foo.jl")
(v1.0) pkg> activate .
(Foo) pkg> add homedir()/github/Julia/Bar.jl
or, if the package is developed in parallel,
(Foo) pkg> dev homedir()/github/Julia/Bar.jl
Resolving package vesions...
Updating `~/github/Julia/Foo.jl/Project.toml`
[abcdabcd] + Bar.jl v0.1.0 [`~/github/Julia/Bar.jl`]
Updating `~/github/Julia/Foo.jl/Manifest.toml`
[abcdabcd] + Bar.jl v0.1.0 [`~/github/Julia/Bar.jl`]
Using Revise.jl
Thanks to https://medium.com/@Jernfrost/my-new-workflow-with-julia-1-0-99711103d97c
(v1.0) pkg> add Revise
julia> using Revise
julia> cd("$(homedir())/github/Julia/Foo.jl")
(v1.0) pkg> activate .
(Foo) pkg>
The reason to load Revise.jl while still in the global environment is that you do not want to add dependencies to your Foo package that are just needed for development.
Setting it up with github
We create a new repository on github, using …
Then we associate it with our own repository…
shell> cd $HOME/github/Julia/Foo.jl
shell> git init
shell> echo /Manifest.toml >> .gitignore
shell> git remote add origin git@github.com:muskulus/Foo.jl.git
shell> push -u origin master
Installation
After pushing the package to github, others can install it with
(v1.0) pkg> add https://github.com/muskulus/Foo.jl
It cannot be installed with the package name only, since it is not in Julia’s central registry yet.
Providing a custom registry
This requires at least Julia 1.1.
Thanks to https://discourse.julialang.org/t/creating-a-registry/12094
Let us create a custom registry for all our Julia projects:
shell> cd $HOME/github/Julia
shell> mkdir JuliaRegistry
shell> cd JuliaRegistry
shell> git init
Create the follow folders and directories…
(v1.0) pkg> registry add https://github.com/muskulus/JuliaRegistries/General
Cloning registry from "https://github.com/muskulus/JuliaRegistries/General"
Added registry `General` to `~/.julia/registries/General`