{"id":26128970,"url":"https://github.com/your-tools/tbump","last_synced_at":"2025-12-12T01:01:54.497Z","repository":{"id":37406393,"uuid":"113476362","full_name":"your-tools/tbump","owner":"your-tools","description":"Bump software releases","archived":false,"fork":false,"pushed_at":"2025-03-13T10:24:54.000Z","size":613,"stargazers_count":161,"open_issues_count":12,"forks_count":23,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-02T04:02:29.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/your-tools.png","metadata":{"files":{"readme":"README.rst","changelog":"Changelog.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-07T16:51:36.000Z","updated_at":"2025-03-25T23:04:06.000Z","dependencies_parsed_at":"2023-02-14T16:15:28.155Z","dependency_job_id":"187c9409-6da8-437f-b78d-5ee2d699037d","html_url":"https://github.com/your-tools/tbump","commit_stats":{"total_commits":403,"total_committers":19,"mean_commits":"21.210526315789473","dds":"0.40446650124069483","last_synced_commit":"09eada61ba9c629d0ec38b81dc9c0f30b8ec7ef9"},"previous_names":["dmerejkowsky/tbump"],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/your-tools%2Ftbump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/your-tools%2Ftbump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/your-tools%2Ftbump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/your-tools%2Ftbump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/your-tools","download_url":"https://codeload.github.com/your-tools/tbump/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-10T19:29:40.040Z","updated_at":"2025-12-12T01:01:50.437Z","avatar_url":"https://github.com/your-tools.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://img.shields.io/pypi/v/tbump.svg\n  :target: https://pypi.org/project/tbump/\n\n.. image:: https://img.shields.io/github/license/dmerejkowsky/tbump.svg\n  :target: https://github.com/dmerejkowsky/tbump/blob/main/LICENSE\n\n.. image:: https://github.com/dmerejkowsky/tbump/workflows/tests/badge.svg\n   :target: https://github.com/dmerejkowsky/tbump/actions\n\n.. image:: https://github.com/dmerejkowsky/tbump/workflows/linters/badge.svg\n   :target: https://github.com/dmerejkowsky/tbump/actions\n\n.. image:: https://img.shields.io/badge/code%20style-black-black.svg\n   :target: https://github.com/psf/black\n\n.. image:: https://img.shields.io/badge/mypy-checked-blue.svg\n   :target: https://mypy-lang.org\n\n\ntbump: bump software releases\n=============================\n\ntbump helps you bump the version of your project easily.\n\nNote\n----\n\nThis project was originally hosted on the `TankerHQ\n\u003chttps://github.com/TankerHQ\u003e`_ organization, which was my employer from 2016\nto 2021. They kindly agreed to give me back ownership of this project. Thanks!\n\nInstallation\n------------\n\nThe recommended way to install ``tbump`` is to use `pipx \u003chttps://pipxproject.github.io/pipx/\u003e`_\n\n* Make sure to have Python **3.8** or later installed.\n* Install ``pipx``\n* Run ``pipx install tbump``.\n\n``tbump`` is also available on ``pypi`` and can be installed with ``pip`` if you know what you are doing.\n\nScreenshot\n-----------\n\nHere's what a typical usage of ``tbump`` looks like:\n\n.. code-block:: console\n\n    $ tbump 5.0.5\n    :: Bumping from 5.0.4 to 5.0.5\n    =\u003e Would patch these files\n    - setup.py:14 version=\"5.0.4\",\n    + setup.py:14 version=\"5.0.5\",\n    - tbump.toml:2 current = \"5.0.4\"\n    + tbump.toml:2 current = \"5.0.5\"\n    =\u003e Would run these hooks before commit\n    * (1/2) $ ./test.sh\n    * (2/2) $ grep -q -F 5.0.5 Changelog.rst\n    =\u003e Would run these git commands\n     * git add --update\n     * git commit --message Bump to 5.0.5\n     * git tag --annotate --message v5.0.5 v5.0.5\n     * git push origin master\n     * git push origin v5.0.5\n    =\u003e Would run these hooks after push\n    * (1/1) $ ./publish.sh\n    :: Looking good? (y/N)\n    y\n    =\u003e Patching files\n    ...\n    =\u003e Running hooks before commit\n    ...\n    =\u003e Making bump commit and push matching tags\n    ...\n    =\u003e Running hooks after push\n    ...\n    Done ✓\n\n\n\nUsage\n------\n\nFirst, run ``tbump init \u003ccurrent_version\u003e``, where ``current_version``\nis the current version of your program. This will create a\n``tbump.toml`` file looking like this:\n\n.. code-block:: ini\n\n    [version]\n    current = \"1.2.41\"\n    regex = '''\n      (?P\u003cmajor\u003e\\d+)\n      \\.\n      (?P\u003cminor\u003e\\d+)\n      \\.\n      (?P\u003cpatch\u003e\\d+)\n    '''\n\n    [git]\n    message_template = \"Bump to {new_version}\"\n    tag_template = \"v{new_version}\"\n\n    [[file]]\n    src = \"setup.py\"\n\n\n.. note::\n\n * The file uses `toml syntax \u003chttps://github.com/toml-lang/toml\u003e`_.\n * Strings should be templated using curly brackets, to be used with\n   Python's built-in ``.format()`` method.\n * Paths may contain unix-style `globs\n   \u003chttps://docs.python.org/3/library/glob.html\u003e`_, e.g. ``src =\n   \"a/**/script.?s\"`` matches both ``a/b/script.js`` and\n   ``a/b/c/script.ts``.\n * The version regular expression will be used in `verbose mode\n   \u003chttps://docs.python.org/3/library/re.html#re.VERBOSE\u003e`_ and can\n   contain named groups (see below).\n * tbump will also look for a ``[tool.tbump]`` section in the\n   `pyproject.toml` file if its exists. You can use ``tbump init`` with\n   the ``--pyproject`` option to append the configuration in this file\n   instead of creating a new file.\n\n\nThen run:\n\n.. code-block:: console\n\n    $ tbump 1.2.42\n\n``tbump`` will:\n\n* Replace the string ``1.2.41`` by ``1.2.42`` in every file listed in the\n  configuration\n\n* Make a commit based on the ``message_template``.\n\n* Make an **annotated** tag based on the ``tag_template``\n\n* Push the current branch and the tag.\n\nNote that by default, ``tbump`` will display all the changes and stop to ask if they are correct before performing any action, allowing you to abort and re-try the bump if something is not right.\nYou can use ``--non-interactive`` to disable this behavior.\n\nIf you only want to bump the files without performing any git actions or running the hook commands, use the ``--only-patch`` option.\n\nThe current version of the project can be found using the command:\n\n.. code-block:: console\n\n    $ tbump current-version\n\nAdvanced configuration\n----------------------\n\nCommand-line options\n++++++++++++++++++++\n\nSee:\n\n.. code-block:: console\n\n   tbump --help\n\n\nRestricting the lines that are replaced\n+++++++++++++++++++++++++++++++++++++++\n\n\nSometimes you want to make sure only the line matching a given pattern is replaced. For instance, with the following ``package.json``:\n\n.. code-block:: js\n\n    /* in package.json */\n    {\n       \"name\": \"foo\",\n       \"version\": \"0.42\",\n       \"dependencies\": {\n         \"some-dep\": \"0.42\",\n         \"other-dep\": \"1.3\",\n       }\n    }\n\nyou'll want to make sure that when you bump from ``0.42`` to ``0.43``, that the line containing ``some-dep`` does not change.\n\nIn this case, you can set a ``search`` option in the ``file`` section:\n\n.. code-block:: ini\n\n    # In tbump.toml\n\n    [[file]]\n    src = \"package.json\"\n    search = '\"version\": \"{current_version}\"'\n\nNote that the search string is actually a full regular expression, except for the ``{current_version}`` marker which is substituted as plain text.\n\n\nUsing a custom version template\n+++++++++++++++++++++++++++++++\n\nIf you are using a version schema like ``1.2.3-alpha-4``, you may want to expose a variable that only contains the \"public\" part of the version string. (``1.2.3`` in this case).\n\nTo do so, add a ``version_template`` option in the ``file`` section. The names used in the format string should match the group names in the regular expression.\n\n\n.. code-block:: js\n\n      /* in version.js */\n\n      export FULL_VERSION = '1.2.3-alpha-4';\n      export PUBLIC_VERSION = '1.2.3';\n\n.. code-block:: ini\n\n\n      [[file]]\n      src = \"version.js\"\n      version_template = \"{major}.{minor}.{patch}\"\n      search = \"export PUBLIC_VERSION = '{current_version}'\"\n\n      [[file]]\n      src = \"version.js\"\n      search = \"export FULL_VERSION = '{current_version}'\"\n\n\nRunning commands before commit\n++++++++++++++++++++++++++++++\n\nYou can specify a list of hooks to be run after the file have changed, but before the commit is made and pushed.\n\nThis is useful if some of the files under version control are generated through an external program.\n\nHere's an example:\n\n\n.. code-block:: ini\n\n    [[before_commit]]\n    name = \"Check Changelog\"\n    cmd = \"grep -q -F {new_version} Changelog.rst\"\n\n\nThe name is mandatory. The command will be executed via the shell, after the  ``{new_version}``  placeholder is replaced with the new version.\n\nAny hook that fails will interrupt the bump. You may want to run ``git reset --hard`` before trying again to undo the changes made in the files.\n\nRunning commands after push\n+++++++++++++++++++++++++++\n\nYou can specify a list of hooks to be run right after the tag has been pushed, using an `[[after_push]]` section.\n\nThis is useful if you need the command to run on a clean repository, without un-committed changes, for instance to publish ``rust`` packages:\n\n.. code-block:: ini\n\n    [[after_push]]\n    name = \"Publish to crates.io\"\n    cmd = \"cargo publish\"\n\n\nSetting default values for version fields\n+++++++++++++++++++++++++++++++++++++++++\n\n\n(Added in 6.6.0)\n\nIf you have a ``version_template`` that includes fields that don't always have a match\n(e.g. prerelease info),\nyou can set a default value to use instead of ``None``,\nwhich would raise an error.\n\nFor example:\n\n.. code-block:: ini\n\n    [version]\n    current = \"1.2.3\"\n    regex = \"\"\"\n      (?P\u003cmajor\u003e\\d+)\n      \\.\n      (?P\u003cminor\u003e\\d+)\n      \\.\n      (?P\u003cpatch\u003e\\d+)\n      (\\-\n        (?P\u003cextra\u003e.+)\n      )?\n      \"\"\"\n\n    [[file]]\n    src = \"version.py\"\n    version_template = '({major}, {minor}, {patch}, \"{extra}\")'\n    search = \"version_info = {current_version}\"\n\n    [[field]]\n    # the name of the field\n    name = \"extra\"\n    # the default value to use, if there is no match\n    default = \"\"\n\n\nWorking with git providers that don't support --atomic\n++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nIf the push destination does not support ``--atomic``,\nadd ``atomic_push=false`` to the config file,\nunder the ``[git]`` section:\n\n..code-block:: ini\n\n  [git]\n  atomic_push = false\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyour-tools%2Ftbump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyour-tools%2Ftbump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyour-tools%2Ftbump/lists"}