pytest-dev / py

Python development support library (note: maintenance only)
MIT License
67 stars 106 forks source link

Add parent and parents attributes #150

Closed mshuffett closed 7 years ago

mshuffett commented 7 years ago

I commonly have to access the parent multiple levels above a path, but the py.path.local module does not seem to have a convenient way to do it.

I would like to request / add two new attributes parent and parents which mirror the API of pathlib. https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parents

The-Compiler commented 7 years ago

How are you using py.path? FWIW, we plan to replace it by pathlib in pytest in the long run, and at that point, it'll most likely not see much new development anyways.

mshuffett commented 7 years ago

I've been using it pretty commonly just in my general code. The ensure method is particularly convenient. I tried to switch to pathlib but I wasn't happy with the codebase and found a breaking bug in the way resolve worked which deterred me but I helped to get that fixed so it is probably usable now.

Thanks for letting me know. If it isn't going to be developed much in the future I'll probably move away from it.

On Wed, Aug 9, 2017, 12:46 AM Florian Bruhin notifications@github.com wrote:

How are you using py.path? FWIW, we plan to replace it by pathlib in pytest in the long run, and at that point, it'll most likely not see much new development anyways.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pytest-dev/py/issues/150#issuecomment-321151586, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBV0dGot-yHcunZVBnpeiU_yR-DCE9Dks5sWTmxgaJpZM4OxT7P .

RonnyPfannschmidt commented 7 years ago

@mshuffett currently those are called parts() and dirpath()

mshuffett commented 7 years ago

Yeah. I should probably just use parts more, Thanks.