@@ -237,6 +237,10 @@ at least `python` and `pip`, and is activated.
237237If your project requires more Python dependencies, use the mechanisms below to ensure they
238238are automatically installed.
239239
240+ We ** strongly recommend that you specify Conda dependencies** if possible, instead of pip
241+ or script dependencies. This is because Conda can account for all inter-dependencies between
242+ packages and so prevent incompatible combinations of packages from being installed.
243+
240244### PythonCallDeps.toml
241245
242246If you put a file called ` PythonCallDeps.toml ` in a project/package/environment which
@@ -275,6 +279,40 @@ PythonCall.Deps.conda_env
275279PythonCall.Deps.user_deps_file
276280```
277281
282+ ## Writing packages which depend on * PythonCall*
283+
284+ ### Example
285+
286+ See https://github.com/cjdoris/FAISS.jl for an example package which wraps the Python FAISS
287+ package.
288+
289+ ### Precompilation
290+
291+ You may not interact with Python during module precompilation. Therefore, instead of
292+ ```
293+ module MyModule
294+ using PythonCall
295+ const foo = pyimport("foo")
296+ bar() = foo.bar() # will crash when called
297+ end
298+ ```
299+ you must do
300+ ```
301+ module MyModule
302+ using PythonCall
303+ const foo = PythonCall.pynew() # initially NULL
304+ function __init__()
305+ PythonCall.pycopy!(foo, pyimport("foo"))
306+ end
307+ bar() = foo.bar() # now ok
308+ end
309+ ```
310+
311+ ### Dependencies
312+
313+ If your package depends on some Python packages, you must write a ` PythonCallDeps.toml ` file.
314+ See [ Managing Python dependencies] ( @ref ) .
315+
278316## Low-level API
279317
280318The functions here are not exported. They are mostly unsafe in the sense that you can
@@ -283,8 +321,8 @@ crash Julia by using them incorrectly.
283321``` @docs
284322PythonCall.pynew
285323PythonCall.pyisnull
286- PythonCall.getptr
287324PythonCall.pycopy!
325+ PythonCall.getptr
288326PythonCall.pydel!
289327PythonCall.unsafe_pynext
290328```
0 commit comments