Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Dependencies in Stata ado-packages


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Dependencies in Stata ado-packages
Date   Tue, 19 Jun 2012 02:20:44 +0100

I don't think you can force -net install- to do this through its own syntax.

I suggest the following as some principles here. They may sound
obvious but I've found more than one recent example in which package
authors have been (what word to choose?) careless in following these
in practice.

1. Any user-written package that requires one or more other
user-written packages should document that dependence

1.1 in the package description

1.2 in the package help files

1.3 in the package user manual, Stata Journal or other journal paper,
or other write-up of the package if any exist.

2. Documentation of the fact of package-dependence should include

2.1 name of package

2.2 location of package (e.g. Stata Journal, SSC, author's own website)

2.3 references for package including author(s)' name(s), including
references to any documentation of form 1.3 or at least a location as
in 1.2.

3. Authors of user-written packages are naturally at liberty to
indicate how they prefer their own packages to be cited if used by
other authors.

4. Typically a program in a user-written package will fail if a
program it requires is not installed. A graceful way to do that is to
check that the appropriate file is visible to Stata and to issue an
explanation of the need for installation and how to do it. For
example,

qui findfile foobar.ado

if "`r(fn)'" == "" {
         di as txt "user-written package foobar needs to be installed first;"
         di as txt "use -ssc install foobar- to do that"
         exit 498
}

(Yes Virginia: there is a -foobar- package on SSC.)

Nick

P.S. I would not recommend copying the borrowed files to your own
package files, even with the authors' permission. This can lead to
more problems than it solves as and when the borrowed package is later
modified.

On Tue, Jun 19, 2012 at 12:39 AM, Brendan Halpin <brendan.halpin@ul.ie> wrote:

> Is there any mechanism for dealing with the situation where one
> user-written package depends on another?
>
> If no mechanism, is there a convention?
>
> More concretely: I have a package which uses mm_expand() from moremata.
> Is there a way of making -net install mypackage- check for the presence
> of moremata and install it if it is missing? If not, is there a standard
> way to bring it to the user's attention?
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index