On this page:
6.5.1 Declaring Build-Time Dependencies
6.5.2 How Dependency Checking Works

6.5 Package Dependency Checking

When raco setup is run with no arguments,Unless --check-pkg-deps is specified, dependency checking is disabled if any collection is specified for raco setup. after building all collections and documentation, raco setup checks package dependencies. Specifically, it inspects compiled files and documentation to check that references across package boundaries are reflected by dependency declarations in each package-level "info.rkt" file (see Package Metadata).

Dependency checking in raco setup is intended as an aid to package developers to help them declare dependencies correctly. The raco setup process itself does not depend on package dependency declarations. Similarly, a package with a missing dependency declaration may install successfully for other users, as long as they happen to have the dependencies installed already. A missing dependency creates trouble for others who install a package without having the dependency installed already.

Practically every package depends on the "base" package, which includes the collections that are in a minimal variant of Racket. Declaring a dependency on "base" may seem unnecessary, since its collections are always installed. In a future version of Racket, however, the minimal collections may change, and the new set of minimal collections will then have a package name, such as "base2". Declaring a dependency on "base" ensures forward compatibility, and raco setup complains if the declaration is missing.

To accommodate the early stages of package development, missing dependencies are not treated as an error for a package that has no dependency declarations.

6.5.1 Declaring Build-Time Dependencies

A build-time dependency is one that is not present in a package if it is converted to a binary package (see Source, Binary, and Built Packages). For example, "tests" and "scribblings" directories are stripped away in a binary package by default, so cross-package references from directories with those names are treated as build dependencies. Similarly, test and doc submodules are stripped away, so references within those submodules create build dependencies.

Build-time-only dependencies can be listed as build-deps instead of deps in a package’s "info.rkt" file. Dependencies listed in deps, meanwhile, are treated as both run-time and build-time dependencies. The advantage of using build-deps, instead of listing all dependencies in deps, is that a binary version of the package can install with fewer dependencies.

6.5.2 How Dependency Checking Works

Dependency checking uses ".zo" files, associated ".dep" files (see Dependency Files), and the documentation index. Dynamic references, such as through dynamic-require, are not visible to the dependency checker; only dependencies via require, define-runtime-module-path-index, and other forms that cooperate with raco make are visible for dependency checking.

Dependency checking is sensitive to whether a dependency is needed only as a build-time dependency. If raco setup detects that a missing dependency could be added as a build-time dependency, it will suggest the addition, but raco setup will not suggest converting a normal dependency to a build-time dependency (since every normal dependency counts as a build-time dependency, too).