Julia Packages & Modules
Learn how to use and create Julia packages.
Using Packages
# Enter package mode by pressing ]
pkg> add Plots # Install a package
# Back in Julia mode
using Plots
plot(sin, 0, 2π)
Creating Modules
# In MyModule.jl
module MyModule
export greet
function greet(name)
println("Hello, $name!")
end
end # module
# Using the module
using .MyModule
greet("Julia")
Creating Packages
# Generate new package
pkg> generate MyPackage
# Add dependencies
cd("MyPackage")
pkg> activate .
pkg> add JSON
# Develop mode (for local development)
pkg> dev MyPackage
Useful Packages
- Plots.jl: Visualization
- DataFrames.jl: Tabular data
- CSV.jl: Reading CSV files
- Flux.jl: Machine learning
- DifferentialEquations.jl: Solving differential equations