pytest-dev / py

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

Document `strpath` attribute of `LocalPath` object #187

Closed asottile closed 3 years ago

asottile commented 6 years ago

lots of code uses this attribute, but it is not documented

how do I convince the sphinx docs to include this 😆

(note that it is included for svnwc)

Originally noticed here

RonnyPfannschmidt commented 6 years ago

it shouldnt be used to begin with

asottile commented 6 years ago

pytest uses it: https://github.com/pytest-dev/pytest/search?q=strpath&unscoped_q=strpath

It has one benefit over str(localpathobj) in that it preserves bytes / text:

>>> # python 2
>>> local.LocalPath(u'bar').strpath
u'/private/tmp/py/bar'
>>> # python 3
>>> LocalPath(b'foo').strpath
b'/private/tmp/py/foo'
RonnyPfannschmidt commented 6 years ago

@asottile pytest will completely remove all internal py.path.local usage in the next few months

RonnyPfannschmidt commented 6 years ago

once thats done we will deprecate all local path based apis ^^

RonnyPfannschmidt commented 6 years ago

@asottile on a extra note - py.path.local is unreasonably unaware of unicode vs bytest, its at best irresponsible to rely on it for that distinction

asottile commented 6 years ago

Sure, but it's going to be incredibly difficult to remove due to tmpdir publically, it's a public name, and quite a lot of code on github uses it

RonnyPfannschmidt commented 6 years ago

oh, we won't remove it, just deprecate it ^^

asottile commented 6 years ago

In the meantime (especially since it's used) can we improve this from a public undocumented attribute to a documented one?

RonnyPfannschmidt commented 6 years ago

as long as the broken fundamentals of it are documented as well

asottile commented 6 years ago

seems even str(...) isn't documented 🙃

RonnyPfannschmidt commented 6 years ago

im not exactly surprised, im going to be really happy once its gone ^^