c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 134 forks source link

__init__.py + setup.py broken after calling bump2version with the current version #214

Closed snazy closed 3 years ago

snazy commented 3 years ago

We use bump2version in our release pipeline in the following way (it's not a "pure Python" project, but a Python lib in a Maven project):

bump2version --no-commit --no-tag --new-version ${RELEASE_VERSION} minor

In case the current version is already the same as ${RELEASE_VERSION}, bump2version (tested against version 1.0.1) breaks __init__.py and setup.py as shown in this git diff:

giff --git a/python/pynessie/__init__.py b/python/pynessie/__init__.py
index f475d57..26f4e4c 100644
--- a/python/pynessie/__init__.py
+++ b/python/pynessie/__init__.py
@@ -9,7 +9,7 @@
 __author__ = """Project Nessie"""
 __email__ = "nessie-release-builder@dremio.com"
-__version__ = "0.5.2"
+__version__ = "__version__ = "0.5.2""
 def get_config(config_dir: str = None, args: dict = None) -> confuse.Configuration:
diff --git a/python/setup.py b/python/setup.py
index 0ebf820..1d518b5 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -48,6 +48,6 @@
     test_suite="tests",
     tests_require=[],
     url="https://github.com/projectnessie/nessie",
-    version="0.5.2",
+    version="version="0.5.2"",
     zip_safe=False,
 )

Steps to reproduce:

git clone https://github.com/projectnessie/nessie.git
git checkout f9cc3c0c0b9e932314e203a7201a3eb4d58b301e  # recent SHA that's on 0.5.2-SNAPSHOT
cd python
virtuanenv venv
. venv/bin/activate
pip install bump2version
bump2version --no-commit --no-tag --new-version 0.5.2 minor

As a workaround, I'm checking the output of python -c 'import pynessie; print(pynessie.__version__)' before calling bump2version.

wouterdb commented 3 years ago

We observed similar behavior today.

wouterdb commented 3 years ago

seems like a duplicate of https://github.com/c4urself/bump2version/issues/30

florisla commented 3 years ago

Thanks for reporting!

This has been a nasty bug for a long time, and I feel it's important to get this fixed for a next release. I already added the original ticket #30 to the milestone to make sure we don't forget about it.

Closing this as duplicate.