towncrier
towncrier copied to clipboard
Constraint PIP Dependencies Version Range for Towncrier Compatibility
Description
The pip version on my machine is '2.11.3'. When I use pip install towncrier
to install the program, there are no errors during the process. This is because towncrier depends on any version of pip, but this is problematic.
When I use the build
command, the following exception is thrown:
Warning: In a future version of Poetry, PyPI will be disabled automatically if at least one custom source is configured with another priority than 'explicit'. In order to avoid a breaking change and make your pyproject.toml forward compatible, add PyPI explicitly via 'poetry source add pypi'. By the way, this has the advantage that you can set the priority of PyPI as with any other source.
Loading template...
Finding news fragments...
Rendering news fragments...
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
...
...
jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got '+'
Reproduction
pip install jinja2=="2.11.3"
pip install markupsafe=="2.0.1"
towncrier build --draft --yes --version=1.0.0
Solution
Upgrade the version of jinja2 to 3.*
pip install jinja2 --upgrade
Should the version range of pip be constrained?
https://github.com/twisted/towncrier/blob/57f203651a080c2a91a3cf9b0e47eb6fca42128b/pyproject.toml#L35
Thanks for the report.
Can you please create a PR in which we have "jinja2>=3" ?
In theory, as long as you have a custom template, towncrier might also work with Jinja v2.
So there is also the option of fixing the default template to work with Jinja v2.