.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.36.3 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit-python-plugin 3" .TH nbdkit-python-plugin 3 2024-01-17 nbdkit-1.36.3 NBDKIT .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME nbdkit\-python\-plugin \- nbdkit python plugin .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& nbdkit python /path/to/plugin.py [arguments...] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-python\-plugin\*(C'\fR is an embedded Python interpreter for \&\fBnbdkit\fR\|(1), allowing you to write nbdkit plugins in Python 3. .SS "If you have been given an nbdkit Python plugin" .IX Subsection "If you have been given an nbdkit Python plugin" Assuming you have a Python script which is an nbdkit plugin, you run it like this: .PP .Vb 1 \& nbdkit python /path/to/plugin.py .Ve .PP You may have to add further \f(CW\*(C`key=value\*(C'\fR arguments to the command line. Read the Python script to see if it requires any. .SH "WRITING A PYTHON NBDKIT PLUGIN" .IX Header "WRITING A PYTHON NBDKIT PLUGIN" For example plugins written in Python, see: https://gitlab.com/nbdkit/nbdkit/blob/master/plugins/python/examples .PP Broadly speaking, Python nbdkit plugins work like C ones, so you should read \fBnbdkit\-plugin\fR\|(3) first. .PP To write a Python nbdkit plugin, you create a Python file which contains at least the following required functions (in the top level \&\f(CW\*(C`_\|_main_\|_\*(C'\fR module): .PP .Vb 7 \& API_VERSION = 2 \& def open(readonly): \& # see below \& def get_size(h): \& # see below \& def pread(h, buf, offset, flags): \& # see below .Ve .PP Note that the subroutines must have those literal names (like \f(CW\*(C`open\*(C'\fR), because the C part looks up and calls those functions directly. You may want to include documentation and globals (eg. for storing global state). Any other top level statements are run when the script is loaded, just like ordinary Python. .SS "Python versions" .IX Subsection "Python versions" Since nbdkit ≥ 1.16 only Python 3 is supported. If you wish to continue using nbdkit plugins written in Python 2 then you must use nbdkit ≤ 1.14, but we advise you to update your plugins. .PP The version of Python 3 is chosen when nbdkit is built. This is compiled in and can't be changed at runtime. \f(CW\*(C`./configure\*(C'\fR looks for (in order): .IP \(bu 4 the \f(CW\*(C`PYTHON\*(C'\fR variable (eg \f(CW\*(C`./configure PYTHON=/usr/bin/python3.9\*(C'\fR) .IP \(bu 4 \&\fIpython3\fR on \f(CW$PATH\fR .IP \(bu 4 \&\fIpython\fR on \f(CW$PATH\fR .PP \&\f(CW\*(C`./configure\*(C'\fR will fail if the first interpreter found is a Python 2 interpreter. .PP To find out which version of Python \f(CW\*(C`nbdkit\-python\-plugin\*(C'\fR was compiled for, use the \fI\-\-dump\-plugin\fR option: .PP .Vb 4 \& $ nbdkit python \-\-dump\-plugin \& ... \& python_version=3.7.0 \& python_pep_384_abi_version=3 .Ve .SS "API versions" .IX Subsection "API versions" The nbdkit API has evolved and new versions are released periodically. To ensure backwards compatibility plugins have to opt in to the new version. From Python you do this by declaring a constant in your module: .PP .Vb 1 \& API_VERSION = 2 .Ve .PP (where 2 is the latest version at the time this documentation was written). All newly written Python modules must have this constant. .SS "Executable script" .IX Subsection "Executable script" If you want you can make the script executable and include a "shebang" at the top: .PP .Vb 1 \& #!/usr/sbin/nbdkit python .Ve .PP See also "Shebang scripts" in \fBnbdkit\fR\|(1). .PP These scripts can also be installed in the \f(CW$plugindir\fR. See "WRITING PLUGINS IN OTHER PROGRAMMING LANGUAGES" in \fBnbdkit\-plugin\fR\|(3). .SS "Module functions" .IX Subsection "Module functions" Your script may use \f(CW\*(C`import nbdkit\*(C'\fR to have access to the following methods in the \f(CW\*(C`nbdkit\*(C'\fR module: .PP \fR\f(CI\*(C`nbdkit.debug(msg)\*(C'\fR\fI\fR .IX Subsection "nbdkit.debug(msg)" .PP Send a debug message to stderr or syslog if verbose messages are enabled. .PP \fR\f(CI\*(C`nbdkit.disconnect(force)\*(C'\fR\fI\fR .IX Subsection "nbdkit.disconnect(force)" .PP Disconnect from the client. If \f(CW\*(C`force\*(C'\fR is \f(CW\*(C`True\*(C'\fR then nbdkit will disconnect the client immediately. .PP \fR\f(CI\*(C`nbdkit.export_name()\*(C'\fR\fI\fR .IX Subsection "nbdkit.export_name()" .PP Return the export name negotiated with the client as a Unicode string. Note this should not be trusted because the client can send whatever it wants. .PP \fR\f(CI\*(C`nbdkit.parse_size(str)\*(C'\fR\fI\fR .IX Subsection "nbdkit.parse_size(str)" .PP Parse a string (such as "100M") into a size in bytes. Wraps the \&\f(CWnbdkit_parse_size()\fR C function. .PP \fR\f(CI\*(C`nbdkit.parse_probability(what, str)\*(C'\fR\fI\fR .IX Subsection "nbdkit.parse_probability(what, str)" .PP Parse a string (such as "100%") into a probability, returning a floating point number. Wraps the \f(CWnbdkit_parse_probability()\fR C function. .PP \fR\f(CI\*(C`nbdkit.set_error(err)\*(C'\fR\fI\fR .IX Subsection "nbdkit.set_error(err)" .PP Record \f(CW\*(C`err\*(C'\fR as the reason you are about to throw an exception. \f(CW\*(C`err\*(C'\fR should correspond to usual errno values, where it may help to \&\f(CW\*(C`import errno\*(C'\fR. .PP \fR\f(CI\*(C`nbdkit.shutdown()\*(C'\fR\fI\fR .IX Subsection "nbdkit.shutdown()" .PP Request asynchronous server shutdown. .SS "Module constants" .IX Subsection "Module constants" After \f(CW\*(C`import nbdkit\*(C'\fR the following constants are available. These are used in the callbacks below. .ie n .IP """nbdkit.THREAD_MODEL_SERIALIZE_CONNECTIONS""" 4 .el .IP \f(CWnbdkit.THREAD_MODEL_SERIALIZE_CONNECTIONS\fR 4 .IX Item "nbdkit.THREAD_MODEL_SERIALIZE_CONNECTIONS" .PD 0 .ie n .IP """nbdkit.THREAD_MODEL_SERIALIZE_ALL_REQUESTS""" 4 .el .IP \f(CWnbdkit.THREAD_MODEL_SERIALIZE_ALL_REQUESTS\fR 4 .IX Item "nbdkit.THREAD_MODEL_SERIALIZE_ALL_REQUESTS" .ie n .IP """nbdkit.THREAD_MODEL_SERIALIZE_REQUESTS""" 4 .el .IP \f(CWnbdkit.THREAD_MODEL_SERIALIZE_REQUESTS\fR 4 .IX Item "nbdkit.THREAD_MODEL_SERIALIZE_REQUESTS" .ie n .IP """nbdkit.THREAD_MODEL_PARALLEL""" 4 .el .IP \f(CWnbdkit.THREAD_MODEL_PARALLEL\fR 4 .IX Item "nbdkit.THREAD_MODEL_PARALLEL" .PD Possible return values from \f(CWthread_model()\fR. .ie n .IP """nbdkit.FLAG_MAY_TRIM""" 4 .el .IP \f(CWnbdkit.FLAG_MAY_TRIM\fR 4 .IX Item "nbdkit.FLAG_MAY_TRIM" .PD 0 .ie n .IP """nbdkit.FLAG_FUA""" 4 .el .IP \f(CWnbdkit.FLAG_FUA\fR 4 .IX Item "nbdkit.FLAG_FUA" .ie n .IP """nbdkit.FLAG_REQ_ONE""" 4 .el .IP \f(CWnbdkit.FLAG_REQ_ONE\fR 4 .IX Item "nbdkit.FLAG_REQ_ONE" .ie n .IP """nbdkit.FLAG_FAST_ZERO""" 4 .el .IP \f(CWnbdkit.FLAG_FAST_ZERO\fR 4 .IX Item "nbdkit.FLAG_FAST_ZERO" .PD Flags bitmap passed to certain plugin callbacks. Not all callbacks with a flags parameter use all of these flags, consult the documentation below and \fBnbdkit\-plugin\fR\|(3). .ie n .IP """nbdkit.FUA_NONE""" 4 .el .IP \f(CWnbdkit.FUA_NONE\fR 4 .IX Item "nbdkit.FUA_NONE" .PD 0 .ie n .IP """nbdkit.FUA_EMULATE""" 4 .el .IP \f(CWnbdkit.FUA_EMULATE\fR 4 .IX Item "nbdkit.FUA_EMULATE" .ie n .IP """nbdkit.FUA_NATIVE""" 4 .el .IP \f(CWnbdkit.FUA_NATIVE\fR 4 .IX Item "nbdkit.FUA_NATIVE" .PD Possible return values from \f(CWcan_fua()\fR. .ie n .IP """nbdkit.CACHE_NONE""" 4 .el .IP \f(CWnbdkit.CACHE_NONE\fR 4 .IX Item "nbdkit.CACHE_NONE" .PD 0 .ie n .IP """nbdkit.CACHE_EMULATE""" 4 .el .IP \f(CWnbdkit.CACHE_EMULATE\fR 4 .IX Item "nbdkit.CACHE_EMULATE" .ie n .IP """nbdkit.CACHE_NATIVE""" 4 .el .IP \f(CWnbdkit.CACHE_NATIVE\fR 4 .IX Item "nbdkit.CACHE_NATIVE" .PD Possible return values from \f(CWcan_cache()\fR. .ie n .IP """nbdkit.EXTENT_HOLE""" 4 .el .IP \f(CWnbdkit.EXTENT_HOLE\fR 4 .IX Item "nbdkit.EXTENT_HOLE" .PD 0 .ie n .IP """nbdkit.EXTENT_ZERO""" 4 .el .IP \f(CWnbdkit.EXTENT_ZERO\fR 4 .IX Item "nbdkit.EXTENT_ZERO" .PD Used in the \f(CW\*(C`type\*(C'\fR field returned by \f(CWextents()\fR. .SS Threads .IX Subsection "Threads" The thread model for Python callbacks defaults to \&\f(CW\*(C`nbdkit.THREAD_MODEL_SERIALIZE_ALL_REQUESTS\*(C'\fR. .PP Since nbdkit\ 1.22 it has been possible to set this by implementing a \f(CWthread_model()\fR function which returns one of the constants \&\f(CW\*(C`nbdkit.THREAD_MODEL_*\*(C'\fR. .PP The Python Global Interpreter Lock (GIL) is still used, so Python code does not run in parallel. However if a plugin callback calls a library which blocks (eg. to make an HTTP request), then another callback might be executed in parallel. Plugins which use \&\f(CW\*(C`nbdkit.THREAD_MODEL_SERIALIZE_REQUESTS\*(C'\fR or \&\f(CW\*(C`nbdkit.THREAD_MODEL_PARALLEL\*(C'\fR may need to use locks on shared data. .SS Exceptions .IX Subsection "Exceptions" Python callbacks should throw exceptions to indicate errors. Remember to use \f(CW\*(C`nbdkit.set_error\*(C'\fR if you need to control which error is sent back to the client; if omitted, the client will see an error of \f(CW\*(C`EIO\*(C'\fR. .SS "Python callbacks" .IX Subsection "Python callbacks" This just documents the arguments to the callbacks in Python, and any way that they differ from the C callbacks. In all other respects they work the same way as the C callbacks, so you should go and read \&\fBnbdkit\-plugin\fR\|(3). .ie n .IP """dump_plugin""" 4 .el .IP \f(CWdump_plugin\fR 4 .IX Item "dump_plugin" (Optional) .Sp There are no arguments or return value. .ie n .IP """config""" 4 .el .IP \f(CWconfig\fR 4 .IX Item "config" (Optional) .Sp .Vb 2 \& def config(key, value): \& # no return value .Ve .ie n .IP """config_complete""" 4 .el .IP \f(CWconfig_complete\fR 4 .IX Item "config_complete" (Optional) .Sp There are no arguments or return value. .ie n .IP """thread_model""" 4 .el .IP \f(CWthread_model\fR 4 .IX Item "thread_model" (Optional, nbdkit ≥ 1.22) .Sp .Vb 2 \& def thread_model(): \& return nbdkit.THEAD_MODEL_SERIALIZE_ALL_REQUESTS .Ve .Sp See "Threads" above. .ie n .IP """get_ready""" 4 .el .IP \f(CWget_ready\fR 4 .IX Item "get_ready" (Optional) .Sp There are no arguments or return value. .ie n .IP """after_fork""" 4 .el .IP \f(CWafter_fork\fR 4 .IX Item "after_fork" (Optional, nbdkit ≥ 1.26) .Sp There are no arguments or return value. .ie n .IP """cleanup""" 4 .el .IP \f(CWcleanup\fR 4 .IX Item "cleanup" (Optional, nbdkit ≥ 1.28) .Sp There are no arguments or return value. .ie n .IP """list_exports""" 4 .el .IP \f(CWlist_exports\fR 4 .IX Item "list_exports" (Optional) .Sp .Vb 4 \& def list_exports(readonly, is_tls): \& # return an iterable object (eg. list) of \& # (name, description) tuples or bare names: \& return [ (name1, desc1), name2, (name3, desc3), ... ] .Ve .ie n .IP """default_export""" 4 .el .IP \f(CWdefault_export\fR 4 .IX Item "default_export" (Optional) .Sp .Vb 3 \& def default_export(readonly, is_tls): \& # return a string \& return "name" .Ve .ie n .IP """preconnect""" 4 .el .IP \f(CWpreconnect\fR 4 .IX Item "preconnect" (Optional, nbdkit ≥ 1.26) .Sp .Vb 2 \& def preconnect(readonly): \& # no return value .Ve .ie n .IP """open""" 4 .el .IP \f(CWopen\fR 4 .IX Item "open" (Required) .Sp .Vb 2 \& def open(readonly): \& # return handle .Ve .Sp You can return any Python value (even \f(CW\*(C`None\*(C'\fR) as the handle. It is passed back as the first arg \f(CW\*(Aqh\*(Aq\fR in subsequent calls. To return an error from this method you must throw an exception. .ie n .IP """close""" 4 .el .IP \f(CWclose\fR 4 .IX Item "close" (Optional) .Sp .Vb 2 \& def close(h): \& # no return value .Ve .Sp After \f(CW\*(C`close\*(C'\fR returns, the reference count of the handle is decremented in the C part, which usually means that the handle and its contents will be garbage collected. .ie n .IP """export_description""" 4 .el .IP \f(CWexport_description\fR 4 .IX Item "export_description" (Optional) .Sp .Vb 3 \& def export_description(h): \& # return a string \& return "description" .Ve .ie n .IP """get_size""" 4 .el .IP \f(CWget_size\fR 4 .IX Item "get_size" (Required) .Sp .Vb 2 \& def get_size(h): \& # return the size of the disk .Ve .ie n .IP """block_size""" 4 .el .IP \f(CWblock_size\fR 4 .IX Item "block_size" (Option) .Sp .Vb 2 \& def block_size(h): \& # return triple (minimum, preferred, maximum) block size .Ve .ie n .IP """is_rotational""" 4 .el .IP \f(CWis_rotational\fR 4 .IX Item "is_rotational" (Optional) .Sp .Vb 2 \& def is_rotational(h): \& # return a boolean .Ve .ie n .IP """can_multi_conn""" 4 .el .IP \f(CWcan_multi_conn\fR 4 .IX Item "can_multi_conn" (Optional) .Sp .Vb 2 \& def can_multi_conn(h): \& # return a boolean .Ve .ie n .IP """can_write""" 4 .el .IP \f(CWcan_write\fR 4 .IX Item "can_write" (Optional) .Sp .Vb 2 \& def can_write(h): \& # return a boolean .Ve .ie n .IP """can_flush""" 4 .el .IP \f(CWcan_flush\fR 4 .IX Item "can_flush" (Optional) .Sp .Vb 2 \& def can_flush(h): \& # return a boolean .Ve .ie n .IP """can_trim""" 4 .el .IP \f(CWcan_trim\fR 4 .IX Item "can_trim" (Optional) .Sp .Vb 2 \& def can_trim(h): \& # return a boolean .Ve .ie n .IP """can_zero""" 4 .el .IP \f(CWcan_zero\fR 4 .IX Item "can_zero" (Optional) .Sp .Vb 2 \& def can_zero(h): \& # return a boolean .Ve .ie n .IP """can_fast_zero""" 4 .el .IP \f(CWcan_fast_zero\fR 4 .IX Item "can_fast_zero" (Optional) .Sp .Vb 2 \& def can_fast_zero(h): \& # return a boolean .Ve .ie n .IP """can_fua""" 4 .el .IP \f(CWcan_fua\fR 4 .IX Item "can_fua" (Optional) .Sp .Vb 3 \& def can_fua(h): \& # return nbdkit.FUA_NONE or nbdkit.FUA_EMULATE \& # or nbdkit.FUA_NATIVE .Ve .ie n .IP """can_cache""" 4 .el .IP \f(CWcan_cache\fR 4 .IX Item "can_cache" (Optional) .Sp .Vb 3 \& def can_cache(h): \& # return nbdkit.CACHE_NONE or nbdkit.CACHE_EMULATE \& # or nbdkit.CACHE_NATIVE .Ve .ie n .IP """can_extents""" 4 .el .IP \f(CWcan_extents\fR 4 .IX Item "can_extents" (Optional) .Sp .Vb 2 \& def can_extents(h): \& # return a boolean .Ve .ie n .IP """pread""" 4 .el .IP \f(CWpread\fR 4 .IX Item "pread" (Required) .Sp .Vb 2 \& def pread(h, buf, offset, flags): \& # read into the buffer .Ve .Sp The body of your \f(CW\*(C`pread\*(C'\fR function should read exactly \f(CWlen(buf)\fR bytes of data starting at disk \f(CW\*(C`offset\*(C'\fR and write it into the buffer \&\f(CW\*(C`buf\*(C'\fR. \f(CW\*(C`flags\*(C'\fR is always 0. .Sp NBD only supports whole reads, so your function should try to read the whole region (perhaps requiring a loop). If the read fails or is partial, your function should throw an exception, optionally using \&\f(CW\*(C`nbdkit.set_error\*(C'\fR first. .ie n .IP """pwrite""" 4 .el .IP \f(CWpwrite\fR 4 .IX Item "pwrite" (Optional) .Sp .Vb 3 \& def pwrite(h, buf, offset, flags): \& length = len(buf) \& # no return value .Ve .Sp The body of your \f(CW\*(C`pwrite\*(C'\fR function should write the buffer \f(CW\*(C`buf\*(C'\fR to the disk. You should write \f(CW\*(C`count\*(C'\fR bytes to the disk starting at \&\f(CW\*(C`offset\*(C'\fR. \f(CW\*(C`flags\*(C'\fR may contain \f(CW\*(C`nbdkit.FLAG_FUA\*(C'\fR. .Sp NBD only supports whole writes, so your function should try to write the whole region (perhaps requiring a loop). If the write fails or is partial, your function should throw an exception, optionally using \f(CW\*(C`nbdkit.set_error\*(C'\fR first. .ie n .IP """flush""" 4 .el .IP \f(CWflush\fR 4 .IX Item "flush" (Optional) .Sp .Vb 2 \& def flush(h, flags): \& # no return value .Ve .Sp The body of your \f(CW\*(C`flush\*(C'\fR function should do a \fBsync\fR\|(2) or \&\fBfdatasync\fR\|(2) or equivalent on the backing store. \&\f(CW\*(C`flags\*(C'\fR is always 0. .Sp If the flush fails, your function should throw an exception, optionally using \f(CW\*(C`nbdkit.set_error\*(C'\fR first. .ie n .IP """trim""" 4 .el .IP \f(CWtrim\fR 4 .IX Item "trim" (Optional) .Sp .Vb 2 \& def trim(h, count, offset, flags): \& # no return value .Ve .Sp The body of your \f(CW\*(C`trim\*(C'\fR function should "punch a hole" in the backing store. \f(CW\*(C`flags\*(C'\fR may contain \f(CW\*(C`nbdkit.FLAG_FUA\*(C'\fR. If the trim fails, your function should throw an exception, optionally using \&\f(CW\*(C`nbdkit.set_error\*(C'\fR first. .ie n .IP """zero""" 4 .el .IP \f(CWzero\fR 4 .IX Item "zero" (Optional) .Sp .Vb 2 \& def zero(h, count, offset, flags): \& # no return value .Ve .Sp The body of your \f(CW\*(C`zero\*(C'\fR function should ensure that \f(CW\*(C`count\*(C'\fR bytes of the disk, starting at \f(CW\*(C`offset\*(C'\fR, will read back as zero. \f(CW\*(C`flags\*(C'\fR is a bitmask which may include \f(CW\*(C`nbdkit.FLAG_MAY_TRIM\*(C'\fR, \&\f(CW\*(C`nbdkit.FLAG_FUA\*(C'\fR, \f(CW\*(C`nbdkit.FLAG_FAST_ZERO\*(C'\fR. .Sp NBD only supports whole writes, so your function should try to write the whole region (perhaps requiring a loop). .Sp If the write fails or is partial, your function should throw an exception, optionally using \f(CW\*(C`nbdkit.set_error\*(C'\fR first. In particular, if you would like to automatically fall back to \f(CW\*(C`pwrite\*(C'\fR (perhaps because there is nothing to optimize if \&\f(CW\*(C`flags\ &\ nbdkit.FLAG_MAY_TRIM\*(C'\fR is false), use \&\f(CW\*(C`nbdkit.set_error(errno.EOPNOTSUPP)\*(C'\fR. .ie n .IP """cache""" 4 .el .IP \f(CWcache\fR 4 .IX Item "cache" (Optional) .Sp .Vb 2 \& def cache(h, count, offset, flags): \& # no return value .Ve .Sp The body of your \f(CW\*(C`cache\*(C'\fR function should prefetch data in the indicated range. .Sp If the cache operation fails, your function should throw an exception, optionally using \f(CW\*(C`nbdkit.set_error\*(C'\fR first. .ie n .IP """extents""" 4 .el .IP \f(CWextents\fR 4 .IX Item "extents" (Optional) .Sp .Vb 4 \& def extents(h, count, offset, flags): \& # return an iterable object (eg. list) of \& # (offset, length, type) tuples: \& return [ (off1, len1, type1), (off2, len2, type2), ... ] .Ve .SS "Missing callbacks" .IX Subsection "Missing callbacks" .ie n .IP "Missing: ""load""" 4 .el .IP "Missing: \f(CWload\fR" 4 .IX Item "Missing: load" This is not needed since you can use regular Python mechanisms like top level statements to run code when the module is loaded. .ie n .IP "Missing: ""unload""" 4 .el .IP "Missing: \f(CWunload\fR" 4 .IX Item "Missing: unload" This is missing, but in nbdkit ≥ 1.28 you can put code in the \&\f(CWcleanup()\fR function to have it run when nbdkit exits. In earlier versions of nbdkit, using a Python atexit handler is recommended. .ie n .IP "Missing: ""name"", ""version"", ""longname"", ""description"", ""config_help"", ""magic_config_key""." 4 .el .IP "Missing: \f(CWname\fR, \f(CWversion\fR, \f(CWlongname\fR, \f(CWdescription\fR, \f(CWconfig_help\fR, \f(CWmagic_config_key\fR." 4 .IX Item "Missing: name, version, longname, description, config_help, magic_config_key." These are not yet supported. .SH FILES .IX Header "FILES" .ie n .IP \fR\fI$plugindir\fR\fI/nbdkit\-python\-plugin.so\fR 4 .el .IP \fR\f(CI$plugindir\fR\fI/nbdkit\-python\-plugin.so\fR 4 .IX Item "$plugindir/nbdkit-python-plugin.so" The plugin. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$plugindir\fR. .SH VERSION .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-python\-plugin\*(C'\fR first appeared in nbdkit 1.2. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-plugin\fR\|(3), \&\fBpython\fR\|(1). .SH AUTHORS .IX Header "AUTHORS" Eric Blake .PP Richard W.M. Jones .PP Nir Soffer .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright Red Hat .SH LICENSE .IX Header "LICENSE" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .IP \(bu 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .IP \(bu 4 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .IP \(bu 4 Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.