PkgTemplates
PkgTemplates is a Julia package for creating new Julia packages in an easy, repeatable, and customizable way.
Installation
pkg> add PkgTemplates
Plugins
PkgTemplates
is based on plugins which handle the setup of individual package components. The available plugins are:
- Continuous Integration (CI)
- Code Coverage
- Documentation
- Citation
Usage
Assuming you have the relatively standard Git options user.name
, user.email
and github.user
set up globally with git config --global
, the simplest template requires no arguments:
julia> using PkgTemplates
ERROR: ArgumentError: Package PkgTemplates not found in current path:
- Run `import Pkg; Pkg.add("PkgTemplates")` to install the PkgTemplates package.
julia> t = Template()
ERROR: UndefVarError: Template not defined
julia> generate("MyPkg", t)
ERROR: UndefVarError: generate not defined
julia> run(`git -C $(joinpath(t.dir, "MyPkg")) ls-files`);
ERROR: UndefVarError: t not defined
However, we can also configure a number of keyword arguments to Template
:
julia> using PkgTemplates
ERROR: ArgumentError: Package PkgTemplates not found in current path:
- Run `import Pkg; Pkg.add("PkgTemplates")` to install the PkgTemplates package.
julia> t = Template(;
user="myusername",
license="MIT",
authors=["Chris de Graaf", "Invenia Technical Computing Corporation"],
dir="~/code",
julia_version=v"0.7",
ssh=true,
plugins=[
TravisCI(),
Codecov(),
Coveralls(),
AppVeyor(),
GitHubPages(),
CirrusCI(),
],
)
ERROR: UndefVarError: TravisCI not defined
julia> generate("MyPkg2", t)
ERROR: UndefVarError: generate not defined
julia> run(`git -C $(joinpath(t.dir, "MyPkg2")) ls-files`);
ERROR: UndefVarError: t not defined
If that looks like a lot of work, you can also create templates interactively with interactive_template
:
And if that's still too much work for you, you can call interactive_template
with fast=true
to use default values for everything but username and plugin selection.
You can also use generate_interactive
to interactively generate a template and then immediately use it to create a new package.
Comparison to PkgDev
PkgTemplates
is similar in functionality to PkgDev
's generate
function. However, PkgTemplates
offers more customizability in templates and more extensibility via plugins. For the package registration and release management features that PkgTemplates
doesn't include, you are encouraged to use AttoBot instead.
Contributing
It's extremely easy to extend PkgTemplates
with new plugins. To get started, check out the plugin development guide.