Conversation
JacobHayes
left a comment
There was a problem hiding this comment.
Few small things (mostly the -> Any for read), but looking good!
I do not, however, move into a separate io package, because then that separate io package needs to be imported everywhere we want to use those readers (otherwise they are not registered). By placing the read/write implementations inside the same file as the view declaration (e.g., _read_pickle_localfile_python with class Python(View):) I think we avoid this issue.
Not a strong position, but it's possible we could do:
# arti/io/core.py
from arti.formats.core import Format
from arti.storage.core import Storage
from arti.views.core import View
@multidispatch
def read(*, format: Format, storage: Storage, view: View) -> Any: ...
@multidispatch
def write(data: Any, *, format: Format, storage: Storage, view: View) -> None: ...
# arti/views/core.py doesn't import `io` at all
# arti/views/python.py
from arti.views.core import View
from arti.io.core import read, write
[... everything else the same ...]
Codecov Report
@@ Coverage Diff @@
## golden #65 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 22 +1
Lines 675 668 -7
Branches 75 74 -1
=========================================
- Hits 675 668 -7
Continue to review full report at Codecov.
|
So in this example, split out read/write interfaces into |
Yeah
Yeah maybe a bit, but it is exactly why we're using -- Actually, now that we're thinking the user will be saying Then any implementations within |
Isn't the key import step at the "framework" level and not the "user" level? I.e., we need to import the "io stuff" at the same time that we resolve the "view stuff", which should hopefully only happen "at build time" (by the executor that is calling build along with fetching all the necessary data). From that perspective, I feel like putting the readers/writers with the view code makes sense (if you're importing the view, you're importing the associated readers and writers). |
|
This latest commit e13085b moves the In principle, the implementations could live anywhere that imports For the purposes of the "core" library, however, we will (for now) keep reading and writing implementations with the corresponding view. |
We discussed in a call that due to the way we anticipate
buildworking, thatViewcan just be metadata, not data. In this PR, I remove the.dataattribute and I movereadandwriteout ofViewmethods.I do not, however, move into a separate
iopackage, because then that separate io package needs to be imported everywhere we want to use those readers (otherwise they are not registered). By placing the read/write implementations inside the same file as the view declaration (e.g.,_read_pickle_localfile_pythonwithclass Python(View):) I think we avoid this issue.