Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and context:
Similar to #38, realized I was going to copy/paste something in, so opted for Nengo Bones instead.
In the case of a project's version number, there are actually several other places where we end up using this information, (usually files that we're already templating) so by adding version information to the top-level config dictionary we can simplify several places that used to import the
version.py
module.However, that's created a bit of spiral in that now we have to add version information to all our tests and docs. I did it for the tests, but before I work on this further, I wanted to get some feedback on this PR.
One thing is that I opted for the user to fully specify the semantic version like so:
This is the most verbose and (perhaps?) least error-prone way to edit the file. I thought it would be easiest for the underlying implementation too, but it turns out we use the full version string (
"v3.2.1.dev0"
in the case above) several times, so I kind of hacked it an auto-generatedversion.full
key in as a convenience.Another option would instead be to do something like
This is more flexible, but (possibly?) more error prone to edit, especially since you have to know that the
.dev0
string is what differentiates a release version from a non-release version. The reason why I didn't do this initially is that I didn't want to copy some annoying code to split up this string into its component parts, but that was before I auto-generatedversion.full
; we could do the same auto-generating to isolate the major, minor, patch, release as well.It should be noted that this is the only real place where we do that kind of auto-generating though, so we should probably also consider whether that's something we want to do, or if we should be doing something different like exposing Jinja2 macros or filter functions instead.
Finally, another issue is that we had already used the
version
name in templates. This referred to the version of Nengo bones, so I changed that tobones_version
, which I think we should do regardless. However, we could also consider changing this key fromversion
toproject_version
or something like that to make it explicit both ways.Interactions with other PRs:
Based on #38, could be made independent if people prefer.
How has this been tested?
Modified tests and used it to generate files in Nengo Bones.
How long should this take to review?
Where should a reviewer start?
Probably the new
.nengobones.yml
, andversion.py
/version.py.template
.Types of changes:
Checklist:
Still to do:
.nengobones.yml
files easier