liveBook · Manning

Project.toml

As explained in Julia as a Second Language

Project.toml is a Julia project metadata file that defines an environment's package identity, dependencies, and related metadata.

Need different package versions for work and hobby projects? Give each project its own Julia environment. Its Project.toml records the packages added directly to that environment; Julia creates the file when needed. A package is also an environment, so it has its own Project.toml for identity and dependencies. section 16.1 section 16.2.1

Use Julia’s package mode to manage the active project:

  • Run `activate` for the environment you want to change, then `add` packages or `rm` ones you no longer need. section 16.1 section 16.6
  • Run `status` to see its added packages. Under `[deps]`, Project.toml associates each package name with a UUID, which distinguishes packages that share a name. section 16.1
  • Run `generate` to start a package. Its initial Project.toml contains a name, UUID, authors, and version; activate the package before adding its dependencies. section 16.2.1
shell> cat ToyGeometry/Project.toml
name = "ToyGeometry"
uuid = "bbcec4ee-a196-4f18-8a9a-486bb424b745"
authors = ["Erik Engheim <erik.engheim@mac.com>"]
version = "0.1.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

Inspect a generated package’s Project.toml: package metadata appears above `[deps]`, where Base64 and Dates are listed by UUID. section 16.2.1

Separate work and hobby environments

One environment can add `CairoMakie@0.5.10` for work while another adds a newer CairoMakie for hobby use. Activate the intended environment before adding packages, and use `status` to check what it contains. section 16.1

Do not confuse Project.toml with Manifest.toml: Project.toml shows direct dependencies, while Manifest.toml also records dependencies brought in by those packages. section 16.2.1 section 16.6

How Julia as a Second Language covers it

How deep it goes
Works through creation, inspection, and updates via package commands, while leaving transitive dependency records to Manifest.toml.
Examples
Uses separate CairoMakie environments and a generated package whose Project.toml lists Base64 and Dates.
What it assumes
Assumes access to Julia’s package mode but demonstrates environment activation and package creation.
What you can do after
Operate/configure it with Julia’s package-mode `activate`, `add`, `rm`, and `status` commands.
How it connects
Connects Julia environments, package management, UUIDs, and Manifest.toml.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Julia as a Second Language. The section links point to the parts of the book it draws on.