Skip to content
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

remove platform.linux_distribution() #72354

Closed
doko42 opened this issue Sep 15, 2016 · 26 comments
Closed

remove platform.linux_distribution() #72354

doko42 opened this issue Sep 15, 2016 · 26 comments
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@doko42
Copy link
Member

doko42 commented Sep 15, 2016

BPO 28167
Nosy @malemburg, @doko42, @vstinner, @tiran, @ned-deily, @basak, @encukou, @ambv, @berkerpeksag, @serhiy-storchaka, @Carreau
PRs
  • bpo-28167: bump Deprecated function removal to 3.8 #6669
  • [3.7] bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6669) #6862
  • [3.6] bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6862) #6864
  • bpo-28167: Remove platform.linux_distribution #6871
  • bpo-28167: Remove platform._dist_try_harder() #10787
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-05-16.15:54:53.301>
    created_at = <Date 2016-09-15.09:50:07.716>
    labels = ['3.8', 'type-feature', 'library']
    title = 'remove platform.linux_distribution()'
    updated_at = <Date 2018-11-29.02:14:08.168>
    user = 'https://github.com/doko42'

    bugs.python.org fields:

    activity = <Date 2018-11-29.02:14:08.168>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-05-16.15:54:53.301>
    closer = 'petr.viktorin'
    components = ['Library (Lib)']
    creation = <Date 2016-09-15.09:50:07.716>
    creator = 'doko'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 28167
    keywords = ['patch']
    message_count = 26.0
    messages = ['276541', '276542', '276543', '285004', '285030', '315983', '316055', '316056', '316065', '316666', '316682', '316683', '316694', '316763', '316769', '316823', '316824', '316889', '317176', '317283', '327345', '327347', '327348', '327349', '327350', '330660']
    nosy_count = 11.0
    nosy_names = ['lemburg', 'doko', 'vstinner', 'christian.heimes', 'ned.deily', 'rb', 'petr.viktorin', 'lukasz.langa', 'berker.peksag', 'serhiy.storchaka', 'mbussonn']
    pr_nums = ['6669', '6862', '6864', '6871', '10787']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue28167'
    versions = ['Python 3.8']

    @doko42
    Copy link
    Member Author

    doko42 commented Sep 15, 2016

    platform.linux_distribution() was deprecated in 3.5, and should be removed.

    Can't be kept up to date, see bpo-18872, bpo-19213, bpo-20454, bpo-1180267, plus uncounted issues closed as won't fix.

    I'm surprised that bpo-26041 removed the removal warnings again after such a long discussion.

    @vstinner
    Copy link
    Member

    platform.linux_distribution() was deprecated in 3.5, and should be removed.

    Is it replaced with the distro package?

    FYI I reported the issue to pip and it seems like pip now embeds and uses distro:

    @berkerpeksag
    Copy link
    Member

    I think the current consensus is to keep old APIs around to make porting from Python 2 easier. That's why I opened bpo-26041.

    See also msg256111 and "Deprecation policy PEP" proposed at https://mail.python.org/pipermail/python-committers/2016-January/003706.html

    If Marc-Andre (platform module maintainer) and Ned give their +1s, I don't have a strong objection against the removal of the function.

    Also, it looks like I forgot to remove deprecated-removed directive in 5d9f961edc30: https://docs.python.org/3.6/library/platform.html#platform.linux_distribution

    @serhiy-storchaka
    Copy link
    Member

    But platform.dist() can be removed. It was deprecated in 2.6.

    @vstinner
    Copy link
    Member

    vstinner commented Jan 9, 2017

    +1 to remove platform.linux_distribution().

    Linux distributions are moving much faster than the Python stdlib, so using the distro module which is hosted on PyPI is much simpler. In 2017, it became very easy to have dependencies, pip became the de factor standard.

    @Carreau
    Copy link
    Mannequin

    Carreau mannequin commented May 1, 2018

    In the docs it is marked as "going to be removed in 3.7", and emitting PendingDeprecationWarning. I supposed it should either be updated to change to 3.8 and switch PendingDeprecationWarning to DeprecationWarning, or be actually removed.

    @vstinner
    Copy link
    Member

    vstinner commented May 2, 2018

    IMHO it's now too late to remove it from Python 3.7.

    Moreover, if the current warning is *PendingDeprecationWarning*, the warning must first become in Python N, to then remove the feature in Python N+1.

    I'm ok to just change the warning and schedule a removal from Python 3.8.

    @tiran
    Copy link
    Member

    tiran commented May 2, 2018

    We still don't have a suitable replacement for the feature. Five years, Matthias suggested to add a parser for freedesktop's os-release file.

    @doko42
    Copy link
    Member Author

    doko42 commented May 2, 2018

    there is https://pypi.org/project/distro/

    @encukou
    Copy link
    Member

    encukou commented May 15, 2018

    New changeset 9eb40bc by Petr Viktorin (Matthias Bussonnier) in branch 'master':
    bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6669)
    9eb40bc

    @encukou
    Copy link
    Member

    encukou commented May 15, 2018

    New changeset f4fdb61 by Petr Viktorin (Miss Islington (bot)) in branch '3.7':
    bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6669) (GH-6862)
    f4fdb61

    @encukou
    Copy link
    Member

    encukou commented May 15, 2018

    New changeset e618e96 by Petr Viktorin in branch '3.6':
    bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6864)
    e618e96

    @encukou
    Copy link
    Member

    encukou commented May 15, 2018

    Marc-Andre, I opened a PR to remove platform.linux_distribution() in Python 3.8.
    How do you feel about this?

    @berkerpeksag
    Copy link
    Member

    Adding Łukasz since he is the release manager of Python 3.8.

    @berkerpeksag berkerpeksag added stdlib Python modules in the Lib dir 3.8 only security fixes type-feature A feature request or enhancement labels May 16, 2018
    @malemburg
    Copy link
    Member

    Hi Petr, I'm fine with this. Maintaining the necessary logic Python is not really possible in the stdlib. It's better to have a PyPI module for this which can be updated much more easily.

    Thanks.

    @encukou
    Copy link
    Member

    encukou commented May 16, 2018

    New changeset 8b94b41 by Petr Viktorin in branch 'master':
    bpo-28167: Remove platform.linux_distribution (GH-6871)
    8b94b41

    @encukou
    Copy link
    Member

    encukou commented May 16, 2018

    platform.linux_distribution is removed from Python 3.8. Thanks for everyone involved!

    If there are any complaints or other fallout you don't want to deal with, feel free to point people to me :)

    @encukou encukou closed this as completed May 16, 2018
    @vstinner
    Copy link
    Member

    Can you please have a look at bpo-33513 which is for Python 2.7: "incorrect detection of information of some distributions python2"?

    @encukou
    Copy link
    Member

    encukou commented May 20, 2018

    Thanks for closing that one.

    @vstinner
    Copy link
    Member

    FYI I created bpo-33600: "[EASY DOC] Python 2: document that platform.linux_distribution() has been removed".

    @basak
    Copy link
    Mannequin

    basak mannequin commented Oct 8, 2018

    Maintaining the necessary logic Python is not really possible in the stdlib. It's better to have a PyPI module for this which can be updated much more easily.

    The /etc/os-release syntax is stable, the file is implemented nearly everywhere and is unlikely to change, so I don't see why it'll be difficult to maintain. Just parse and give us the key/value pairs, please!

    It's disappointing to have to add Yet Another Dependency to get this functionality, contrary to Python's "batteries included" philosophy.

    @encukou
    Copy link
    Member

    encukou commented Oct 8, 2018

    In the recommended library, distro, real-world issues blew the code size up to 1000 lines of code and the open issue count to 15 – so while it's definitely useful, it doesn't seem either fully complete or trivial to maintain: https://github.com/nir0s/distro/blob/master/distro.py
    If you can do better, please make a library to implement the simple name/value parsing, publish it on PyPI (sadly, as Yet Another Dependency at this point), make sure it's unit-tested, documented and widely useful in the real world, and *then* suggest inclusion in the standard library. That's how things get into the stdlib nowadays.

    If that sounds like a lot of work, please consider your tone when asking others to do it.

    @basak
    Copy link
    Mannequin

    basak mannequin commented Oct 8, 2018

    Apologies for my tone. I wasn't aware that starting out with a PyPI module is the only accepted process for getting functionality into stdlib. That certainly is a lot of work for what would be a trivial handful of lines to parse key/value pairs and handle error paths, etc (and corresponding tests of course).

    As a distribution developer, from my perspective we've already (finally) managed to reach widespread standardization and unification on a simple key/value pair specification, so it is particularly surprising to me that as a Python developer I cannot easily get to it.

    IMHO, forcing the PyPI route seems like a recipe for scope creep to me in this case. Looking at that module, it tries to do so much more. /etc/os-release is widely accepted nowadays, and I think it would be widely useful to the majority of users to simply pass the values through to a Python dictionary, reflecting "this is what the OS says it is" over "this is my promised stable view". Many of the issues there are because it's trying to be "clever", IMHO, rather than just passing through the provided information from the platform. My proposed API promise would simply be "this is what os-release says" or "os-release information not available".

    Of course the most popular PyPI module to solve a particular problem will always be the one with the widest scope, so there seems little point in writing a parallel minimal one. The cost of adding Yet Another Dependency has to be paid in either case.

    @encukou
    Copy link
    Member

    encukou commented Oct 8, 2018

    I wasn't aware that starting out with a PyPI module is the only accepted process for getting functionality into stdlib.

    It's the main way things should get in. (Other ways exist, for example, dataclasses were added as simplification/merging of several existing libraries.)

    That certainly is a lot of work for what would be a trivial handful of lines to parse key/value pairs and handle error paths, etc (and corresponding tests of course).

    Releasing on PyPI is trivial once you have the tests and documentation. I'll be glad to help with that.

    IMHO, forcing the PyPI route seems like a recipe for scope creep to me in this case.

    Not necessarily. You just need to carefully define the scope of the PyPI module – same as you would for the stdlib module. There's not much difference between stdlib and PyPI here:
    after all, I'd argue the main reason platform.linux_distribution() was removed is that its scope was too wide to be maintainable.

    The cost of adding Yet Another Dependency has to be paid in either case.

    Indeed. But it will be hard to get in otherwise.

    BTW, another way a PyPI release help is that the functionality would be useful for previous versions of Python. At this point new features are targetting Python 3.8.
    So, even if this does get into stdlib, a backport on PyPI would still be useful. Consider prior art like:
    https://pypi.org/project/dataclasses/
    https://pypi.org/project/asyncio/

    @encukou
    Copy link
    Member

    encukou commented Oct 8, 2018

    Actually, the scope (right balance between usefulness and maintainability) is probably the hardest real problem to solve here.
    PyPI lets you iterate on that. For a straight-to-stdlib module, you'd need to get it exactly right on the first time.

    @vstinner
    Copy link
    Member

    New changeset 7cc1fa4 by Victor Stinner in branch 'master':
    bpo-28167: Remove platform._dist_try_harder() (GH-10787)
    7cc1fa4

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    7 participants