Skip to content

Compositions of NumpyModels and .dump() #25

@alonks1234

Description

@alonks1234

Hi, I am trying a composition of NumpyModels and finding that the .dump() function does not work properly:

from pathlib import Path
from pydantic_numpy.model import NumpyModel
from pydantic import Field
import pydantic_numpy.typing as pnd
import numpy as np


class TestNumpy:
    def test_compose(self) -> None:
        
        class A(NumpyModel):
            a: pnd.NpNDArray = Field(frozen=True)
        
        class B(NumpyModel):
            a: A = Field(frozen=True)
        
        
        a = A(a=np.zeros((10, 10)))
        b = B(a=a)
        
        b.dump(Path.home(), "test")

Curious if it would be possible to support dumping models in models. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    NumpyModelElements related to pydantic-numpy NumpyModelenhancementNew feature or requestwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions