-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New file interface - take 2 #319
Conversation
4e33f83
to
f74efad
Compare
f74efad
to
b88e46d
Compare
Let me know if you want me to re-issue this with the commits in a clearer order/with the fixes squashed? Most of the plugin files can be ignored, but the CLI and the |
Is it possible that volshell is broken in this branch? Should the dependency be bumped to (2,0,0)? |
Hmm, actually it seems like maybe it's another version requirement that's failing. |
4cf5647
to
0f040a9
Compare
This highlights that the FileHandler class can also be seen as a method similar to open, and it removes unnecessary context managers, allowing plugins to close files as they wish (they must, however, remember to close the file for it to be committed).
Ok, so this has now been rebased and a few fixes pushed to it. The first uses This is a very big change and I doubt I'll have caught all the little gotchas, but we can fix them up after the change is made. Just one more eyes over will suit me and I'll merge it then... |
I'm still having trouble running volshell, has that been resolved? |
Yep, I've now resolved the volshell issues (hopefully), thanks for double checking. 5:) |
Cool, seems to work now, thanks. |
If you're happy with it, I'll merge it (and we can fix up breakages people find as of tomorrow)... 5:P |
Not necessary related to this PR directly, but I tried using |
Actually, when I run |
The missing directory we can definitely fix, but I agree they're probably not for this PR. Could you file a separate issue and I can get that fixed in there please? |
Sounds good. Looks good to me. |
Ok, a bunch of changes now. We're now also identical to a file interface, apart from the final filename is changeable up until the point where the file is closed. This is no longer a hard and fast requirement (dlllist which used to append the pid, now hands it in as a prefix), so we could essentially make it permanently read-only (and I'd be happy with either way, given it can't really be used as a context manager if you're going to the change the name later, because it would have been closed and the filename finalized by that point).
There's no longer a separate commit step, meaning that technically UIs can do with the data what they'd like as soon as they get it. The CLI has a couple of implementations, one of which is the equivalent of a
BytesIO
, and the other is the equivalent of a file (it gets written to a temporary file in the same directory, not just to allow finalizing the filename later, but also to make the file writes appear atomic, so that partial data can't be returned).Reasonably happy with this, I've played with the nomenclature several times. I've gone with
file_handler
for the class which is essentially a file, but also a context manager,file_data
for the thing you actually write to, andfile_output
for the filename/error message the plugin responds with. Again, up for grabs, but hopefully the biggest of the decisions required...As per the previous one, no time limit on this, but given how impending our need to have gotten this right is, it would be good to get it reviewed as soon as possible. I've also updated volumetric to use the new file mechanism (rather than using the BytesIO implementation, I instead write out to disk and haven't found a clean way to ensure all temporary files are removed at shutdown, so this can fill the filesystem and therefore volumetric is still a toy and not production worthy).
@npetroni If you could give this a look over and let me know what you think? I'd quite like to get this right because (as shown by the version numbers changing for every single plugin), altering the core API makes all previously written plugins (potentially) break, require a version bump and therefore shouldn't be done often or lightly...