Enable Axom's Python to be installed via uv/pip - #1936
Conversation
There was a problem hiding this comment.
This user doc about Python will move out of sidre once we have bindings for a second component
| //! Erase all pins recorded for \a ds (called when the DataStore is collected). | ||
| void releaseDataStoreExternalPins(DataStore* ds) { externalDataOwnerRegistry().erase(ds); } | ||
|
|
||
| //! Release the pin recorded for \a view, if any (defined below). |
There was a problem hiding this comment.
This block contains fixes for pinning memory in blocks we've already pinned
|
|
||
| m_sidre.def("indexIsValid", &indexIsValid, "Returns true if idx is valid, else false."); | ||
| m_sidre.def("nameIsValid", &nameIsValid, "Returns true if name is valid, else false."); | ||
| m_sidre.def("indexIsValid", |
There was a problem hiding this comment.
The nb::arg() additions help Jupyter and IDEs get the names of functions (instead of just arg1, arg2
| "Create an Attribute object with a default string value") | ||
| "Create an Attribute object with a default string value", | ||
| nb::arg("name"), | ||
| nb::arg("default_value").noconvert()) |
There was a problem hiding this comment.
The noconvert() prohibits casts like float -> int. (see block comment below in this file)
There was a problem hiding this comment.
This file helps us get the conduit that Axom was configured against
There was a problem hiding this comment.
This is the CMake project that uv uses to set up the wheel for uv.
I tried to make it as simple as possible, but there were some necessary complexities.
I'm not sure how thoroughly tests the stable ABI options are, but they seemed worthwhile.
There was a problem hiding this comment.
This pyproject.toml file sets up the wheel and its dependencies.
This binding-only project is targeted at an already-installed Axom and reuses its package tree.
Otherwise, we could produce a cycle that would retain memory until the end of the execution.
They paths need to be relative to both the build and install root.
This directory is used by the Python installation (e.g. for wheels).
Also deemphasizes the discussion of platform-dependent wheelhouses.
This allows for better IDE integration.
And about better IDE integration with Jupyter.
Only export variables with content, and clarify the intent of the two variable groups.
Do not pin pointers within blocks that are already pinned.
Allow for the possibility of some generated config files not being present and return a proper error message.
Misc: Slight fixes to docs.
0f6539b to
9323289
Compare
Summary
uvorpiprun_python_with_axom.sh) that adds the necessary dependencies toPYTHONPATHscikit-build-coreproject over an installed Axom. The generated Python wheel can be installed into auvorpipvirtual environmentuvfrom an already built Axom installation (the gcc docker CI)Three steps to a uv installation
Assuming we already have an Axom installation in
${AXOM_INSTALL}Running in Jupyter w/ type hints
Limitations
SLIC_WARNING) and don't show up in the error Jupyter output cell. E.g if you run the cell to create a view or group a second time, it will silently get converted toNone.