Debian Codegraph @

docs/tutorials/customizing.rst

raw
1 Customizing for your application
2 --------------------------------
3
4 You can use this tool to provide a easy way to the users get necessary
5 information about their environment when reporting bugs. Even if developers
6 can use it to *easilly* get all the information necessary.
7
8 1. Add ``helpdev`` to your list of requirements in ``setup.py``
9
10 .. code-block:: Python
11
12 # ...
13
14 install_requires=['helpdev'...]
15
16 # ...
17
18
19 2. Import ``helpdev`` functions that are important for you
20
21 .. code-block:: Python
22
23 # ...
24
25 import helpdev
26
27 report_dict = {}
28
29 # get basic information updating the dictionary
30 report_dict.update(helpdev.check_hardware())
31 report_dict.update(helpdev.check_os())
32 report_dict.update(helpdev.check_python())
33 report_dict.update(helpdev.check_qt_bindings())
34 report_dict.update(helpdev.check_qt_abstractions())
35
36 # list of important packages for your app
37 # note that you can use regex (spyder.*)
38 packages = "spyder.*,ipython,cython,jedi,matplotlib,numpy,pandas,"
39 "psutil,pycodestyle,pyflakes,pygments,pylint,qtconsole,"
40 "rope,sphinx,sympy"
41
42 # get filtered information for those packages
43 report_dict.update(helpdev.check_python_packages(packages))
44
45 # ...
46
47
48 3. You can use, then, the dictionary-like information or print it
49
50 .. code-block:: Python
51
52 # ...
53
54 # printing the output in the terminal
55 helpdev.print_output(report_dict)
56
57 # ...
58
59 4. The output for this example is, then
60
61
62 .. code-block:: console
63
64 * HARDWARE-----------------------------------------------------------------------
65 - Machine....................... x86_64
66 - Processor..................... Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
67 - Total Memory.................. 16689 MB
68 - Free Memory................... 534 MB
69 - Total Swap.................... 19999 MB
70 - Free Swap..................... 19999 MB
71 * OPERATING SYSTEM---------------------------------------------------------------
72 - System........................ Linux
73 - Release....................... 4.15.0-48-generic
74 - Platform...................... Linux-4.15.0-48-generic-x86_64-with-debian-buster-sid
75 - Version....................... #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019
76 * PYTHON DISTRIBUTION------------------------------------------------------------
77 - Version....................... 3.6.8
78 - C Compiler.................... GCC 7.3.0
79 - C API Version................. 1013
80 - Implementation................ cpython
81 - Implementation Version........ 3.6.8
82 * QT BINDINGS--------------------------------------------------------------------
83 - PyQt5 Version................. 5.12.2
84 - PyQt5 Qt Version.............. 5.12.3
85 * QT ABSTRACTIONS----------------------------------------------------------------
86 - qtpy Version.................. 1.7.1
87 - qtpy Binding.................. pyqt5
88 - qtpy Binding Variable......... os.environ['QT_API']
89 - qtpy Import Name.............. qtpy
90 - qtpy Status................... OK
91 - pyqtgraph Version............. 0.10.0
92 - pyqtgraph Binding............. Not set or inexistent
93 - pyqtgraph Binding Variable.... os.environ['PYQTGRAPH_QT_LIB']
94 - pyqtgraph Import Name......... pyqtgraph
95 - pyqtgraph Status.............. OK
96 - Qt Version.................... 1.1.0
97 - Qt Binding.................... PyQt5
98 - Qt Binding Variable........... Qt.__binding__
99 - Qt Import Name................ Qt
100 - Qt Status..................... OK
101 * PYTHON PACKAGES----------------------------------------------------------------
102 - ipython....................... 7.5.0
103 - jedi.......................... 0.13.3
104 - numpy......................... 1.16.3
105 - psutil........................ 5.6.2
106 - pycodestyle................... 2.5.0
107 - pyflakes...................... 2.1.1
108 - Pygments...................... 2.3.1
109 - qtconsole..................... 4.4.4
110 - rope.......................... 0.14.0
111 - Sphinx........................ 2.0.1
112 - spyder........................ 3.3.4
113 - spyder-kernels................ 0.4.4
114
115
116 You can obtain the same output using the command-line options as follows
117
118 .. code-block:: console
119
120 helpdev --hardware --os --python --qt
121
122 helpdev --packages="spyder.*,ipython,cython,jedi,matplotlib,numpy,
123 pandas,psutil,pycodestyle,pyflakes,pygments,
124 pylint,qtconsole,rope,sphinx,sympy"
125
126
127 In this example, the packages list was created from the Spyder dependencies
128 list and *about* which can be seem below:
129
130
131 .. image:: ../images/spyder-dep-list.png
132
133
134 .. image:: ../images/spyder-about.png
135 :width: 400