diff --git a/news/remove-userconfig.rst b/news/remove-userconfig.rst new file mode 100644 index 00000000..967d9559 --- /dev/null +++ b/news/remove-userconfig.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* `user_config.py`. Replaced by `_load_config` and `check_and_build_global_config` in `tools.py`. + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/diffpy/utils/user_config.py b/src/diffpy/utils/user_config.py deleted file mode 100644 index ca2cc004..00000000 --- a/src/diffpy/utils/user_config.py +++ /dev/null @@ -1,30 +0,0 @@ -import json -from pathlib import Path - -CONFIG_FILE = "diffpyconfig.json" -CWD_CONFIG_PATH = Path.cwd() / CONFIG_FILE -HOME_CONFIG_PATH = Path.home() / CONFIG_FILE - - -def find_conf_file(): - if CWD_CONFIG_PATH.exists() and CWD_CONFIG_PATH.is_file(): - return CWD_CONFIG_PATH - elif HOME_CONFIG_PATH.exists() and HOME_CONFIG_PATH.is_file(): - return HOME_CONFIG_PATH - return None - - -def read_conf_file(): - conf_file = find_conf_file() - if conf_file: - with open(conf_file, "r") as f: - config = json.load(f) - if not config.get("username") or not config.get("email"): - raise ValueError("Please provide a configuration file with username and email.") - return config.get("username"), config.get("email") - return None, None - - -def write_conf_file(username, email): - with open(HOME_CONFIG_PATH, "w") as f: - json.dump({"username": username, "email": email}, f)