-
Notifications
You must be signed in to change notification settings - Fork 103
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
switch to Configurations to support better @plugin macro and template serailization in TOML #254
Conversation
Codecov Report
@@ Coverage Diff @@
## master #254 +/- ##
==========================================
- Coverage 82.18% 82.01% -0.18%
==========================================
Files 19 18 -1
Lines 612 606 -6
==========================================
- Hits 503 497 -6
Misses 109 109
Continue to review full report at Codecov.
|
I'll add some more tests if people like this PR. |
Holy cow, this is awesome. It'll take me a long time to review this but I definitely support the idea. |
cool, I'll fix a few issues left first then:
I think I can I assume the rest part should be covered by current test, but I could be wrong. |
I realize we need to have JuliaLang/TOML.jl#13 fixed to be able to disable and use the default field of specified plugins. So don't merge this until that issue is fixed. |
TBH I have no idea why the I've fixed the TOML.jl issue above myself too (so I mark the test here as broken for now, and we could just change it back to julia> mock(PT.version_of => _p -> v"1.2.3") do _i
with_pkg(t) do pkg
pkg_dir = abspath(expanduser(joinpath(t.dir, pkg)))
LibGit2.with(GitRepo(pkg_dir)) do repo
commit = GitCommit(repo, "HEAD")
@test occursin("PkgTemplates version: 1.2.3", LibGit2.message(commit))
end
end
end
[ Info: Running prehooks
[ Info: Running hooks |
Setting myself a reminder to review this weekend. |
Sorry I've let this slip again. @nickrobinson251 any chance someone from Invenia would like to review? A big change in internals like this might be a good time for maintainership to pass over more formally to current Invenians. |
Sure! I'll bring it up this week to see who'd be interested :) fyi @nick-thiessen and @omus |
At the moment no one is free to review this, but in the next couple weeks someone might become available and possibly be available to take over maintainership. I'll have to have some conversations about who is interested. |
Currently trying to clean up the repo a little. Is this PR still relevant @Roger-luo? |
Not anymore I've implemented this in rust |
My question was badly phrased, I was rather wondering whether it could be brought up to speed with the latest changes to the package? |
I mean I don't even use this package anymore... I have no motivation to keep working on this PR, at least for myself, my own CLI tool is much easier to use than this package. https://discourse.julialang.org/t/ann-the-ion-command-line-for-julia-developers-written-in-rust/94495 |
Okay thanks. Still, I might revisit your ideas and try to switch to a better serialization at some point! |
This PR removes
Parameters
and useConfigurations
instead, since I think the goal of Configurations fits better for the PkgTemplate use case, and there is not much user interface change, all the old interfaces are the same including@plugin
macro.But you don't need to import
@with_kw_noshow
anymore, only use@plugin
is sufficient since you can select your own code generators in Configurations. I think It makes the implementation ofPlugin
simpler and better and reduces the maintenance pressure of this package since I'm also going to help Pluto and Comonicon to switch to this configuration package - most of the code in Pluto, Comonicon's configuration structs and PkgTemplates' Plugin are actually similar. So I think this brings a much simpler implementation ofPlugin
.A glance at some new features automatically (or by slightly overloading some interfaces of
Configurations
) enabled by using ConfigurationsColor, Compact, Copy Pastable Printing
I think currently it is a bit painful to read when all the fields are printed no matter it's just default value or not, now default values are automatically hidden and colors are used to help distinguish between kwargs, Plugin types and values. And you cannot copy pasta the printings back to REPL - this is also not convenient for sharing.
Before
After
Serialization to TOML files and potentially many other formats
now you can use
Configurations.to_toml
function to convert your templates to a TOML file easily. This makes sharing templates and modifying templates a lot easier and flexible. Also make things easier to read.can you can read a template from a TOML file by
Configurations.from_toml
since you can also convert a
Template
toOrderedDict
usingto_dict
, it can be serialized to other format you like as well!