Crash when supplying `--commit` argument
Closed this issue · 4 comments
- bump-my-version version: 0.17.0
- Python version: 3.12.1
- Operating System: Fedora 39, Github CI
Description
Hi all, with bump-my-version 0.17.0 we are getting a crash when trying to automatically the changes. This is a regression from earlier versions which worked fine. See crash log below.
If we remove the --commit
argument, bump-my-version runs succesfully.
What I Did
$ bump-my-version bump --new-version 3.0.2 --commit
Traceback (most recent call last):
File "/home/stef/python/duqtools/.venv/bin/bump-my-version", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/rich_click/rich_command.py", line 126, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/bumpversion/cli.py", line 315, in bump
do_bump(version_part, new_version, config, found_config_file, dry_run)
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/bumpversion/bump.py", line 104, in do_bump
commit_and_tag(config, config_file, configured_files, ctx, dry_run)
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/bumpversion/bump.py", line 134, in commit_and_tag
config.scm_info.tool.commit_to_scm(list(commit_files), config, ctx, extra_args, dry_run)
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/bumpversion/scm.py", line 169, in commit_to_scm
cls.commit(
File "/home/stef/python/duqtools/.venv/lib/python3.12/site-packages/bumpversion/scm.py", line 68, in commit
subprocess.run(cmd, env=env, capture_output=True, check=True) # noqa: S603
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.12/subprocess.py", line 1870, in _execute_child
env_list.append(k + b'=' + os.fsencode(v))
^^^^^^^^^^^^^^
File "<frozen os>", line 818, in fsencode
TypeError: expected str, bytes or os.PathLike object, not NoneType
@stefsmeets Can you run that same command with the -vvv
option?
While I see some places I need better error checking, I'm at a loss on how to reproduce the error.
Sure, here is the output:
Starting BumpVersion 0.17.0
Reading configuration
Reading config file: /home/xxx/python/duqtools/.bumpversion.cfg
WARNING:
The .cfg file format is deprecated. Please use .toml instead.
Error when running git describe: fatal: No names found, cannot describe
anything.
Parsing current version '2.0.0'
Parsing version '2.0.0' using regexp
'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
Parsed the following values: major=2, minor=0, patch=0
Attempting to set new version '3.0.4'
Parsing version '3.0.4' using regexp
'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
Parsed the following values: major=3, minor=0, patch=4
Values are now: major=3, minor=0, patch=4
Serializing version '<bumpversion.Version:major=3, minor=0, patch=4>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '3.0.4'
New version will be '3.0.4'
File src/duqtools/__init__.py: replace `__version__ = '{current_version}'`
with `__version__ = '{new_version}'`
Serializing the current version
Serializing version '<bumpversion.Version:major=2, minor=0, patch=0>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '2.0.0'
Serializing the new version
Serializing version '<bumpversion.Version:major=3, minor=0, patch=4>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '3.0.4'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '__version__\
=\ '2\.0\.0''
Found '__version__\ =\ '2\.0\.0'' at line 20: __version__ = '2.0.0'
Changing file src/duqtools/__init__.py:
*** before src/duqtools/__init__.py
--- after src/duqtools/__init__.py
***************
*** 17,23 ****
__author__ = 'xxx'
__email__ = 'xxx'
! __version__ = '2.0.0'
import logging # noqa
import warnings # noqa
--- 17,23 ----
__author__ = 'xxx'
__email__ = 'xxx'
! __version__ = '3.0.4'
import logging # noqa
import warnings # noqa
File pyproject.toml: replace `version = "{current_version}"` with `version =
"{new_version}"`
Serializing the current version
Serializing version '<bumpversion.Version:major=2, minor=0, patch=0>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '2.0.0'
Serializing the new version
Serializing version '<bumpversion.Version:major=3, minor=0, patch=4>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '3.0.4'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: 'version\ =\
"2\.0\.0"'
Found 'version\ =\ "2\.0\.0"' at line 8: version = "2.0.0"
Changing file pyproject.toml:
*** before pyproject.toml
--- after pyproject.toml
***************
*** 5,11 ****
#
https://packaging.python.org/en/latest/specifications/declaring-project-metad
ata/
[project]
name = "duqtools"
! version = "2.0.0"
description = "Dynamic uncertainty quantification for Tokamak reactor
simulations modelling"
readme = "README.md"
requires-python = ">=3.9"
--- 5,11 ----
#
https://packaging.python.org/en/latest/specifications/declaring-project-metad
ata/
[project]
name = "duqtools"
! version = "3.0.4"
description = "Dynamic uncertainty quantification for Tokamak reactor
simulations modelling"
readme = "README.md"
requires-python = ">=3.9"
File CITATION.cff: replace `version: {current_version}` with `version:
{new_version}`
Serializing the current version
Serializing version '<bumpversion.Version:major=2, minor=0, patch=0>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '2.0.0'
Serializing the new version
Serializing version '<bumpversion.Version:major=3, minor=0, patch=4>'
Evaluating serialization formats
Found '{major}.{minor}.{patch}' to be a usable serialization format
Selected serialization format '{major}.{minor}.{patch}'
Serialized to '3.0.4'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: 'version:\
2\.0\.0'
Found 'version:\ 2\.0\.0' at line 36: version: 2.0.0
Changing file CITATION.cff:
*** before CITATION.cff
--- after CITATION.cff
***************
*** 33,36 ****
- uncertainty-quantification
- fusion-reactor
license: Apache-2.0
! version: 2.0.0
--- 33,36 ----
- uncertainty-quantification
- fusion-reactor
license: Apache-2.0
! version: 3.0.4
Writing to config file /home/stef/python/duqtools/.bumpversion.cfg:
*** before /home/stef/python/duqtools/.bumpversion.cfg
--- after /home/stef/python/duqtools/.bumpversion.cfg
***************
*** 1,5 ****
[bumpversion]
! current_version = 2.0.0
[comment]
comment = The contents of this file cannot be merged with that of setup.cfg
until https://github.com/c4urself/bump2version/issues/185 is resolved
--- 1,5 ----
[bumpversion]
! current_version = 3.0.4
[comment]
comment = The contents of this file cannot be merged with that of setup.cfg
until https://github.com/c4urself/bump2version/issues/185 is resolved
Preparing Git commit
Adding changes in file 'src/duqtools/__init__.py' to Git
Adding changes in file 'CITATION.cff' to Git
Adding changes in file 'pyproject.toml' to Git
Adding changes in file '/home/stef/python/duqtools/.bumpversion.cfg' to Git
Committing to Git with message 'Bump version: None → 3.0.4'
@stefsmeets I think the issue may be with your git
installation. Towards the top of the output there is a line:
Error when running git describe: fatal: No names found, cannot describe
anything.
Taking a look there might get you unstuck.
That said, I am going to add in some better error checking and reporting.
Thanks, this feature is not essential for us, so we worked around it for now by programming the git commit manually. If I have time I'll dig into it a bit and get back to you.