Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added about() functionality for qutip_qip #1870

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions doc/changes/1870.feature
@@ -0,0 +1 @@
Added about() functionality for qutip_qip
15 changes: 15 additions & 0 deletions qutip/about.py
Expand Up @@ -11,12 +11,14 @@
import inspect
from qutip.utilities import _blas_info, available_cpu_count
import qutip.settings
import pkg_resources


def about():
"""
About box for QuTiP. Gives version numbers for QuTiP, NumPy, SciPy, Cython,
and MatPlotLib.
Also provides information about installed family packages like qutip-qip.
"""
print("")
print("QuTiP: Quantum Toolbox in Python")
Expand Down Expand Up @@ -61,6 +63,19 @@ def about():
qutip_install_path = os.path.dirname(inspect.getsourcefile(qutip))
print("Installation path: %s" % qutip_install_path)

# family packages
entrypoints = pkg_resources.iter_entry_points('qutip.about')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use importlib rather than pkg_resources as stated in their documentation. The latter might be deprecated in the future.

for ep in entrypoints:
about_func = ep.load()
try:
title, lines = about_func()
except Exception as exc:
title, lines = ep.name, [str(exc)]
print()
print(title)
for line in lines:
print(line)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(line)
print(line)
print()

Add an empty line incase there are other family packages


# citation
longbar = "=" * 80
cite_msg = "For your convenience a bibtex reference can be easily"
Expand Down