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

feat(config/toml): support jinja templates in toml files #33123

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jiaweikho
Copy link

Changes

  • Massage toml content before parsing by removing jinja delimiters according to the specification: jinja
  • Add removeTemplate option to the parseToml function
  • Add removeTemplate: true config to poetry and pep621 pyproject.toml parsers.

Context

This addresses the feature request raised in #33105 by applying a similar method in the yaml parser in #26682.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@jiaweikho jiaweikho changed the title feat(config/toml) Support jinja templates in toml files feat(config/toml) support jinja templates in toml files Dec 15, 2024
@jiaweikho jiaweikho force-pushed the feat/toml-template-support branch from fa5430b to 0099a48 Compare December 15, 2024 15:52
@jiaweikho jiaweikho changed the title feat(config/toml) support jinja templates in toml files feat(config/toml): support jinja templates in toml files Dec 15, 2024
lib/util/toml.ts Outdated Show resolved Hide resolved
lib/util/toml.ts Outdated Show resolved Hide resolved
jiaweikho and others added 2 commits December 16, 2024 00:44
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
@jiaweikho
Copy link
Author

@viceice thanks for the review. I haven't documented this new functionality yet. Do you think I should add a note in the poetry/pep621 docs about jinja templates?

@jiaweikho
Copy link
Author

@viceice I've added tests for the pep621 and poetry managers based on the CI coverage feedback. I've tried my best to follow the precedent but the style of extract.spec.ts in pep621 and poetry are quite different so you may notice some style differences between them.

@jiaweikho jiaweikho requested a review from viceice December 16, 2024 10:46
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inline the fixtures as part of the tests

@jiaweikho jiaweikho requested a review from rarkins December 17, 2024 21:12
@jiaweikho
Copy link
Author

Hi @viceice @rarkins, is there anything else you would like me to do before this PR can be merged?

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're currently not merging features because all maintainer are in Christmas holiday and we don't want to break anything now.

@viceice viceice self-requested a review December 23, 2024 12:18
@jiaweikho
Copy link
Author

we're currently not merging features because all maintainer are in Christmas holiday and we don't want to break anything now.

Thanks for letting me know. Have a wonderful holiday!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants