Mercurial > hg > orthanc-book
changeset 1090:9fdd3714efc1
python 4.3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Jul 2024 11:02:30 +0200 |
parents | b152822fc3cd |
children | e70e9f412627 |
files | Sphinx/source/plugins/java.rst Sphinx/source/plugins/python.rst |
diffstat | 2 files changed, 40 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Sphinx/source/plugins/java.rst Wed Jul 03 18:36:15 2024 +0200 +++ b/Sphinx/source/plugins/java.rst Thu Jul 04 11:02:30 2024 +0200 @@ -22,9 +22,9 @@ using the `Clang <https://en.wikipedia.org/wiki/Clang>`__ compiler front-end. -As of release 1.0 of the plugin, the coverage of the C SDK is about -76% (122 functions are automatically wrapped in Java out of a total of -160 functions from the Orthanc SDK 1.10.0). +As of release 1.0 of the plugin, **the coverage of the C SDK is about +74%** (122 functions are automatically wrapped in Java out of a total +of 165 functions from the Orthanc SDK 1.10.0). **For researchers**: `Please cite this paper <https://doi.org/10.5220/0012384600003657>`__.
--- a/Sphinx/source/plugins/python.rst Wed Jul 03 18:36:15 2024 +0200 +++ b/Sphinx/source/plugins/python.rst Thu Jul 04 11:02:30 2024 +0200 @@ -22,9 +22,11 @@ using the `Clang <https://en.wikipedia.org/wiki/Clang>`__ compiler front-end. -As of release 3.2 of the plugin, the coverage of the C SDK is about -87% (138 functions are automatically wrapped in Python out of a total -of 158 functions from the Orthanc SDK 1.8.1). +As of release 4.3 of the plugin, **the coverage of the C SDK is about +85%** (140 functions are automatically wrapped in Python out of a +total of 165 functions from the Orthanc SDK 1.10.0). Starting with +release 4.3, the code model that is used to generate the Python +wrapper is shared with the :ref:`Java wrapper <java-plugin>`. Source code @@ -36,6 +38,11 @@ * Link to the `code repository <https://orthanc.uclouvain.be/hg/orthanc-python/>`__. +* Link to the `Python interface + <https://orthanc.uclouvain.be/downloads/cross-platform/orthanc-python/index.html>`__ + (cf. :ref:`below <python-code-completion>` for more information + about the ``orthanc.pyi`` file). + Licensing --------- @@ -241,7 +248,8 @@ "Python" : { "Path" : "my-plugin.py", // Alias for the global "PythonScript" option "Verbose" : false, // Alias for the global "PythonVerbose" option - "DisplayMemoryUsage" : false + "DisplayMemoryUsage" : false, + "AllowThreads" : false } } @@ -249,12 +257,37 @@ of the plugin. If set to ``true``, Orthanc will display the memory usage of the Python interpreter every second. +The option ``Python.AllowThreads`` was introduced in release 4.3 of +the plugin. If set to ``true``, the Python GIL (`Global Interpreter +Lock <https://en.wikipedia.org/wiki/Global_interpreter_lock>`__) is +released during the calls to the native SDK. **This allows multiple +Python threads to simultaneously access the Orthanc core.** However, +this might concurrency issues: Make sure that your Python code is +**thread-safe** before enabling this option! + .. warning:: Never call your Python plugin ``orthanc.py``! Otherwise, your plugin will conflict with the ``orthanc`` module that is installed at runtime. +.. _python-code-completion: + +Documentation and code completion +--------------------------------- + +Starting with release 4.3 of the Python plugin for Orthanc, a `Python +interface (cf. PEP 484 - Type Hints) +<https://peps.python.org/pep-0484/>`__ is available. By downloading +the file ``orthanc.pyi`` `from this location +<https://orthanc.uclouvain.be/downloads/cross-platform/orthanc-python/index.html>`__ +and putting it in the same folder as your Python script, your IDE will +provide you code completion, as well as full documentation of the +Orthanc SDK in the Python language. This file is notably known to work +with Visual Studio Code and PyCharm. + + + Samples -------