diff --git a/.gitignore b/.gitignore index f178bea..d265940 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ share/openbr/models *.RData *.Rhistory +### Python ### +*.pyc + ### Subversion ### *.svn* diff --git a/docs/docs/api_docs/python_api.md b/docs/docs/api_docs/python_api.md index 3cd7957..03059a7 100644 --- a/docs/docs/api_docs/python_api.md +++ b/docs/docs/api_docs/python_api.md @@ -46,6 +46,14 @@ The Python API is a light wrapper of the C API. It creates an object that has [a br.br_free_template_list(query) br.br_finalize() +Some functions were made more pythonic and thus differ slightly from the C API. In particular, the C functions that populate a string buffer have that logic abstracted away. For example, `br_get_filename(char * buffer, int buffer_length, br_template tmpl)` in C becomes `filename = br.br_get_filename(tmpl)` in Python. Here are the functions that differ from the C API: + +- br_most_recent_message +- br_objects +- br_scratch_path +- br_get_filename +- br_get_metadata_string + To enable the module, add `-DBR_INSTALL_BRPY=ON` to your cmake command (or use the ccmake GUI - highly recommended). Currently only OS X and Linux are supported. diff --git a/scripts/brpy/__init__.py b/scripts/brpy/__init__.py index 6cfd9f3..066824c 100644 --- a/scripts/brpy/__init__.py +++ b/scripts/brpy/__init__.py @@ -53,6 +53,10 @@ def _handle_string_func(func, *moretypes): return msg return call_func +# TODO: small wrapper around any objects that need br_free_* +# so when python object dies, user doesn't need to call br_free_* +# TODO: iterator for templatelist object +# (or mimic C++ obj API via C? overkill?) def init_brpy(br_loc='/usr/local/lib'): """Initializes all function inputs and outputs for the br ctypes lib object"""