As a project grows, related functions become hard to manage as loose source files. A Julia package bundles code, resources, and metadata so the code can be reused, distributed, and versioned. Packages can depend on other packages. section 16.0 section 16.1.2
A package is not the same thing as a module. The package is the bundle that Julia locates and manages; its same-named module groups functions and types in a namespace. For example, `using Dates` finds the Dates package and loads its Dates module. section 16.1.2
shell> cd hobby/ ~/dev/hobby (hobby) pkg> generate ToyGeometry Generating project ToyGeometry: ToyGeometry/Project.toml ToyGeometry/src/ToyGeometry.jl
`generate ToyGeometry` creates a minimal package with `Project.toml` and `src/ToyGeometry.jl`. The package is also its own environment, so dependencies can be added to it rather than to a separate working environment. section 16.2.1
A practical development path is:
- Activate the package environment before adding its dependencies. `Project.toml` records package identity and direct dependencies; `Manifest.toml` records dependency details, including dependencies of dependencies. section 16.2.1
- Put related code in separate `src` files and call `include` inside the module definition to make those definitions part of the module. section 16.2.2
- In a working environment, use `dev` with the package directory while actively changing it. Unlike `add`, this makes local code changes available without an explicit package update. section 16.3
Load and call a local package
After `dev ./ToyGeometry` in the working environment, run `using ToyGeometry` and call `ToyGeometry.sphere_volume(4)`. Loading the package alone does not make every function available by an unqualified name: `sine(π/2)` fails until `sine` is exported, though `ToyGeometry.sine(π/2)` works. section 16.3
Adding a package to an environment makes it available to load; it does not itself load the functions and types into the REPL. Use `using` or `import` when you need them. The active environment also determines which installed version is loaded. section 16.1.1







