package

package , a built-in Tcl command, provides facilities for extending loading new commands into a Tcl interpreter.

Synopsis

package forget ?package package ...?
package ifneeded package version ?script?
package names
package present ?-exact? package ?version?
package provide package ?version?
package require ?-exact? package ?version?
package unknown ?command?
package vcompare version1 version2
package versions package
package vsatisfies version1 version2

Documentation

official reference

See Also

Magic names
User Guide
Developer Guide
extension
pkg_mkIndex
(deprecated)
pkg_mkIndex pitfalls
Using Tk as a loadable package
Where does the package command find the packages it seeks?
package management
Tcl syntax
Fulfilling the Promise of package unknown, by DGP
A presentation given at the Eighth Annual Tcl/Tk Conference
package , by dgp
A drop-in replacement for package that adds a maxVersion feature and the additional subcommands index, mkdepend, and prerequisites. Also renames vcompare to compare and vsatisfies to satisfies.

pkgIndex.tcl

DGP, PYK: The man page for pkg_mkIndex covers the basics in the HOW IT WORKS section. For now pkgIndex.tcl is the primary way to make Tcl aware of packages, but stay tuned for better ideas. We don't want to be chained to pkgIndex.tcl files forever.

See also pkg_mkIndex pitfalls.

Development

dgp, Tcl Chatroom, 2014-10-07, made the following comments regarding improvements to package or a similar facility for Tcl:

Ought to install per-namespace. Ought to fallback from, instead of die on errors. Ought to enforce namespace containment. Might need to have some kind of manifest facility. Ought to define an installation procedure. If it must make that customizable, then customizing finding and installing must be done together. Should continue to support multiple versions installed in parallel. Should support simultaneous install of different versions into different namespaces.
Gathering packages' ifneeded scripts
A proposal to implement a cache to improve performance.