31
31
compile
32
32
=================
33
33
34
- +-------------------+--------------------------------------------------+
35
- | Syntax | Description |
36
- +===================+==================================================+
37
- | ``-- | by default it excludes any ``test `` and |
38
- | input-path PATH`` | ``__init__.py `` files |
39
- +-------------------+--------------------------------------------------+
40
- | ` | Deletes the sources files. |
41
- | `--clean-source`` | |
42
- +-------------------+--------------------------------------------------+
43
- | ``--keep-builds `` | Keeps the temp build files. |
44
- +-------------------+--------------------------------------------------+
45
- | ``--cl | Deletes the shared objects (``.so ``) files. |
46
- | ean-executables`` | |
47
- +-------------------+--------------------------------------------------+
48
- | ``--engine `` | Can be ``cython `` or ``nuitka ``. |
49
- +-------------------+--------------------------------------------------+
50
- | ``--exc | Glob file patterns for excluding specific files. |
51
- | lude-glob-paths`` | |
52
- +-------------------+--------------------------------------------------+
53
- | ``--verbose `` | Increase log messages. |
54
- +-------------------+--------------------------------------------------+
55
-
56
34
.. code :: bash
57
35
58
36
pycompile -i your_python_files --clean-source --engine nuitka
73
51
74
52
pycompile -i input_path --engine nuitka
75
53
76
-
77
-
78
-
79
54
After the compilation the ``input `` dir will have the following
80
55
structure.
81
56
@@ -91,76 +66,18 @@ structure.
91
66
Benchmark
92
67
~~~~~~~~~
93
68
94
- +-----------------------+----------------------------------------------+
95
- | Syntax | Description |
96
- +=======================+==============================================+
97
- | ``--input-path PATH `` | by default it excludes any ``test `` and |
98
- | | ``__init__.py `` files |
99
- +-----------------------+----------------------------------------------+
100
- | ``--engine `` | Can be ``cython ``, ``nuitka ``, ``all `` or |
101
- | | ``none ``. |
102
- +-----------------------+----------------------------------------------+
103
- | ``--type `` | Can be ``memory `` , ``cpy ``, or ``both `` |
104
- +-----------------------+----------------------------------------------+
105
- | ``--verbose `` | Increase log messages. |
106
- +-----------------------+----------------------------------------------+
107
- | ``--profil | function name pattern for profiling defaults |
108
- | e_func_pattern TEXT`` | to ``benchmark `` |
109
- +-----------------------+----------------------------------------------+
110
-
111
69
For running a benchmark on the ``input-path `` use the following command:
112
70
113
71
.. code :: bash
114
72
115
73
pycompile benchmark -i src/examples -vvv
116
74
117
- which by default will start a ``memory `` and a ``cpu `` benchmark,
118
- starting with ``python `` and then with ``cython `` and ``nuitka ``
119
- The python package must have a ``test_module.py `` because both benchmark
120
- types are invoked with ``pytest `` runs
121
-
122
- - For **memory profiling ** the script will decorate all the functions
123
- in ``benchmark.py `` with the ``profile `` decorator from
124
- ``memory-profiler ``. This is not optimal memory profiling, because we
125
- don’t actually ``profile `` the function itself, instead we profile
126
- the ``caller `` but it’s necessary if we want to ``profile `` also the
127
- compiled code. Use the ``profile_func_pattern `` to specify the
128
- function to be profiled in different module for example if ``main ``
129
- is the entrypoint under ``main.py `` use
130
- ``--profile_func_pattern main ``.
131
-
132
- Hence, the following structure are required for the ``benchmark ``
133
- subcommand.
134
-
135
- - For **cpu profiling ** the same approached is being used, but instead
136
- of decorating the ``calling functions `` it ``decorates `` the test
137
- cases with the ``benchmark `` from ``pytest-benchmark ``.
138
-
139
- .. code :: text
140
-
141
- module
142
- ├── sample_funcs.py # implementation
143
- ├── main.py # entrypoint with a `main` function
144
- ├── test_sample_funcs.py # test cases
145
-
146
75
147
76
148
77
149
78
Dry run
150
79
~~~~~~~
151
80
152
- +-------------------+--------------------------------------------------+
153
- | Syntax | Description |
154
- +===================+==================================================+
155
- | ``-- | by default it excludes any ``test `` and |
156
- | input-path PATH`` | ``__init__.py `` files |
157
- +-------------------+--------------------------------------------------+
158
- | ``--exc | Glob file patterns for excluding specific files. |
159
- | lude-glob-paths`` | |
160
- +-------------------+--------------------------------------------------+
161
- | ``--verbose `` | Increase log messages. |
162
- +-------------------+--------------------------------------------------+
163
-
164
81
.. code :: bash
165
82
166
83
pycompile dry_run -i ./src
0 commit comments