You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The interpolation behavior of config files by bumpversion and setuptools is not the same. bumpversion uses no interpolation (e.g. configparser.RawConfigParser), but setuptools uses the default interpolation of configparser.ConfigParser, which is "basic interpolation".
In general, this should not be an issue, but because bumpversion supports setting configuration in the setup.cfg file, options that might be interpolated by the parser would not cause an issue if they appear in the .bumpversion.cfg, but suddenly break the install/build process if they are moved to the setup.cfg.
For example, I had the following in my .bumpversion.cfg to automatically insert the date in my CHANGELOG along with the version.
[bumpversion:file:docs/source/changelog.rst]
search = XX-XX-XXXX v. X.X.X
replace = {now:%m-%d-%Y} v. {new_version}
When I moved this into my setup.cfg, bumpversion still works but the following happens when I try to run anything with setup.py.
Traceback (most recent call last):
...
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%m-%d-%Y} v. {new_version}'
The obvious solution of escaping the % so that they are not interpolated (e.g. {now:%%m-%%d-%%Y} causes setuptools to not fail, but then bumpversion inserts the literal string "%%m-%%d-%%Y" instead of formatting the date because the percent signs are not treated as needing escaping.
It turns out that other packages have run into this, like pytest: pytest-dev/pytest#3062. This distutils mailing thread also illustrates that the python devs are struggling with if this was a good design decision, but that's a whole other can of worms.
My proposal: When loading from setup.cfg, use configparser.ConfigParser, and when loading from .bumpversion.cfg, use configparser.RawConfigParser.
The text was updated successfully, but these errors were encountered:
First, thanks for the great tool!
The interpolation behavior of config files by
bumpversion
andsetuptools
is not the same.bumpversion
uses no interpolation (e.g.configparser.RawConfigParser
), butsetuptools
uses the default interpolation ofconfigparser.ConfigParser
, which is "basic interpolation".In general, this should not be an issue, but because
bumpversion
supports setting configuration in thesetup.cfg
file, options that might be interpolated by the parser would not cause an issue if they appear in the.bumpversion.cfg
, but suddenly break the install/build process if they are moved to thesetup.cfg
.For example, I had the following in my
.bumpversion.cfg
to automatically insert the date in my CHANGELOG along with the version.When I moved this into my
setup.cfg
,bumpversion
still works but the following happens when I try to run anything withsetup.py
.The obvious solution of escaping the
%
so that they are not interpolated (e.g.{now:%%m-%%d-%%Y}
causessetuptools
to not fail, but thenbumpversion
inserts the literal string "%%m-%%d-%%Y
" instead of formatting the date because the percent signs are not treated as needing escaping.It turns out that other packages have run into this, like
pytest
: pytest-dev/pytest#3062. Thisdistutils
mailing thread also illustrates that the python devs are struggling with if this was a good design decision, but that's a whole other can of worms.My proposal: When loading from
setup.cfg
, useconfigparser.ConfigParser
, and when loading from.bumpversion.cfg
, useconfigparser.RawConfigParser
.The text was updated successfully, but these errors were encountered: