Repository: callowayproject/bump-my-version
Pull request #299 (2025-02-17 20:06:04)

[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.9.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.6...v0.9.7)
- [github.com/jsh9/pydoclint: 0.6.0 → 0.6.2](https://github.com/jsh9/pydoclint/compare/0.6.0...0.6.2)
<!--pre-commit.ci end-->

github-actions[bot]: **Version hint:** no-release
**Current version:** 0.32.1
**New version (when merged):** 0.32.1


<sub>Comment ID: Display the version hint-auto-generated</sub>
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 93.63%. Comparing base [(`b786638`)](https://app.codecov.io/gh/callowayproject/bump-my-version/commit/b786638f152f2044d629c11f38f56713cc5c6dc4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) to head [(`2b90a9c`)](https://app.codecov.io/gh/callowayproject/bump-my-version/commit/2b90a9cdeac15acbe2127bda20f4acf0ec763913?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject).
> Report is 1 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master     #299   +/-   ##
=======================================
  Coverage   93.63%   93.63%           
=======================================
  Files          29       29           
  Lines        1918     1918           
  Branches      198      198           
=======================================
  Hits         1796     1796           
  Misses         92       92           
  Partials       30       30           
```

| [Flag](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | Coverage Δ | |
|---|---|---|
| [python-3.10](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `?` | |
| [python-3.11](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `?` | |
| [python-3.12](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `93.63% <ø> (ø)` | |
| [python-3.13](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `?` | |
| [python-3.8](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `93.63% <ø> (ø)` | |
| [python-3.9](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject) | `93.63% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject#carryforward-flags-in-the-pull-request-comment) to find out more.

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/callowayproject/bump-my-version/pull/299?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=callowayproject).

github-actions[bot]: [PR Preview Action](https://github.com/rossjrw/pr-preview-action) v1.6.0
:---:
| <p></p> :rocket: View preview at <br> https://callowayproject.github.io/bump-my-version/pr-preview/pr-299/ <br><br>
| <h6>Built to branch [`gh-pages`](https://github.com/callowayproject/bump-my-version/tree/gh-pages) at 2025-02-17 20:07 UTC. <br> Preview will be ready when the [GitHub Pages deployment](https://github.com/callowayproject/bump-my-version/deployments) is complete. <br><br> </h6>
<!-- Sticky Pull Request Commentpr-preview -->

Patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5b9599c7..3d2c502b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
 repos:
   - repo: https://github.com/astral-sh/ruff-pre-commit
     # Ruff version.
-    rev: 'v0.9.6'
+    rev: 'v0.9.7'
     hooks:
       - id: ruff
         args: [--fix, --exit-non-zero-on-fix]
@@ -59,7 +59,7 @@ repos:
             test.*
           )$
   - repo: https://github.com/jsh9/pydoclint
-    rev: 0.6.0
+    rev: 0.6.2
     hooks:
       - id: pydoclint
         args:
diff --git a/bumpversion/config/__init__.py b/bumpversion/config/__init__.py
index f0e9e0e1..8ec98b44 100644
--- a/bumpversion/config/__init__.py
+++ b/bumpversion/config/__init__.py
@@ -4,7 +4,7 @@ from __future__ import annotations
 
 from typing import TYPE_CHECKING, Any, Optional
 
-from bumpversion.config.files import get_pep621_info, read_config_file
+from bumpversion.config.files import read_config_file
 from bumpversion.config.models import Config
 from bumpversion.exceptions import ConfigurationError
 from bumpversion.ui import get_indented_logger
@@ -32,7 +32,6 @@ DEFAULTS = {
     "message": "Bump version: {current_version} → {new_version}",
     "moveable_tags": [],
     "commit_args": None,
-    "pep621_info": None,
     "scm_info": None,
     "parts": {},
     "files": [],
@@ -85,10 +84,6 @@ def get_configuration(config_file: Optional[Pathlike] = None, **overrides: Any)
     Config.model_rebuild()
     config = Config(**config_dict)  # type: ignore[arg-type]
 
-    # Get the PEP 621 project.version key from pyproject.toml, if possible
-    config.pep621_info = get_pep621_info(config_file)
-    logger.debug("config.pep621_info = %r", config.pep621_info)
-
     # Get the information about the SCM
     scm_info = SCMInfo(SCMConfig.from_config(config))
     config.scm_info = scm_info
@@ -118,12 +113,9 @@ def check_current_version(config: Config) -> str:
         ConfigurationError: If it can't find the current version
     """
     current_version = config.current_version
-    pep621_info = config.pep621_info
     scm_info = config.scm_info
 
-    if current_version is None and pep621_info is not None and pep621_info.version:
-        return pep621_info.version
-    elif current_version is None and scm_info.current_version:
+    if current_version is None and scm_info.current_version:
         return scm_info.current_version
     elif current_version and scm_info.current_version and current_version != scm_info.current_version:
         logger.warning(
diff --git a/bumpversion/config/create.py b/bumpversion/config/create.py
index a08c2f06..8020d961 100644
--- a/bumpversion/config/create.py
+++ b/bumpversion/config/create.py
@@ -23,14 +23,7 @@ def create_configuration(destination: str, prompt: bool) -> TOMLDocument:
     if prompt:
         allow_dirty_default = "(Y/n)" if config["allow_dirty"] else "(y/N)"
         answers = questionary.form(
-            current_version=questionary.text(
-                "What is the current version?",
-                default=config["current_version"],
-                instruction=(
-                    "If omitted, use the project.version key in pyproject.toml. "
-                    "(Does not support dynamically set versions.)"
-                ),
-            ),
+            current_version=questionary.text("What is the current version?", default=config["current_version"]),
             commit=questionary.confirm(
                 "Commit changes made when bumping to version control?", default=config["commit"]
             ),
@@ -52,8 +45,6 @@ def create_configuration(destination: str, prompt: bool) -> TOMLDocument:
         config.update(answers)
 
     for key, val in config.items():
-        if key == "current_version" and not val:
-            continue
         destination_config["tool"]["bumpversion"][key] = val if val is not None else ""
 
     return destination_config
@@ -80,7 +71,6 @@ def get_defaults_from_dest(destination: str) -> Tuple[dict, TOMLDocument]:
     project_config = destination_config.get("project", {}).get("version")
     config["current_version"] = config["current_version"] or project_config or "0.1.0"
     del config["scm_info"]
-    del config["pep621_info"]
     del config["parts"]
     del config["files"]
 
diff --git a/bumpversion/config/files.py b/bumpversion/config/files.py
index f81f76c3..d4daf35d 100644
--- a/bumpversion/config/files.py
+++ b/bumpversion/config/files.py
@@ -6,7 +6,6 @@ from pathlib import Path
 from typing import TYPE_CHECKING, Any, Dict, MutableMapping, Optional, Union
 
 from bumpversion.config.files_legacy import read_ini_file
-from bumpversion.config.models import PEP621Info
 from bumpversion.ui import get_indented_logger, print_warning
 
 if TYPE_CHECKING:  # pragma: no-coverage
@@ -24,42 +23,6 @@ CONFIG_FILE_SEARCH_ORDER = (
 )
 
 
-def get_pep621_info(config_file: Optional[Pathlike] = None) -> Optional[PEP621Info]:
-    """Retrieve the PEP 621 `project` table.
-
-    At the moment, only the `project.version` key is handled. Additionally, if the
-    version is marked as dynamic, then it is explicitly returned as `None`.
-
-    Args:
-        config_file:
-            The configuration file to explicitly use. Per PEP 621, this file must be
-            named `pyproject.toml`.
-
-    Returns:
-        A `PEP621Info` structure, if given a `pyproject.toml` file to parse, else `None`.
-
-    """
-    # We repeat the steps of read_config_file here, except hardcoded to TOML files, and
-    # without additional error reporting.  Then we reimplement read_toml_file, but
-    # without limiting ourselves to the tool.bumpversion subtable.
-    if not config_file:
-        return None
-
-    config_path = Path(config_file)
-    if not config_path.exists():
-        return None
-
-    # PEP 621 explicitly requires pyproject.toml
-    if config_path.name != "pyproject.toml":
-        return None
-
-    import tomlkit
-
-    toml_data = tomlkit.parse(config_path.read_text(encoding="utf-8")).unwrap()
-    project = toml_data.get("project", {})
-    return PEP621Info(version=None if "version" in project.get("dynamic", []) else project.get("version"))
-
-
 def find_config_file(explicit_file: Optional[Pathlike] = None) -> Union[Path, None]:
     """
     Find the configuration file, if it exists.
@@ -176,8 +139,7 @@ def update_config_file(
         logger.info("You must have a `.toml` suffix to update the config file: %s.", config_path)
         return
 
-    # TODO: Eventually this config (and datafile_config_pyprojecttoml below) should be
-    # transformed into another default "files_to_modify" entry
+    # TODO: Eventually this should be transformed into another default "files_to_modify" entry
     datafile_config = FileChange(
         filename=str(config_path),
         key_path="tool.bumpversion.current_version",
@@ -192,26 +154,4 @@ def update_config_file(
 
     updater = DataFileUpdater(datafile_config, config.version_config.part_configs)
     updater.update_file(current_version, new_version, context, dry_run)
-
-    # Keep PEP 621 `project.version` consistent with `tool.bumpversion.current_version`.
-    # (At least, if PEP 621 static `project.version` is in use at all.)
-    if (
-        config_path.name == "pyproject.toml"
-        and config.pep621_info is not None
-        and config.pep621_info.version is not None
-    ):
-        datafile_config_pyprojecttoml = FileChange(
-            filename=str(config_path),
-            key_path="project.version",
-            search=config.search,
-            replace=config.replace,
-            regex=config.regex,
-            ignore_missing_version=True,
-            ignore_missing_file=True,
-            serialize=config.serialize,
-            parse=config.parse,
-        )
-        updater2 = DataFileUpdater(datafile_config_pyprojecttoml, config.version_config.part_configs)
-        updater2.update_file(current_version, new_version, context, dry_run)
-
     logger.dedent()
diff --git a/bumpversion/config/models.py b/bumpversion/config/models.py
index 6cac6688..6d2629a9 100644
--- a/bumpversion/config/models.py
+++ b/bumpversion/config/models.py
@@ -4,7 +4,6 @@ from __future__ import annotations
 
 import re
 from collections import defaultdict
-from dataclasses import dataclass
 from itertools import chain
 from typing import TYPE_CHECKING, Dict, List, MutableMapping, Optional, Tuple, Union
 
@@ -98,7 +97,6 @@ class Config(BaseSettings):
     commit: bool
     message: str
     commit_args: Optional[str]
-    pep621_info: Optional[PEP621Info]
     scm_info: Optional[SCMInfo]
     parts: Dict[str, VersionComponentSpec]
     moveable_tags: list[str] = Field(default_factory=list)
@@ -181,10 +179,3 @@ class Config(BaseSettings):
         from bumpversion.versioning.models import VersionSpec
 
         return VersionSpec(self.parts)
-
-
-@dataclass
-class PEP621Info:
-    """PEP 621 info, in particular, the static version number."""
-
-    version: Optional[str]
diff --git a/docs/howtos/multiple-replacements.md b/docs/howtos/multiple-replacements.md
index 97aa5619..31a0b971 100644
--- a/docs/howtos/multiple-replacements.md
+++ b/docs/howtos/multiple-replacements.md
@@ -18,7 +18,3 @@ filename = "CHANGELOG.md"
 search = "{current_version}...HEAD"
 replace = "{current_version}...{new_version}"
 ```
-
-??? note "Note: `project.version` in `pyproject.toml`"
-
-    This technique is **not** needed to keep `project.version` in `pyproject.toml` up-to-date if you are storing your Bump My Version configuration in `pyproject.toml` as well. Bump My Version will handle this case automatically.
diff --git a/docs/reference/configuration/global.md b/docs/reference/configuration/global.md
index df1cb52e..1e90d48a 100644
--- a/docs/reference/configuration/global.md
+++ b/docs/reference/configuration/global.md
@@ -80,7 +80,7 @@ If you have pre-commit hooks, add an option to turn off your pre-commit hooks. F
 ::: field-list
 
     required
-    : **Yes‡**
+    : **Yes**
     
     default
     : `""`
@@ -94,11 +94,7 @@ If you have pre-commit hooks, add an option to turn off your pre-commit hooks. F
     environment var
     : `BUMPVERSION_CURRENT_VERSION`
 
-The current version of the software package before bumping. A value for this is required, unless a fallback value is found.
-
-!!! note
-
-    ‡ If `pyproject.toml` exists, then `current_version` falls back to `project.version` in `pyproject.toml`. This only works if `project.version` is statically set.
+The current version of the software package before bumping. A value for this is required.
 
 ## ignore_missing_files
 


Test patch:
diff --git a/tests/fixtures/basic_cfg_expected.txt b/tests/fixtures/basic_cfg_expected.txt
index 1059b031..300e0f17 100644
--- a/tests/fixtures/basic_cfg_expected.txt
+++ b/tests/fixtures/basic_cfg_expected.txt
@@ -79,7 +79,6 @@
                        'independent': False,
                        'optional_value': 'gamma',
                        'values': ['dev', 'gamma']}},
- 'pep621_info': {'version': None},
  'post_commit_hooks': [],
  'pre_commit_hooks': [],
  'regex': False,
diff --git a/tests/fixtures/basic_cfg_expected.yaml b/tests/fixtures/basic_cfg_expected.yaml
index 759c019b..291e4048 100644
--- a/tests/fixtures/basic_cfg_expected.yaml
+++ b/tests/fixtures/basic_cfg_expected.yaml
@@ -108,8 +108,6 @@ parts:
     values:
       - "dev"
       - "gamma"
-pep621_info:
-  version: null
 post_commit_hooks:
 
 pre_commit_hooks:
diff --git a/tests/fixtures/basic_cfg_expected_full.json b/tests/fixtures/basic_cfg_expected_full.json
index 71f5b6e2..a0ec9dc3 100644
--- a/tests/fixtures/basic_cfg_expected_full.json
+++ b/tests/fixtures/basic_cfg_expected_full.json
@@ -122,9 +122,6 @@
       ]
     }
   },
-  "pep621_info": {
-    "version": null
-  },
   "post_commit_hooks": [],
   "pre_commit_hooks": [],
   "regex": false,
diff --git a/tests/test_bump.py b/tests/test_bump.py
index 5bfc50bd..24996542 100644
--- a/tests/test_bump.py
+++ b/tests/test_bump.py
@@ -385,248 +385,6 @@ def test_key_path_required_for_toml_change(tmp_path: Path, caplog):
     )
 
 
-def test_pep621_fallback_works_static_case(tmp_path: Path, caplog):
-    """If tool.bumpversion.current_version is not defined, but static project.version is, use that."""
-    from click.testing import CliRunner, Result
-
-    from bumpversion import cli, config
-
-    # Arrange
-    config_path = tmp_path / "pyproject.toml"
-    config_path.write_text(
-        dedent(
-            """
-            [project]
-            version = "0.1.26"
-
-            [tool.bumpversion]
-            allow_dirty = true
-            commit = true
-
-            [tool.othertool]
-            bake_cookies = true
-            ignore-words-list = "sugar, salt, flour"
-
-            [tool.other-othertool]
-            version = "0.1.26"
-            """
-        ),
-        encoding="utf-8",
-    )
-
-    conf = config.get_configuration(config_file=config_path)
-
-    # Act
-    runner: CliRunner = CliRunner()
-    with inside_dir(tmp_path):
-        result: Result = runner.invoke(
-            cli.cli,
-            ["bump", "-vv", "minor"],
-        )
-
-    if result.exit_code != 0:
-        print(caplog.text)
-        print("Here is the output:")
-        print(result.output)
-        import traceback
-
-        print(traceback.print_exception(result.exc_info[1]))
-
-    # Assert
-    assert result.exit_code == 0
-    assert config_path.read_text() == dedent(
-        """
-        [project]
-        version = "0.2.0"
-
-        [tool.bumpversion]
-        allow_dirty = true
-        commit = true
-
-        [tool.othertool]
-        bake_cookies = true
-        ignore-words-list = "sugar, salt, flour"
-
-        [tool.other-othertool]
-        version = "0.1.26"
-        """
-    )
-
-
-def test_pep621_fallback_works_dynamic_case(tmp_path: Path, caplog):
-    """If tool.bumpversion.current_version is not defined, but dynamic project.version is, *don't* use that."""
-    from click.testing import CliRunner, Result
-
-    from bumpversion import cli, config
-    from bumpversion.exceptions import ConfigurationError
-
-    # Arrange
-    config_path = tmp_path / "pyproject.toml"
-    config_path.write_text(
-        dedent(
-            """
-            [project]
-            dynamic = ["version"]
-
-            [tool.bumpversion]
-            allow_dirty = true
-            commit = true
-
-            [tool.othertool]
-            bake_cookies = true
-            ignore-words-list = "sugar, salt, flour"
-
-            [tool.other-othertool]
-            version = "0.1.26"
-            """
-        ),
-        encoding="utf-8",
-    )
-
-    with pytest.raises(ConfigurationError):
-        config.get_configuration(config_file=config_path)
-
-
-def test_pep621_fallback_always_updated(tmp_path: Path, caplog):
-    """Always update project.version (if static)."""
-    from click.testing import CliRunner, Result
-
-    from bumpversion import cli, config
-
-    # Arrange
-    config_path = tmp_path / "pyproject.toml"
-    config_path.write_text(
-        dedent(
-            """
-            [project]
-            version = "0.1.26"
-
-            [tool.bumpversion]
-            current_version = "0.1.26"
-            allow_dirty = true
-            commit = true
-
-            [tool.othertool]
-            bake_cookies = true
-            ignore-words-list = "sugar, salt, flour"
-
-            [tool.other-othertool]
-            version = "0.1.26"
-            """
-        ),
-        encoding="utf-8",
-    )
-
-    conf = config.get_configuration(config_file=config_path)
-
-    # Act
-    runner: CliRunner = CliRunner()
-    with inside_dir(tmp_path):
-        result: Result = runner.invoke(
-            cli.cli,
-            ["bump", "-vv", "minor"],
-        )
-
-    if result.exit_code != 0:
-        print(caplog.text)
-        print("Here is the output:")
-        print(result.output)
-        import traceback
-
-        print(traceback.print_exception(result.exc_info[1]))
-
-    # Assert
-    assert result.exit_code == 0
-    assert config_path.read_text() == dedent(
-        """
-        [project]
-        version = "0.2.0"
-
-        [tool.bumpversion]
-        current_version = "0.2.0"
-        allow_dirty = true
-        commit = true
-
-        [tool.othertool]
-        bake_cookies = true
-        ignore-words-list = "sugar, salt, flour"
-
-        [tool.other-othertool]
-        version = "0.1.26"
-        """
-    )
-
-
-def test_pep621_fallback_never_updated_if_dynamic(tmp_path: Path, caplog):
-    """Never update project.version if dynamic."""
-    from click.testing import CliRunner, Result
-
-    from bumpversion import cli, config
-
-    # Arrange
-    config_path = tmp_path / "pyproject.toml"
-    config_path.write_text(
-        dedent(
-            """
-            [project]
-            dynamic = ["version"]
-
-            [tool.bumpversion]
-            current_version = "0.1.26"
-            allow_dirty = true
-            commit = true
-
-            [tool.othertool]
-            bake_cookies = true
-            ignore-words-list = "sugar, salt, flour"
-
-            [tool.other-othertool]
-            version = "0.1.26"
-            """
-        ),
-        encoding="utf-8",
-    )
-
-    conf = config.get_configuration(config_file=config_path)
-
-    # Act
-    runner: CliRunner = CliRunner()
-    with inside_dir(tmp_path):
-        result: Result = runner.invoke(
-            cli.cli,
-            ["bump", "-vv", "minor"],
-        )
-
-    if result.exit_code != 0:
-        print(caplog.text)
-        print("Here is the output:")
-        print(result.output)
-        import traceback
-
-        print(traceback.print_exception(result.exc_info[1]))
-
-    # Assert
-    assert result.exit_code == 0
-    assert config_path.read_text() == dedent(
-        """
-        [project]
-        dynamic = ["version"]
-
-        [tool.bumpversion]
-        current_version = "0.2.0"
-        allow_dirty = true
-        commit = true
-
-        [tool.othertool]
-        bake_cookies = true
-        ignore-words-list = "sugar, salt, flour"
-
-        [tool.other-othertool]
-        version = "0.1.26"
-        """
-    )
-
-
 def test_changes_to_files_are_committed(git_repo: Path, caplog):
     """Any files changed during the bump are committed."""
     from click.testing import CliRunner, Result
diff --git a/tests/test_config/test_create.py b/tests/test_config/test_create.py
index 0eead8a8..90cd129b 100644
--- a/tests/test_config/test_create.py
+++ b/tests/test_config/test_create.py
@@ -36,10 +36,9 @@ BASIC_CONFIG = {
 
 @pytest.fixture
 def default_config() -> dict:
-    """The default configuration with the scm_info, pep621_info and parts removed."""
+    """The default configuration with the scm_info and parts removed."""
     defaults = DEFAULTS.copy()
     del defaults["scm_info"]
-    del defaults["pep621_info"]
     del defaults["parts"]
     del defaults["files"]
     return defaults
@@ -166,20 +165,3 @@ class TestCreateConfiguration:
         assert destination_config["tool"]["bumpversion"]["tag_message"] == default_config["tag_message"]
         assert destination_config["tool"]["bumpversion"]["tag_name"] == default_config["tag_name"]
         assert mocked_questionary.form.return_value.ask.call_count == 1
-
-    def test_prompt_true_empty_current_version_removes_key(self, tmp_path: Path, default_config: dict, mocker):
-        """If prompt is True and if current_version is empty, that key should be missing in the answer."""
-        answer = {
-            "current_version": "",
-            "commit": True,
-            "allow_dirty": True,
-            "tag": True,
-            "commit_args": "--no-verify",
-        }
-        mocked_questionary = mocker.patch("bumpversion.config.create.questionary", autospec=True)
-        mocked_questionary.form.return_value.ask.return_value = answer
-        with inside_dir(tmp_path):
-            destination_config = create_configuration("pyproject.toml", prompt=True)
-
-        assert "current_version" not in destination_config["tool"]["bumpversion"]
-        assert mocked_questionary.form.return_value.ask.call_count == 1
diff --git a/tests/test_config/test_init.py b/tests/test_config/test_init.py
index 5e608fcc..94503595 100644
--- a/tests/test_config/test_init.py
+++ b/tests/test_config/test_init.py
@@ -1,12 +1,8 @@
 """Tests for the config.__init__ module."""
 
-from typing import Optional
 from unittest.mock import Mock
 
-import pytest
-
 from bumpversion.config import Config, check_current_version
-from bumpversion.config.models import PEP621Info
 from bumpversion.scm.models import SCMConfig, SCMInfo
 
 
@@ -18,29 +14,13 @@ class TestCheckCurrentVersion:
     - tag may not match current version in config
     """
 
-    def test_uses_pep621_version_when_missing_current_version(self, scm_config: SCMConfig):
-        """When the config does not have a current_version, the PEP 621 project.version is used."""
-        # Arrange
-
-        pep621_info = PEP621Info(version="1.2.4")
-        scm_info = SCMInfo(scm_config)
-        scm_info.current_version = "1.2.3"
-        config = Mock(spec=Config, current_version=None, pep621_info=pep621_info, scm_info=scm_info)
-
-        # Act
-        result = check_current_version(config)
-
-        # Assert
-        assert result == "1.2.4"
-
-    @pytest.mark.parametrize("pep621_info", [PEP621Info(version=None), None])
-    def test_uses_tag_when_missing_current_version(self, scm_config: SCMConfig, pep621_info: Optional[PEP621Info]):
-        """When the config has neither current_version nor PEP 621 project.version, the last tag is used."""
+    def test_uses_tag_when_missing_current_version(self, scm_config: SCMConfig):
+        """When the config does not have a current_version, the last tag is used."""
         # Arrange
 
         scm_info = SCMInfo(scm_config)
         scm_info.current_version = "1.2.3"
-        config = Mock(spec=Config, current_version=None, pep621_info=pep621_info, scm_info=scm_info)
+        config = Mock(spec=Config, current_version=None, scm_info=scm_info)
 
         # Act
         result = check_current_version(config)
diff --git a/tests/test_config/test_utils.py b/tests/test_config/test_utils.py
index 78cef962..838e1861 100644
--- a/tests/test_config/test_utils.py
+++ b/tests/test_config/test_utils.py
@@ -19,7 +19,6 @@ def write_config(tmp_path: Path, overrides: dict) -> Path:
     defaults = DEFAULTS.copy()
     defaults.pop("parts")
     defaults.pop("scm_info")
-    defaults.pop("pep621_info")
     defaults["current_version"] = defaults["current_version"] or "1.2.3"
     defaults["commit_args"] = ""
     config = {"tool": {"bumpversion": {**defaults, **overrides}}}