def METHOD_NAME(self, version):
    with open(self.path, "r+", encoding="utf-8") as f:
        data = f.read()
        new_data = SPEC_VERSION_RE.sub(fr"\g<version_tag>{version}", data)
        f.seek(0)
        f.write(new_data)
        f.truncate()