At the moment, create_schema_for_single_task only works for package=fractal-tasks-core or if the hard-coded INNER_PYDANTIC_MODELS files are also moved to the new package.
While create_schema_for_single_task function exposes a inner_pydantic_models input variable, that is not used (but instead the global INNER_PYDANTIC_MODELS).
That means this function expects to find lib_channels.py & lib_input_models.py in the source folder of the package (if package is set to something different than fractal-tasks-core, which is necessary to make other parts of the function to work for a different package).
We could just change https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/e2e55991ab740a30bc9f2639f1acf14c650ba77b/fractal_tasks_core/dev/lib_args_schemas.py#L139 to use inner_pydantic_models instead of INNER_PYDANTIC_MODELS, thus using the dictionary provided as input
But I think it would also be good to encourage the usage of the pydantic models from fractal-tasks-core in other packages, not having each package define its own pydantic models or copy the models from the core package. Thus, a better solution would be splitting this: Actually loading the INNER_PYDANTIC_MODELS always from fractal-tasks-core (not the specified package) and allowing users to specify extra models.
At the moment,
create_schema_for_single_task
only works forpackage=fractal-tasks-core
or if the hard-codedINNER_PYDANTIC_MODELS
files are also moved to the new package.While
create_schema_for_single_task
function exposes ainner_pydantic_models
input variable, that is not used (but instead the globalINNER_PYDANTIC_MODELS
).That means this function expects to find
lib_channels.py
&lib_input_models.py
in the source folder of the package (ifpackage
is set to something different thanfractal-tasks-core
, which is necessary to make other parts of the function to work for a different package).We could just change https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/e2e55991ab740a30bc9f2639f1acf14c650ba77b/fractal_tasks_core/dev/lib_args_schemas.py#L139 to use
inner_pydantic_models
instead ofINNER_PYDANTIC_MODELS
, thus using the dictionary provided as input But I think it would also be good to encourage the usage of the pydantic models from fractal-tasks-core in other packages, not having each package define its own pydantic models or copy the models from the core package. Thus, a better solution would be splitting this: Actually loading theINNER_PYDANTIC_MODELS
always from fractal-tasks-core (not the specifiedpackage
) and allowing users to specify extra models.