0

The Hatch build tool has a versioning feature that can automatically bump the version of a Python project like this:

Simply define the file that holds the version:

[tool.hatch.version]
path = "improv_guide/__about__.py"

And then issue a command to bump the version:

hatch version patch

That will update the version number in __about__.py

But what if I wish to automatically bump the version number in multiple files? For example, I might want to edit the tag in a docker-compose file to have the same number as the project I am building.

Is there a way to specify multiple files I want to change whenever the version is bumped?

I suppose I could use a script and a command-line tool like sed to edit the files, but I was hoping that Hatch has a 'batteries included' way of solving this problem.

Salim Fadhley
  • 6,975
  • 14
  • 46
  • 83
  • You could use the [post-install](https://hatch.pypa.io/latest/config/environment/overview/#post-install) feature of hatch to have all known locations _use_ the newly bumped version. That's probably as featured as you'll get right now. – aqua Mar 07 '23 at 09:09

0 Answers0