Reference

HelpDev - Extracts information about the Python environment easily.

Authors:
Since:

2019/04/16

License:

MIT

helpdev.QT_ABSTRACTIONS = ['qtpy', 'pyqtgraph', 'Qt']

values of all Qt abstraction layers to import.

Type

list

helpdev.QT_BINDINGS = ['PyQt4', 'PyQt5', 'PySide', 'PySide2']

values of all Qt bindings to import.

Type

list

helpdev.check_conda()

Check Conda Python distribution information.

It is Python/Conda environment dependent.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_conda_packages(edit_mode=False, packages=None)

Check conda inslalled packages information filtering for packages.

It is Python/Conda environment dependent.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_float()

Check float limits information.

Get information from sys library.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_hardware()

Check hardware information.

It uses subprocess commands for each system along with psutil library. So you need to install psutil library.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_installed(import_list)

Return a list of installed packages from import_list.

Note that the strings in the list must match the import name, e.g. pyqt5 will not work as the import name is PyQt5.

Parameters

import_list (list(str)) – List of of import names to check installation.

Returns

Filtered list of installed packages.

Return type

list(str)

helpdev.check_int()

Check int limits information.

Get information from sys library.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_network(timeout)

Check network connection for URLS list with timeout.

Parameters

timeout (int) – timout in seconds.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_numbers()

Check numbers related float and integer information.

helpdev.check_os()

Check operating system information.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_path()

Check Python path from sys library.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_python()

Check Python information.

It is Python environment dependent. Get information from platform and sys libraries.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_python_packages(edit_mode=False, packages=None)

Check PIP installed packages filtering for packages.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_qt()

Check Qt related bindings and abstractions information.

helpdev.check_qt_abstractions()

Check all Qt abstractions related information.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_qt_bindings()

Check all Qt bindings related information.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_scope()

Check Python scope or dir().

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.check_thread()

Check threads information.

Get information from sys library.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.customize(package)

Get the custom filter from the package imported.

This is a way to promote a standard format to get a customized information from a specific package. This function try to import the package and run the public method get_custom_helpdev(help_dev_version='') from that package which gives a customized filter to provide the results.

For example, this line

info_dict = helpdev.customize('spyder')

will try this

from spyder import get_custom_helpdev
custom_filter = get_custom_helpdev(helpdev.__version__)

Then, it will apply that filter.

Parameters

package (str) – Import name to check installation.

Returns

Customized information from imported packages.

Return type

dict(str)

helpdev.filter_packages(dict_packages, expression)

Filter the dict_packages with expression regex.

In the expression, each item separated by comma is splitted and then surrounded parenthesis (i.e. group), then joined with OR (|). The expressions are finally started to match the begin until the end ignoring case (i). See the example below

expression = "sphinx.*,qtpy,PYQT5"

Then it will be processed resulting in

expression = "(?i:^((sphinx.*)|(qtpy)|(PYQT5))$)"

If the expression of all of them not match with the package name, this package is removed from the dict (a copy of it).

Parameters
  • dict_packages (dict) – Dictionary with package_name:version_number.

  • expression (str) – Regular expression separated by commas.

Returns

Filtered dict with that matches the expression.

Return type

dict(rst)

helpdev.installed_qt_abstractions()

Return a list of qt abstraction layers available.

Returns

Dictionary filled with respective information.

Return type

dict(str)

helpdev.installed_qt_bindings()

Return a list of qt bindings available.

Returns

List filled with respective information.

Return type

list(str)

helpdev.print_output(info_dict)

Print output in a nested list format.

helpdev.qt_abstraction_information(import_name)

Get abstraction layer version and binding (default or current if in use).

Note

  • The name of the installed package can differ from the import name. This is an weird thing from PIP/CONDA, e.g, the abstraction ‘qt.py’ is imported as ‘Qt’.

  • Since each package is build as it is, sometimes we are not able to define its information, e.g, Qt.py is installed but no binding is. This will cause an error that, for now, it is impossible to us to show any other information about it, e.g, version. We need to deal with a better way.

  • This function should be called with pre-defined list of installed packages passed throuw import_name, do not use it to try import.

Parameters

import_name (str) – Import name of abstraction for Qt.

Raises

ImportError – When the import is not found.

Returns

(abstraction version,

environment variable, binding variable, import name, status)

Return type

tuple

helpdev.qt_binding_information(import_name)

Get binding information of version and Qt version.

Note

The name of the installed package can differ from the import name. This is an weird thing from PIP/CONDA, e.g, the binding ‘pyqt5’ in PIP is ‘pyqt’ in Conda and both are imported as ‘PyQt5’.

Parameters

import_name (str) – Import name of binding for Qt.

Raises

ImportError – When the import is not found.

Returns

(binding version,

qt version)

Return type

tuple