I’m writing a a bit about pipeline inputs and outp...
# questions
j
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
Dict[str, Union[Callable[[], Any]]]
👍 1
or you could replace
Any
with
pandas.DataFrame
or equivalent
K 2
j
Nice, thanks!
d
if you’re on Python 3.10+ there is a slightly nicer syntax too
j
I am on 3.10, I can use lower case
dict
now, right?
d
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
Ooh, nice. I like this PEP
d
💪
j
Thanks again!
d
np
d
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