next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > packages > creating a package > newPackage(String)

newPackage(String) -- package item: start a new 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 : 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
                 OptionalComponentsPresent => true
                 PackageExports => {}
                 PackageImports => {}
                 Reload => false
                 UseCachedExampleOutput => false
                 Version => 1.1

o3 : OptionTable
i4 : oo.Headline

o4 = making Foo
i5 : (options Core).Version

o5 = 1.13

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