Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added package template #15

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

*Note*: We try to adhere to these practices as of version [v1.1.0].

## Version [1.3.0] - 2024-06-27

### Added

- Adds support for `pkg_template` function that can be used to generate a `PkgTemplates.Template` for a Taija package. [#15]
## Version [1.2.3] - 2024-09-09

### Removed
Expand Down
3 changes: 2 additions & 1 deletion src/TaijaBase.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module TaijaBase

export AbstractParallelizer
export AbstractParallelizer, pkg_template

include("parallelization/base.jl")
include("deprecated.jl")
include("template/template.jl")

end
2 changes: 1 addition & 1 deletion src/parallelization/base.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"An abstract type for parallelizers. This type is owned by the `TaijaBase` module to allow shipping it to packages that depend on `TaijaBase`, without having to depend on the `TaijaParallel` module. See also [`parallelize`](@ref) for a detailed explanation."
abstract type AbstractParallelizer end

include("functions.jl")
include("functions.jl")
52 changes: 52 additions & 0 deletions src/template/template.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using PkgTemplates: PkgTemplates, @with_kw_noshow, @plugin, Plugin, default_file, Template, pkg_name, render_file, combined_view, tags, gen_file
const TAIJA_TEMPLATE_DIR = Ref{String}(joinpath(dirname(dirname(pathof(TaijaBase))), "templates"))

"""
pkg_template(; user::String, authors::String, dir::String="~")

Create a new package template with the following plugins:

- `BlueStyleBadge`
- `Citation`
- `Codecov`
- `Documenter{GitHubActions}`
- `Develop`
- `Formatter(style="blue")`
- `License`
- `PkgBenchmark`
- `RegisterAction`

# Arguments

- `authors::String`: The authors of the package.
- `dir::String`: The directory where the package will be created. Default is `~`.

# Example

```julia
pkg_template(authors="Jane Doe", dir="~/Documents")
```

"""
function pkg_template(; authors::String, dir::String="~")
@eval begin
using PkgTemplates
Template(;
user="JuliaTrustworthyAI",
dir=$dir,
authors=$authors,
julia=v"1.10",
plugins=[
BlueStyleBadge(),
Citation(),
Codecov(file=joinpath(TAIJA_TEMPLATE_DIR[], ".codecov.yml")),
Documenter{GitHubActions}(make_jl=Quarto().make_jl),
Formatter(style="blue"),
License(),
Quarto(),
RegisterAction(),
Tests(aqua=true)
]
)
end
end
6 changes: 6 additions & 0 deletions templates/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 90% # the required coverage value
threshold: 0.5% # the leniency in hitting the target
25 changes: 25 additions & 0 deletions templates/README.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
format:
commonmark:
variant: -raw_html+tex_math_dollars
wrap: none
mermaid-format: png
crossref:
fig-prefix: Figure
tbl-prefix: Table
output: asis
---

# {{{PKG}}}{{#HAS_INLINE_BADGES}} {{#BADGES}}{{{.}}} {{/BADGES}}{{/HAS_INLINE_BADGES}}
{{^HAS_INLINE_BADGES}}

{{#BADGES}}
{{{.}}}
{{/BADGES}}
{{/HAS_INLINE_BADGES}}
{{#HAS_CITATION}}

## Citing

See [`CITATION.bib`](CITATION.bib) for the relevant reference(s).
{{/HAS_CITATION}}
13 changes: 13 additions & 0 deletions templates/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
project:
title: "{{{PKG}}}.jl"
execute-dir: project
crossref:
fig-prefix: Figure
tbl-prefix: Table
resource-path:
- docs/src/assets
format:
commonmark:
variant: -raw_html+tex_math_dollars
wrap: preserve
mermaid-format: png
14 changes: 14 additions & 0 deletions templates/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```@meta
CurrentModule = {{{PKG}}}
```

# {{{PKG}}}

Documentation for [{{{PKG}}}](https://{{{REPO}}}).

```@index
```

```@autodocs
Modules = [{{{PKG}}}]
```
7 changes: 7 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8"
Distributions = "0.25"
Flux = "0.13, 0.14"
MLDataUtils = "0.5"
MLJBase = "1.5"
Optimisers = "0.3"
Plots = "1.40"
RDatasets = "0.7"
julia = "1.6, 1.10"
9 changes: 9 additions & 0 deletions test/template.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using PkgTemplates

@testset "Template" begin

dir = tempdir()
t = TaijaBase.pkg_template(authors="Jane Doe", dir=dir)
@test typeof(t) == PkgTemplates.Template

end
Loading