-
Notifications
You must be signed in to change notification settings - Fork 667
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
Using pathlib Path object #2497
Comments
Is pathlib in the standard library or do we install it as part of our other dependencies? |
It's in the standard library 3.4+ In principle it means |
And in Python 2? This version of MDA still supports 2. |
It's not in the standard library there, but it can still be installed. I just tested that it can be installed via pip and conda in a fresh 2.7 environment and it installed and imported fine. It can also be installed as a separate packing with Python 3 (although that seems a little silly). I don't know how you all deal with these 2/3 conflicts, but I would guess an "if Python < 3: conda/pip install pathlib" approach could work |
In python 3.4+ then python os functions can take Pathlib and strings
interchangeably. The quoted module however (and probably a few others) is
a C extension and so isn't opening things via python. So we need to go
through our bindings to C extensions (DCD, XDR, MMTF to name a few) and
check that they seamlessly handle Pathlib objects (which seems to be the
new "Pythonic" way to deal with paths instead of strings).
…On Mon, 3 Feb 2020 at 19:47, Oliver Beckstein ***@***.***> wrote:
And in Python 2?
This version of MDA still supports 2.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2497?email_source=notifications&email_token=ACGSGB5WFXKBNFVWX5VT4HTRBBYEFA5CNFSM4KPCL6T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKVEXYI#issuecomment-581585889>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGSGBY24ULZ6UCKSIRXDPLRBBYEFANCNFSM4KPCL6TQ>
.
|
* the creation of a `Universe` object involving GROMACS formats should now accept `pathlib` objects as requested in MDAnalysisgh-2497; resolving that issue entirely is a separate matter, this branch focuses only on the GROMACS format and only if you proceed via the public `Universe` creation API * probably could make it work in Cython directly, though I'm not convinced we need to do that for this part of the fix at least, and we probably should still support strings as well of course
Expected behavior
Providing a
PosixPath
frompathlib
tomda.Universe
should create the Universe. Instead, we currently have to wrap thePosixPath
object in astr()
call.Actual behavior
Code throws an
AttributeError
:Code to reproduce the behavior
Currently version of MDAnalysis
python -V
)? 3.7.3The text was updated successfully, but these errors were encountered: