From e63e57d63b4761cf8ac7b465f00dbe43abc5f694 Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Mon, 29 Jul 2024 17:15:33 +0800 Subject: [PATCH] Update monty version setting. --- docs/changelog.md | 5 +++++ src/monty/__init__.py | 9 ++++++++- tasks.py | 8 -------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 87bb6dbf1..61ebad841 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,10 @@ # Change log +## 2024.7.29 +- Fix line ending in reverse_readfile/readline in Windows (@DanielYang59) +- Add missing functools.wraps decorator to deprecated decorator and handle dataclass properly (@DanielYang59) +- Add pint Quantity support to JSON (@rkingsbury) + ## 2024.7.12 - Make cached_class decorated classes picklable (@janosh) - deprecated decorator allow replacement as string (@DanielYang59) diff --git a/src/monty/__init__.py b/src/monty/__init__.py index f76150274..61a8d26eb 100644 --- a/src/monty/__init__.py +++ b/src/monty/__init__.py @@ -7,9 +7,16 @@ from __future__ import annotations +from importlib.metadata import PackageNotFoundError, version + __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2014, The Materials Virtual Lab" -__version__ = "2024.7.12" __maintainer__ = "Shyue Ping Ong" __email__ = "ongsp@ucsd.edu" __date__ = "Oct 12 2020" + +try: + __version__ = version("pymatgen") +except PackageNotFoundError: # pragma: no cover + # package is not installed + pass diff --git a/tasks.py b/tasks.py index aa3dc7911..82fd73e65 100755 --- a/tasks.py +++ b/tasks.py @@ -132,14 +132,6 @@ def commit(ctx: Context) -> None: @task def set_ver(ctx: Context) -> None: - with open("monty/__init__.py", encoding="utf-8") as f: - contents = f.read() - contents = re.sub( - r"__version__ = .*\n", '__version__ = "%s"\n' % NEW_VER, contents - ) - - with open("monty/__init__.py", "w", encoding="utf-8") as f: - f.write(contents) with open("pyproject.toml", encoding="utf-8") as f: contents = f.read()