https://kedro.org/ logo
#questions
Title
# questions
j

Jordan

12/15/2022, 10:55 AM
I’m writing a a bit about pipeline inputs and outputs in all of the
README.md
files of my project. How should I document the
type
of a partitioned dataset? Those function outputs need to be of the form
dict[str, <type>]
, but when the dataset is loaded back it’s going to be
dict[str, Callable[[], <type>]]
d

datajoely

12/15/2022, 10:57 AM
Dict[str, Union[Callable[[], Any]]]
👍 1
or you could replace
Any
with
pandas.DataFrame
or equivalent
K 2
j

Jordan

12/15/2022, 11:00 AM
Nice, thanks!
d

datajoely

12/15/2022, 11:00 AM
if you’re on Python 3.10+ there is a slightly nicer syntax too
j

Jordan

12/15/2022, 11:01 AM
I am on 3.10, I can use lower case
dict
now, right?
d

datajoely

12/15/2022, 11:01 AM
you don’t need union anymore
I also think
dict
works regardless but I’m not 100% sure
you can do
Dict[str, Callable[[] | Any]]
j

Jordan

12/15/2022, 11:02 AM
Ooh, nice. I like this PEP
d

datajoely

12/15/2022, 11:02 AM
💪
j

Jordan

12/15/2022, 11:02 AM
Thanks again!
d

datajoely

12/15/2022, 11:02 AM
np
d

Deepyaman Datta

12/15/2022, 10:28 PM
dict
works without any extra imports since 3.9; you can also do
from __future__ import annotations
for past versions.
Callable
, if used, should have 0 or 2 arguments (list of inputs, output).
K 1
4 Views