MCPcopy
hub / github.com/ComposioHQ/composio / _bump_setup_py

Function _bump_setup_py

python/scripts/bump.py:95–132  ·  view source on GitHub ↗
(file: Path, bump_type: t.Optional[str] = None)

Source from the content-addressed store, hash-verified

93
94
95def _bump_setup_py(file: Path, bump_type: t.Optional[str] = None):
96 # Load config
97 content = file.read_text(encoding="utf-8")
98 _, _, arguments = content.partition("setup(")
99
100 package, version = None, None
101 for line in arguments.split("\n"):
102 if "=" not in line:
103 continue
104
105 arg, val = line.strip().split("=", maxsplit=1)
106 val = val.replace('"', "").replace(",", "").strip()
107 if arg == "name":
108 package = val
109
110 if arg == "version":
111 version = val
112
113 # Skip the main setup.py
114 if package == "composio":
115 return
116
117 if package is None or version is None:
118 raise ValueError(f"Package or version not found in {file}")
119
120 # Bump version
121 next_version = _get_version_update(
122 package=package,
123 version=version,
124 bump_type_selector=bump_type,
125 )
126 if next_version is None:
127 click.echo(f"* Skipping {package}")
128 return
129
130 click.echo(f"* Bumping {package} {version} -> {next_version}")
131 content = content.replace(f'version="{version}"', f'version="{next_version}"')
132 file.write_text(content, encoding="utf-8")
133
134
135def _bump_pyproject_toml(file: Path, bump_type: t.Optional[str] = None):

Callers 1

_bump_packageFunction · 0.85

Calls 2

_get_version_updateFunction · 0.85
replaceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…