Skip to content

BUG (I guess???!!): import numpy as np leaked by firedrake. #4696

@sghelichkhani

Description

@sghelichkhani

It's not necessarily a bug, but probably not the intended behaviour. When doing an from firedrake import *, np is leaked.

In [1]: from firedrake import *
In [2]: np
Out[2]: <module 'numpy' from '/Users/sghelichkhani/Workplace/firedrake-2025-10_08/venv-firedrake/lib/python3.13/site-packages/numpy/__init__.py'>

The issue is simply that cofunction.py is missing an __all__ list, therefore from firedrake.cofunction import * in the main __init__.py ends loading numpy as np.

Solution:

cofunction.py should define an __all__ list that explicitly lists what should be exported, excluding np.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions