|
17 | 17 | " - [pyext directory (Python interface)](#pyext)\n", |
18 | 18 | " - [Documentation](#documentation)\n", |
19 | 19 | " - [test directory (test cases)](#test)\n", |
| 20 | + " - [bin directory (command line tools)](#bin)\n", |
20 | 21 | " - [Dependencies](#depends)\n", |
| 22 | + " - [Pure Python modules](#pyonly)\n", |
21 | 23 | " - [Source control](#sourcecontrol)\n", |
22 | 24 | " - [Build and test](#buildtest)\n", |
23 | 25 | " - [Automatic testing](#autotest)\n", |
|
276 | 278 | "(For reference, the whole file is also available [at GitHub](https://github.com/salilab/imp_coding_tutorial/tree/main/modules/foo/pyext/swig.i-in))." |
277 | 279 | ] |
278 | 280 | }, |
| 281 | + { |
| 282 | + "cell_type": "markdown", |
| 283 | + "metadata": {}, |
| 284 | + "source": [ |
| 285 | + "> You can also add arbitrary Python code to your module. This is added to the `swig.i-in` file using the SWIG `%pythoncode` directive. See the [PMI module](https://github.com/salilab/pmi/blob/develop/pyext/swig.i-in) for an example.\n", |
| 286 | + ">\n", |
| 287 | + "> You can also add entire Python submodules by adding Python files to the `pyext/src` subdirectory. For example the file `pyext/src/my_python.py` can be imported in Python using `import IMP.foo.my_python`. This is also [used in the PMI module](https://github.com/salilab/pmi/tree/develop/pyext/src)." |
| 288 | + ] |
| 289 | + }, |
279 | 290 | { |
280 | 291 | "cell_type": "markdown", |
281 | 292 | "metadata": {}, |
|
374 | 385 | "(For reference, the whole file is also available [at GitHub](https://github.com/salilab/imp_coding_tutorial/tree/main/modules/foo/test/test_restraint.py))." |
375 | 386 | ] |
376 | 387 | }, |
| 388 | + { |
| 389 | + "cell_type": "markdown", |
| 390 | + "metadata": {}, |
| 391 | + "source": [ |
| 392 | + "# bin directory (command line tools)<a id=\"bin\"></a>\n", |
| 393 | + "\n", |
| 394 | + "IMP modules can include command line tools. We don't include any such tools in this module, but to add a tool, add a C++ or Python file to the `bin` directory. The tool will be compiled if needed and then installed with the rest of IMP in the binary directory (e.g. `/usr/local/bin`). See the [FoXS module](https://github.com/salilab/imp/tree/develop/modules/foxs/bin) for an example C++ command line tool and the [em module](https://github.com/salilab/imp/tree/develop/modules/em/bin) for example Python tools.\n", |
| 395 | + "\n", |
| 396 | + "> Usually command line tools are all installed in the same directory, so take care to give each program a fairly unique name so as not to conflict with other IMP programs or the operating system itself." |
| 397 | + ] |
| 398 | + }, |
377 | 399 | { |
378 | 400 | "cell_type": "markdown", |
379 | 401 | "metadata": {}, |
|
400 | 422 | "(For reference, the whole file is also available [at GitHub](https://github.com/salilab/imp_coding_tutorial/tree/main/modules/foo/dependencies.py))." |
401 | 423 | ] |
402 | 424 | }, |
| 425 | + { |
| 426 | + "cell_type": "markdown", |
| 427 | + "metadata": {}, |
| 428 | + "source": [ |
| 429 | + "# Pure Python modules<a id=\"pyonly\"></a>\n", |
| 430 | + "\n", |
| 431 | + "If there is no C++ code in your module at all - i.e. it is pure Python - then you can speed up building of your module by marking it as Python only. This is done by adding `python_only = True` to the `dependencies.py` file. SWIG is not used in Python-only modules; instead, put any Python code you want in the top-level module in the `pyext/src/__init__.py` file. For an example, see the [IMP.test module](https://github.com/salilab/imp/tree/develop/modules/test). See the [IMP manual](https://integrativemodeling.org/2.20.1/doc/manual/pyonlymod.html) for more information." |
| 432 | + ] |
| 433 | + }, |
403 | 434 | { |
404 | 435 | "cell_type": "markdown", |
405 | 436 | "metadata": {}, |
|
592 | 623 | "name": "python", |
593 | 624 | "nbconvert_exporter": "python", |
594 | 625 | "pygments_lexer": "ipython3", |
595 | | - "version": "3.11.4" |
| 626 | + "version": "3.12.1" |
596 | 627 | } |
597 | 628 | }, |
598 | 629 | "nbformat": 4, |
|
0 commit comments