next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc > The Macaulay2 language > creating a package > newPackage

newPackage -- the preamble of a package

Synopsis

Description

The dictionaries for the symbols in the packages loaded by the user are moved out of the way to avoid conflicts, so just the standard pre-loaded packages are visible to the source code of the package. In addition, the package SimpleDoc is made available. If functions from additional packages are needed by the code in the new package, then needsPackage can be used (after the use of newPackage) to provide them. If functions from additional packages are needed by the user who will load the new package, then needsPackage can be used (before the use of newPackage) to provide them.

i1 : newPackage("Foo",
         Version => "1.1",
         Headline => "making Foo",
         Configuration => { "foo" => 42, "bar" => "x" }
         )

o1 = Foo

o1 : Package
i2 : endPackage "Foo"

o2 = Foo

o2 : Package

The options can be recovered with options as follows.

i3 : opts = options Foo

o3 = OptionTable{Authors => {}                               }
                 AuxiliaryFiles => false
                 CacheExampleOutput => null
                 Certification => null
                 Configuration => {foo => 42, bar => x}
                 Date => null
                 DebuggingMode => false
                 Headline => making Foo
                 HomePage => null
                 InfoDirSection => Macaulay2 and its packages
                 Keywords => {Uncategorized}
                 OptionalComponentsPresent => true
                 PackageExports => {}
                 PackageImports => {}
                 Reload => false
                 UseCachedExampleOutput => false
                 Version => 1.1

o3 : OptionTable
i4 : opts.Headline

o4 = making Foo

Here is a template for a typical newPackage entry in a package.

newPackage("PackageName",
        Headline => "one line description",
        Version => "0.1",
        Date => "month XX, 20XX",
        Authors => {
            {Name => "author1", Email => "email1", HomePage => "url1"},
            {Name => "author2", Email => "email2", HomePage => "url2"}},
        DebuggingMode => false,
        HomePage => "http://univ.edu/~user/PackageName/",
        Configuration => {}
        )

See also

Ways to use newPackage :

For the programmer

The object newPackage is a method function with options.