Skip to content

Support replacing a placeholder string only once during the next version bump #809

Open
@edgarrmondragon

Description

@edgarrmondragon

Description

I'm using Sphinx to document my Python project, which has a versionadded and versionchanged directives for rendering the version a feature was added.

For example:

def a_new_function():
  """A simple function.

  .. versionadded:: 0.1.0
  .. versionchanged:: 0.1.1  (could also be 0.2.0 if some features landed before the release)
  Return float.
  """
  return 1.0

The problem is, I don't always know what the next version will be, which most of the time is either a patch or a minor bump, so I'd like to configure commitizen with custom strings that it can change and replace with the new version in the project tree, so I can do something like:

def a_new_function():
  """A simple function.

  .. versionadded:: 0.1.0
  .. versionchanged:: NEXT_VERSION
  Return float.
  """
  return 1.0

without having to think what the next version will be.

Possible Solution

Perhaps something like this:

[tool.commitizen]
replace_with_version = "NEXT_VERSION"

Additional context

In the past I've used a similar tool called Changie that supports a replacements option:

# .changie.yaml
- path: src/mylib/client.py
  find: "NEXT_VERSION"
  replace: "{{.VersionNoPrefix}}"

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions