Synopsis

• Usage:
needsPackage PackageName
• Inputs:
• PackageName, , the name of the package
• Optional inputs:
• FileName => , default value null, the name of the file containing the source code of the package, from which it should be loaded
• LoadDocumentation => , default value false, whether to load the documentation of the package, too; see beginDocumentation
• DebuggingMode => , default value null, the value of the variable debuggingMode during loading the package; specifying it here overrides the value specified as an option to newPackage by the package itself
• Configuration => a list, default value {}, the entries are options KEY => VALUE overriding the defaults specified in the source code of the package and the (possibly updated) values in the file in the user's application directory.
• Reload => , default value null, whether to reload the package, if it has been loaded from a different source before
• Outputs:
• , the package requested
• Consequences:
• loads the package PackageName by loading the file PackageName.m2 which should appear in one of the directories occurring in the list path, unless it has already been loaded, in which case it ensures that the package's dictionary of exported symbols occurs in dictionaryPath and are thus available to the user. In addition, the function needsPackage is applied to each of the packages whose names are specified by the newPackage(...,PackageExports=>...) option for the requested package. If the variable notify is set to true, then an informational message is displayed after the file is loaded.

Description

For example, to load the sample package FirstPackage:

 i1 : notify = true o1 = true i2 : needsPackage "FirstPackage" -- loading FirstPackage.m2 -- opening database /usr/lib/Macaulay2/FirstPackage/cache/rawdocumentation-dcba-8.db -- beginDocumentation: using documentation database, skipping the rest of /usr/share/Macaulay2/FirstPackage.m2 -- package "FirstPackage" loaded -- loaded /usr/share/Macaulay2/FirstPackage.m2 o2 = FirstPackage o2 : Package i3 : needsPackage "FirstPackage" o3 = FirstPackage o3 : Package

The second time the package was not reloaded.

Ways to use needsPackage :

• "needsPackage(String)"

For the programmer

The object needsPackage is .