{"id":13484676,"url":"https://github.com/python-distro/distro","last_synced_at":"2025-05-13T23:08:47.921Z","repository":{"id":37536081,"uuid":"47115470","full_name":"python-distro/distro","owner":"python-distro","description":"A much more elaborate replacement for removed Python's `platform.linux_distribution()` method","archived":false,"fork":false,"pushed_at":"2024-12-30T17:52:32.000Z","size":518,"stargazers_count":270,"open_issues_count":17,"forks_count":68,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-03T00:02:33.881Z","etag":null,"topics":["distribution","distro","hacktoberfest","linux","linux-distribution","python","python-library"],"latest_commit_sha":null,"homepage":"https://distro.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-distro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-30T11:58:01.000Z","updated_at":"2025-04-18T02:09:23.000Z","dependencies_parsed_at":"2024-01-13T19:17:57.384Z","dependency_job_id":"1a17968c-5364-4654-a179-e838d78b32a3","html_url":"https://github.com/python-distro/distro","commit_stats":{"total_commits":299,"total_committers":51,"mean_commits":5.862745098039215,"dds":0.7357859531772575,"last_synced_commit":"3bd19e61fcb7f8d2bf3d45d9e40d69c92e05d241"},"previous_names":["nir0s/distro","nir0s/ld"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-distro%2Fdistro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-distro%2Fdistro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-distro%2Fdistro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-distro%2Fdistro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-distro","download_url":"https://codeload.github.com/python-distro/distro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253309338,"owners_count":21887973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distribution","distro","hacktoberfest","linux","linux-distribution","python","python-library"],"created_at":"2024-07-31T17:01:29.584Z","updated_at":"2025-05-13T23:08:42.903Z","avatar_url":"https://github.com/python-distro.png","language":"Python","readme":"Distro - an OS platform information API\n=======================================\n\n[![CI Status](https://github.com/python-distro/distro/workflows/CI/badge.svg)](https://github.com/python-distro/distro/actions/workflows/ci.yaml)\n[![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro)\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg)\n[![Code Coverage](https://codecov.io/github/python-distro/distro/coverage.svg?branch=master)](https://codecov.io/github/python-distro/distro?branch=master)\n[![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro)\n[![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/)\n\n`distro` provides information about the\nOS distribution it runs on, such as a reliable machine-readable ID, or\nversion information.\n\nIt is the recommended replacement for Python's original\n[`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution)\nfunction (removed in Python 3.8). It also provides much more functionality\nwhich isn't necessarily Python bound, like a command-line interface.\n\nDistro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/python-distro/distro/issues/177) is also planned.\n\nFor Python 2.6 support, see https://github.com/python-distro/distro/tree/python2.6-support\n\n## Installation\n\nInstallation of the latest released version from PyPI:\n\n```shell\npip install distro\n```\n\nInstallation of the latest development version:\n\n```shell\npip install https://github.com/python-distro/distro/archive/master.tar.gz\n```\n\nTo use as a standalone script, download `distro.py` directly:\n\n```shell\ncurl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py\npython distro.py\n```\n\n``distro`` is safe to vendor within projects that do not wish to add\ndependencies.\n\n```shell\ncd myproject\ncurl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py\n```\n\n## Usage\n\n```bash\n$ distro\nName: Antergos Linux\nVersion: 2015.10 (ISO-Rolling)\nCodename: ISO-Rolling\n\n$ distro -j\n{\n    \"codename\": \"ISO-Rolling\",\n    \"id\": \"antergos\",\n    \"like\": \"arch\",\n    \"version\": \"16.9\",\n    \"version_parts\": {\n        \"build_number\": \"\",\n        \"major\": \"16\",\n        \"minor\": \"9\"\n    }\n}\n\n\n$ python\n\u003e\u003e\u003e import distro\n\u003e\u003e\u003e distro.name(pretty=True)\n'CentOS Linux 8'\n\u003e\u003e\u003e distro.id()\n'centos'\n\u003e\u003e\u003e distro.version(best=True)\n'8.4.2105'\n```\n\n\n## Documentation\n\nOn top of the aforementioned API, several more functions are available. For a complete description of the\nAPI, see the [latest API documentation](http://distro.readthedocs.org/en/latest/).\n\n## Background\n\nAn alternative implementation became necessary because Python 3.5 deprecated\nthis function, and Python 3.8 removed it altogether. Its predecessor function\n[`platform.dist`](https://docs.python.org/3.7/library/platform.html#platform.dist)\nwas already deprecated since Python 2.6 and removed in Python 3.8. Still, there\nare many cases in which access to that information is needed. See [Python issue\n1322](https://bugs.python.org/issue1322) for more information.\n\nThe `distro` package implements a robust and inclusive way of retrieving the\ninformation about a distribution based on new standards and old methods,\nnamely from these data sources (from high to low precedence):\n\n* The os-release file `/etc/os-release` if present, with a fall-back on `/usr/lib/os-release` if needed.\n* The output of the `lsb_release` command, if available.\n* The distro release file (`/etc/*(-|_)(release|version)`), if present.\n* The `uname` command for BSD based distrubtions.\n\n\n## Python and Distribution Support\n\n`distro` is supported and tested on Python 3.6+ and PyPy and on any\ndistribution that provides one or more of the data sources covered.\n\nThis package is tested with test data that mimics the exact behavior of the data sources of [a number of Linux distributions](https://github.com/python-distro/distro/tree/master/tests/resources/distros).\n\n\n## Testing\n\n```shell\ngit clone git@github.com:python-distro/distro.git\ncd distro\npip install tox\ntox\n```\n\n\n## Contributions\n\nPull requests are always welcome to deal with specific distributions or just\nfor general merriment.\n\nSee [CONTRIBUTIONS](https://github.com/python-distro/distro/blob/master/CONTRIBUTING.md) for contribution info.\n\nReference implementations for supporting additional distributions and file\nformats can be found here:\n\n* https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172\n* https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb\n* https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py\n* https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc\n\n## Package manager distributions\n\n* https://src.fedoraproject.org/rpms/python-distro\n* https://www.archlinux.org/packages/community/any/python-distro/\n* https://launchpad.net/ubuntu/+source/python-distro\n* https://packages.debian.org/stable/python3-distro\n* https://packages.gentoo.org/packages/dev-python/distro\n* https://pkgs.org/download/python3-distro\n* https://slackbuilds.org/repository/14.2/python/python-distro/\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-distro%2Fdistro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-distro%2Fdistro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-distro%2Fdistro/lists"}