feat: add dynamic file structures in loop using yield-tag#1855
feat: add dynamic file structures in loop using yield-tag#1855yajo merged 14 commits intocopier-org:masterfrom
Conversation
… extention for yield tag, allow _render_path to generate mulitple paths and contexts when yield tag is used
… test file to test dynamic file structure feature
|
hopefully closes #1271 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1855 +/- ##
==========================================
+ Coverage 97.77% 97.85% +0.07%
==========================================
Files 49 51 +2
Lines 5261 5404 +143
==========================================
+ Hits 5144 5288 +144
+ Misses 117 116 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I only reviewed tests in depth so far, and it seems the interface is almost exactly what I meant! Awesome! Quoting from #1271 (comment):
That seems to be the only missing part. At least I saw no test for that. Could you add this please? When done I'll review the implementation. This PR is big! Thank you very much 😊 |
…d YieldTagInFileError and raise it if yield tag used when rendering file content. also add the test case
|
Thank you for your review! I've added a new commit that implements the behavior you mentioned - throwing an exception when yield is used for rendering file contents. I've also added the corresponding test case. Looking forward to your implementation review! |
… is unnecessary if there's a docstring
yajo
left a comment
There was a problem hiding this comment.
Finally, the first code review is here!
Apart from what's mentioned, I also miss the documentation.
Thank you!
…ntext with yield_name and yield_iterable attributes in YieldEnvironment and YieldExtension
…or check to _render_file method to enforce yield tag restrictions during file rendering
…r of parameters in _yield_support method for consistency and clarity
…ng over lists to generate files and directories
|
@yajo I have added a few commits:
And in the last commit, I added documentation. Specifically, three points:
This is my first time adding documentation, so I'm not sure if it meets your expectations. |
yajo
left a comment
There was a problem hiding this comment.
Implementation looks very good, thanks!
Please review a couple of suggestions for the docs, so we can merge.
@copier-org/maintainers this is an important feature, would you like to add your reviews?
|
I'll try to give feedback later today. |
pawamoy
left a comment
There was a problem hiding this comment.
A few suggestions, nothing critical, looking good 🙂
…r for handling multiple yield tags, with some test cases
yajo
left a comment
There was a problem hiding this comment.
This mostly LGTM, just a couple of minor comments. Thanks!
…ctor in YieldExtension class
|
Hi, any idea when this is gonna be released in the main version, seems like it's only on master. |
|
Copier doesn't have a schedule for releases, new releases are made when yajo finds the time to do so, and believes the time is right, mostly 🤷 A better question would be "Are there any blockers I could help with before a new release is published?" 🙏 😊 |
|
Sorry for the delay, I've been so busy lately... I'll release when I have time, but you can install from master too in the mean time |
What I did:
copier/jinja_ext.pyto handleyieldtagsyieldtags and sets up the necessary context throughjinja_env_render_pathto return multiple destination paths and their corresponding contexts whenyieldtags are presentyieldtags to the_render_partsfunctionextra_contextparameter to_render_fileto enable injection of contexts generated fromyieldtags