[racket-dev] package scopes

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jul 26 16:56:49 EDT 2013

At Thu, 25 Jul 2013 11:59:04 -0600, Matthew Flatt wrote:
> I think we should change to two:
>  * 'installation --- like now
>  * 'user --- specific to a user and "installation", but where
>     installations are identified by a configurable name (as opposed to,
>     say, the installation's path)

I think this works well. Furthermore, the installation name is now
used in place of the version number for may user-specific paths, such
as the user's "collects" directory (all of which are in the add-on

You can set an installation's name with

   raco pkg config --set name <name>

Possibly, `raco pkg config' should be `raco config' and cover more of
the things that can be set in "config.rktd".

> For a snapshot, the name defaults to "snapshot" --- which means that
> when you throw away your snapshot and install a new one, then you
> keep your package installations.

The default name for an installation in a snapshot build is now
"snapshot". The generated "README.txt" explains the name configuration
and its implications.

> For a repository checkout, the name defaults to "checkout"
> --- which means that you keep your package installations when you `git
> pull' and the version changes.

I used the name "development" instead of "checkout". While I think that
changing the installation name is an improvement --- it avoids creating
so many directories in your space with development version numbers ---
it's not quite enough for managing packages.

For managing packages, I've gone back to the old plan: in addition to
setting the name to "development", the default package scope is set to
`installation'. (The installation name and default package scope are
set only if there's no "config.rktd" in place already, so it's easy to
change or preempt those settings.)

To see what will happen from now on, delete


before your next `make', so that you get the "development" installation
name and the `installation' default package scope.

To recap, the goal is for package installations to be treated in the
simplest and most natural way by default, depending on how you install

 * If you install a release, then you get separate package
   installations for each release --- because each release's
   installation name is the version number, and the installation's
   default package scope is `user'.

   So, you can install a new Racket version and not worry about
   trashing your existing installation or having the existing
   installation pollute the new one. At the same time, installing a
   package does not require permission to write to the Racket

 * If you install a snapshot, then it shares package installations with
   all previous snapshots --- because the installation name is always
   "snapshot", and the installation's default package scope is `user'.

   So, you can throw away your old snapshot and drop a new one in place
   to upgrade without having to use a migration tool or reselect all
   the packages that you care about.

 * If you build from the git repository, then package installations
   stick with the build --- because the default package scope is

   So, it's easy to throw away a checkout, and different checkouts tend
   not interfere with each other.

Finally, besides trying to get the default scope and installation name
right, I've added `raco pkg migrate' and a corresponding panel in the
GUI package manager. Use the migration tool in a new installation to
install packages that were previous installed with "user" package scope
in an old installation.

The GUI package manager is available as an executable via the
"gui-pkg-manager" package (which is currently not included in
"main-distribution", since DrRacket already provides the same GUI). I'm
hoping that someone will feel inspired to create an icon for it.

Posted on the dev mailing list.