diff --git a/plotid/publish.py b/plotid/publish.py index f67cf3ea11ef10def846eb2d840f15eb770b880b..2e38c25df151bc682c7eedf954446bcedc0b06da 100644 --- a/plotid/publish.py +++ b/plotid/publish.py @@ -13,6 +13,7 @@ import os import shutil import sys import warnings +from importlib.metadata import version from typing import TypedDict, Any from plotid.save_plot import save_plot from plotid.plotoptions import PlotIDTransfer, validate_list @@ -134,8 +135,7 @@ class PublishOptions: " – plot has already been published." ) overwrite_dir = input( - "Do you want to overwrite " - "the existing folder? " + "Do you want to overwrite the existing folder? " "(yes/no[default])\n" ) if overwrite_dir in ("yes", "y", "Yes", "YES"): @@ -155,10 +155,8 @@ class PublishOptions: os.rename(dst_path_invisible, dst_path) except FileExistsError as exc: delete_dir = input( - "There was an error while " - "publishing the data. Should the " - "partially copied data at " - f"{dst_path_invisible} be" + "There was an error while publishing the data. Should the " + f"partially copied data at {dst_path_invisible} be" " removed? (yes/no[default])\n" ) if delete_dir in ("yes", "y", "Yes", "YES"): @@ -287,7 +285,8 @@ class Analyzer(ast.NodeVisitor): # Write every item of the set to one line. with open(output_file, "w", encoding="utf-8") as output: for item in imports_as_set: - output.write(f"{item}\n") + module_version = version(item) + output.write(f"{item}=={module_version}\n") output.close()