Skip to content

Commit

Permalink
Merge branch 'master' of github.com:materialsproject/pymatgen
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jun 26, 2024
2 parents 402ede5 + fbf8ec0 commit 89691c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ def publish(ctx: Context) -> None:

@task
def set_ver(ctx: Context, version: str):
with open("setup.py", encoding="utf-8") as file:
contents = file.read()
contents = re.sub(r"version=([^,]+),", f"version={version!r},", contents)
with open("pyproject.toml") as file:
lines = [re.sub(r"^version = \"([^,]+)\"", f'version = "{version}"', line.rstrip()) for line in file]

with open("pyproject.toml", "w") as file:
file.write("\n".join(lines) + "\n")

with open("setup.py", mode="w", encoding="utf-8") as file:
file.write(contents)
ctx.run("ruff check --fix custodian")
ctx.run("ruff format pyproject.toml")


@task
Expand Down

0 comments on commit 89691c8

Please sign in to comment.