-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add support for reading from IOBuffers #55
Conversation
Thanks for the contribution, this sounds useful and I'll be happy to accept once it works on all platforms. However, it's not working on Windows, probably for the reasons you mention. Would you be able to take a look via the CI logs? I don't have a Windows machine I can offer for testing on, unfortunately. |
It seems like there isn't an equivalent of
|
Solution 2 is fine for now, someone else who want this to work on Windows could still do 1 in future. |
I added a note in the |
Still failing on Windows with Julia 1.6 I'm afraid. We could consider this to be very old and update the CI to use 1.10 which is the new LTS version of Julia. |
It looks like Line 70 in a243066
I can modify the test to be less specific very easily, unless you want to update the CI? I don't mind either way. |
CI updated in #56. If you rebase on |
Not sure what's going on with the macOS CI, seems to be a problem with an AtomsBase test but I haven't touched it? |
e78cb27
to
aa6be0e
Compare
Now very not sure what's happening... I slightly messed up the initial rebase so I redid it, and now the CI is running fine? For context, here was the CI log that previously failed and now passes: https://github.com/libAtoms/ExtXYZ.jl/actions/runs/11889607646/job/33126517896 I think there may be some inconsistency with the "Conversion AtomsBase -> Atoms" tests since they use randomly generated atom coords, but it doesn't seem linked to this PR. |
Looks OK now so I'll go ahead and merge. Would a new release be useful? |
I would like to use it soon because it tidies up a bunch of my code to not have to use my Python hack, so if you have time then that would be appreciated. I can always run from master for the time being though so no rush! |
v0.2.1 should show up in the General index shortly |
My solution to the problem presented in #46 was workable but not great:
read_frames
through PythonCall.write_frames
, as this needed everything to be a Julia type and not a PythonCall wrapper type.To (hopefully) provide a better solution, I've implemented a new method of
cfopen
that internally calls thefmemopen
C function. This returns what is functionally a 'file pointer' that the rest of ExtXYZ can work with as if it were an actual file.I've extended the
read_frame
methods to allow for passingIOBuffer
s and added a test case for equivalence with the regular read-from-file approach. I haven't added an equivalent method forwrite_frame
yet but may do so after some testing.The only bit I'm not sure about is the Windows
ccall
tofmemopen
- I see that there's a special case for handlingfdopen
but I'm not familiar with how this works on Windows so please correct this if it needs to be.