YFDashboard / update_streamlit_version.py
Jon Solow
Remove unused line
4a57fb4
raw
history blame
541 Bytes
import pathlib
import pkg_resources
import re
package_name = "streamlit"
with pathlib.Path("requirements.txt").open() as requirements_txt:
for requirement in pkg_resources.parse_requirements(requirements_txt):
if requirement.name == package_name:
version = requirement.specs[0][-1]
break
print(version)
with open("README.md", "r") as f:
contents = f.read()
replaced = re.sub(r"sdk_version:.*", f"sdk_version: {version}", contents, 1)
with open("README.md", "w") as f:
f.write(replaced)