Generate Package and Test

In have a question about package generation. Why does generate not also automatically generate the test folder as well as the necessary Project.toml and empty runtests.jl file ?
I find it sometimes not trivial to add a test folder/environment after having generated a package. Or is generate not the most standard/recommended way to generate a package, to the favor of PkgTemplates ?

Indeed, yes. Pkg.generate is designed to create a minimal package. This is useful in many contexts, but not for “public” projects that go on GitHub and will be registered. Those should follow additional “best practices”, and should be set up with more dedicated tools like PkgTemplates.

Apart from PkgTemplates.jl mentioned above, there are also following tools to generate packages with bells and whistles:

  • PackageMager.jl (mostly a GUI for PkgTemplates.jl)
  • PkgSkeleton.jl (an opinionated minimalistic tool)
  • BestieTemplate.jl (allows also for modifying existing packages)
5 Likes

For completeness, an example where a minimal Pkg.generate is exactly what you want: Fail more gracefully when precompiling huge data · Issue #59835 · JuliaLang/julia · GitHub

1 Like

Since we’re throwing all the options out there, I have one as well: GitHub - goerz/cookiecutter-juliapackage: Cookiecutter Template for Julia Projects

Obviously, aimed at my particular preferences. That’s something I might encourage people to do in any case: take ownership of your templates; invest some time in understanding what you want, and why something should be set up a particular way. A lot of the existing solutions end up having opinions that I find questionable, and then I end up spending significant time “cleaning up” whatever they generated.

1 Like