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

[bug] incorrectly bumps dependency that matches <project version> #93

Closed
Amar1729 opened this issue Nov 11, 2023 · 1 comment · Fixed by #101
Closed

[bug] incorrectly bumps dependency that matches <project version> #93

Amar1729 opened this issue Nov 11, 2023 · 1 comment · Fixed by #101
Labels
bug Something isn't working

Comments

@Amar1729
Copy link

  • bump-my-version version: 0.12.0 (currently not a tagged release on github)
  • Python version: 3.12
  • Operating System: macOS

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

bump-my-version seemingly mis-identifies strings other than version in the target file that are contained in the current version string.

Expected: bumping versions in pyproject.toml only changes project.version and tool.bumpversion.current_version (if present).

What I Did

While trying to bump minor version of a pyproject.toml containing a dependency whose version substring-matches version, both were updated.

[project]
name = "sample-repo"
version = "0.0.2"
description = ""
authors = [
    {name = "Amar Paul", email = "[email protected]"},
]
dependencies = []
requires-python = ">=3.11"
readme = "README.md"
license = {text = "MIT"}

[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

[tool.pdm.dev-dependencies]
lint = [
    "ruff==0.0.292",
]
build = [
    "bump-my-version>=0.12.0",
]

[tool.bumpversion]
commit = false
tag = false
current_version = "0.0.2"
$ bump-my-version bump minor pyproject.toml

results in:

diff --git a/pyproject.toml b/pyproject.toml
index ebdfd3d..a98f3d9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [project]
 name = "sample-repo"
-version = "0.0.2"
+version = "0.1.0"
 description = ""
 authors = [
     {name = "Amar Paul", email = "[email protected]"},
@@ -16,7 +16,7 @@ build-backend = "setuptools.build_meta"
 
 [tool.pdm.dev-dependencies]
 lint = [
-    "ruff==0.0.292",
+    "ruff==0.1.092",
 ]
 build = [
     "bump-my-version>=0.12.0",
@@ -25,4 +25,4 @@ build = [
 [tool.bumpversion]
 commit = false
 tag = false
-current_version = "0.0.2"
+current_version = "0.1.0"

note that the original dependency string for ruff contains 0.0.2, even though it has a longer version string (0.0.292 in this case).

@coordt coordt added the bug Something isn't working label Nov 11, 2023
@irons
Copy link

irons commented Dec 3, 2023

See discussion of search regexes to avoid false positive matches, here: #97 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants