Although the functionality of 2.x is quite similar to 1.0, there are some minor differences. When transitioning from using 1.0 to 2.x, expect having to change a few lines in your templates and YAML config file.
This document describes the differences between the last Python-based version (1.0) and the first Rust-based version (2.0). Further changes for 2.1 etc. will be documented in CHANGELOG.md and in the release notes.
The primary difference is, of course, that scg version 2.x is written in Rust instead of Python. This should reduce execution times significantly. Furthermore, scg 2.x uses Rust's MiniJinja templating engine instead of Python's Jinja2.
MiniJinja is based on the Jinja2 engine and supports a range of features from Jinja2, but there are differences and you may experience that some filters and expressions no longer work. If you experience this, then please let me know and we can either find a work-around or we can implement custom filters or custom functions to solve the issue. An overview of the differences between MiniJinja and Jinja2 is available here
- Reverting config files with
scg reverthas been removed since it is no longer in use by anyone. - The command line argument
--no-verifyhas been removed. It can easily be re-added if anyone needs it. - The diffing method (
scg diff) has not yet been reimplemented in 2.0. It is scheduled to be added in the next feature release.
- The expression
now() 'local', 'format-string'has been replaced with a custom functionnow()which takes an optional strftime string as argument. The new function will always use local time. - The keyword
gitcommitis no longer an expression but a global variable. It inserts the short-form of the hash instead of the long-form. - If both
includeandexcludeare provided for a template layout entry, then only items that are included and not excluded will be iterated over. Previously theexcludeoption was ignored ifincludewas provided. - SCG version 1 used YAML spec 1.1, which provided multiple ways to specify boolean
values (
true/yes/on,false/no/off). SCG 2.x uses the YAML spec 1.2, which requires the use oftrueandfalse.
- Trailing newlines can be somewhat
frustrating both with Jinja2 and MiniJinja. The new config option
adjustspacingtries to solve this. Set it totrueto force scg to leave exactly one blank line after the last non-whitespace character in each template. Newlines at the beginning of the templates are not affected. - The global variable
gitcommitlonghas been added. It does the same as thegitcommitexpression in 1.0.
- Remove the keys
masterpathandmasterkey. - Ensure that
verifycontentis eithertrueorfalse(notyesorno,onoroff).
- Replace
{% gitcommit %}with{{ gitcommitlong }}or alternatively{{ gitcommit }} - Replace
{% now 'local', '%a %d %b %Y %H:%M:%S' %}with{{ now("%a %d %b %Y %H:%M:%S") }}or simply{{ now() }}.