Repository: piskvorky/gensim

Issue:
Add method for showing base info about gensim
Intro
----
When users report something, we need to know more information (not only gensim version, versions of related packages, OS and so on), and user need to copy-paste&run something like this

````
Please run the following snippet and paste the output below.
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import gensim; print("gensim", gensim.__version__)
from gensim.models import word2vec;print("FAST_VERSION", word2vec.FAST_VERSION)
````

We can easily add it as method to gensim and use as `python -m gensim.scripts.package_info --info`

Todo
-------
Implement this method, information, that should be showed
- gensim version
- python version
- numpy version
- scipy version
- os version
- smart_open version
- `FAST_VERSION` variable
- path (where gensim installed)
- ??? (maybe something else)



Add method for showing base info about gensim
Intro
----
When users report something, we need to know more information (not only gensim version, versions of related packages, OS and so on), and user need to copy-paste&run something like this

````
Please run the following snippet and paste the output below.
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import gensim; print("gensim", gensim.__version__)
from gensim.models import word2vec;print("FAST_VERSION", word2vec.FAST_VERSION)
````

We can easily add it as method to gensim and use as `python -m gensim.scripts.package_info --info`

Todo
-------
Implement this method, information, that should be showed
- gensim version
- python version
- numpy version
- scipy version
- os version
- smart_open version
- `FAST_VERSION` variable
- path (where gensim installed)
- ??? (maybe something else)





Discussion:
I am taking this up.
I am taking this up.

Resolving patch:
diff --git a/gensim/__init__.py b/gensim/__init__.py
--- a/gensim/__init__.py
+++ b/gensim/__init__.py
@@ -1,8 +1,7 @@
-"""
-This package contains interfaces and functionality to compute pair-wise document
-similarities within a corpus of documents.
-"""
+"""This package contains interfaces and functionality to compute pair-wise document similarities within a corpus
+of documents.
 
+"""
 from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization, utils  # noqa:F401
 import logging
 
diff --git a/gensim/scripts/package_info.py b/gensim/scripts/package_info.py
new file mode 100644
--- /dev/null
+++ b/gensim/scripts/package_info.py
@@ -0,0 +1,60 @@
+"""Get basic information about gensim & dependencies (useful for bug-reporting).
+
+Examples
+--------
+You can use it through python
+
+>>> from gensim.scripts.package_info import package_info
+>>>
+>>> info = package_info()
+
+or using CLI interface
+
+::
+
+    python -m gensim.scripts.package_info --info
+
+
+.. program-output:: python -m gensim.scripts.package_info --help
+   :ellipsis: 0, -4
+"""
+import argparse
+import platform
+import sys
+import os
+import numpy
+import scipy
+import gensim
+from gensim.models.word2vec import FAST_VERSION
+
+
+def package_info():
+    """Get the versions of Gensim and its dependencies,
+    the location where Gensim is installed and platform on which the system is running.
+
+    Returns
+    -------
+    dict of (str, str)
+        Dictionary containing the versions of Gensim, Python, NumPy, SciPy and platform information.
+
+    """
+    return {
+        "Platform": platform.platform(),
+        "Python": sys.version.replace("\n", ', '),
+        "NumPy": numpy.__version__,
+        "SciPy": scipy.__version__,
+        "Gensim": gensim.__version__,
+        "Location": os.path.abspath(__file__),
+        "FAST_VERSION": FAST_VERSION
+    }
+
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description=__doc__[:-65], formatter_class=argparse.RawDescriptionHelpFormatter)
+    parser.add_argument("--info", help="Information about Gensim package", action="store_true")
+    args = parser.parse_args()
+
+    if args.info:
+        print("Gensim installation information\n")
+        for (k, v) in sorted(package_info().items()):
+            print("{}: {}".format(k, v))


Test patch: