Hi all,
There is an undocumented ado-file in ftools which I found quite useful for my own work, so I've spinned it off into its own package, so far named "require". I haven't submitted to SSC or released v1.0, so any feedback at this point would be really useful. This is how I use "require", and how I expect others might benefit from it:
1) At the beginning of do-files, to ensure whoever runs it (me on other computers, coauthors, etc.) have the correct versions of programs:
2) In my own packages, to ensure dependencies are met
In terms of extra features, there are three so far:
1) You can also auto-install the package if it doesn't exist:
2) You can also put all the dependencies in an external text file and then type:
3) "require" returns a few useful things such as the version, date, and version details (major, minor, patch) in "s()", which you can see with "sreturns list".
To install the package, you can run:
Any thoughts are more than welcome,
Sergio
PS: a preeemptive FAQ:
There is an undocumented ado-file in ftools which I found quite useful for my own work, so I've spinned it off into its own package, so far named "require". I haven't submitted to SSC or released v1.0, so any feedback at this point would be really useful. This is how I use "require", and how I expect others might benefit from it:
1) At the beginning of do-files, to ensure whoever runs it (me on other computers, coauthors, etc.) have the correct versions of programs:
Code:
clear all cls .. require rdrobust>=8 // at least version 8 require reghdfe>=6.0.1 // at least version 6.0.1 require tuples // no specific version, just that it's installed (so it's equivalent to "which tuples") ...
Code:
program reghdfe syntax ... require ftools>=2.47.0 ... end
In terms of extra features, there are three so far:
1) You can also auto-install the package if it doesn't exist:
Code:
require tuples, install // will install from SSC require gtools>=1.7.5, install from(https://raw.githubusercontent.com/mcaceresb/stata-gtools/master/build/) // install from a given URL, like "net install gtools, from()"
Code:
require using requirements.txt
3) "require" returns a few useful things such as the version, date, and version details (major, minor, patch) in "s()", which you can see with "sreturns list".
To install the package, you can run:
Code:
net install require, from("https://raw.githubusercontent.com/sergiocorreia/stata-require/master/src/")
Any thoughts are more than welcome,
Sergio
PS: a preeemptive FAQ:
- Does this work with the github package? --> I'm not that familiar with github.ado because some of the packages I use most (gtools, plus my own) don't work with it as their code is in the "src" or "build" subfolders.
- How does this detect version numbers? --> It searches the first string (starbang) and tries to make sense of the string. This is very heuristic because every author had its own best practices (and which changed with time). So far, it seems I'm able to pick up about two-thirds of the most common Stata packages (with a bias for newer packages), but that can definitely be improved
Comment