Should `basix' load `dolfinx`by default?

Hello.

Description of the issue

The Python API of Basix fails when trying to access basix.ufl if DOLFINx is not loaded.

Expected result

I would not have expected Basix to depend on DOLFINx to work with UFL. If that is the case, may be Basix should load DOLFINx by default.

MWE

import basix
import ufl
# import dolfinx   # uncomment to fix error


basix.ufl

Error output

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
AttributeError: module 'basix' has no attribute 'ufl'

System

  • FEniCSx software
    dolfinx: 0.8.0.dev0_r27568.a34b0c9-1
    basix: 0.8.0.dev0_r952.eebbc52-1
    ufl: 2023.3.0.dev0_r3568.f132188-1
    ffcx: 0.8.0.dev0_r7083.b4cb217-1

  • Dependencies
    python: 3.11.5-2
    python-numpy: 1.26.0-1
    petsc: 3.19.5.1171.g37df9106526-1
    hdf5-openmpi: 1.14.2-1
    boost: 1.83.0-2
    adios2: 2.8.3-5
    scotch: 7.0.4-1
    pybind11: 2.11.1-1
    python-build: 1.0.1-1
    python-cffi: 1.15.1-4
    python-cppimport: 22.08.02.r6.g0849d17-1
    python-installer: 0.7.0-3
    python-mpi4py: 3.1.4-3
    python-pytest: 7.4.2-1
    python-scikit-build: 0.17.6-1
    python-setuptools: 1:68.0.0-1
    python-wheel: 0.40.0-3
    xtensor: 0.24.0-2
    xtensor-blas: 0.20.0-1

  • Operating system
    Arch Linux: 6.5.4-arch2-1

basix.ufl is an optional submodule of Basix.
You should import it explicitly through import basix.ufl

2 Likes