METADATA 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. Metadata-Version: 2.1
  2. Name: distro
  3. Version: 1.9.0
  4. Summary: Distro - an OS platform information API
  5. Home-page: https://github.com/python-distro/distro
  6. Author: Nir Cohen
  7. Author-email: nir36g@gmail.com
  8. License: Apache License, Version 2.0
  9. Platform: All
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: Intended Audience :: System Administrators
  13. Classifier: License :: OSI Approved :: Apache Software License
  14. Classifier: Operating System :: POSIX :: Linux
  15. Classifier: Operating System :: POSIX :: BSD
  16. Classifier: Operating System :: POSIX :: BSD :: FreeBSD
  17. Classifier: Operating System :: POSIX :: BSD :: NetBSD
  18. Classifier: Operating System :: POSIX :: BSD :: OpenBSD
  19. Classifier: Programming Language :: Python :: 3
  20. Classifier: Programming Language :: Python :: 3 :: Only
  21. Classifier: Programming Language :: Python :: 3.6
  22. Classifier: Programming Language :: Python :: 3.7
  23. Classifier: Programming Language :: Python :: 3.8
  24. Classifier: Programming Language :: Python :: 3.9
  25. Classifier: Programming Language :: Python :: 3.10
  26. Classifier: Programming Language :: Python :: 3.11
  27. Classifier: Programming Language :: Python :: 3.12
  28. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  29. Classifier: Topic :: System :: Operating System
  30. Requires-Python: >=3.6
  31. Description-Content-Type: text/markdown
  32. License-File: LICENSE
  33. Distro - an OS platform information API
  34. =======================================
  35. [![CI Status](https://github.com/python-distro/distro/workflows/CI/badge.svg)](https://github.com/python-distro/distro/actions/workflows/ci.yaml)
  36. [![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro)
  37. [![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg)
  38. [![Code Coverage](https://codecov.io/github/python-distro/distro/coverage.svg?branch=master)](https://codecov.io/github/python-distro/distro?branch=master)
  39. [![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro)
  40. [![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/)
  41. `distro` provides information about the
  42. OS distribution it runs on, such as a reliable machine-readable ID, or
  43. version information.
  44. It is the recommended replacement for Python's original
  45. [`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution)
  46. function (removed in Python 3.8). It also provides much more functionality
  47. which isn't necessarily Python bound, like a command-line interface.
  48. Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/python-distro/distro/issues/177) is also planned.
  49. For Python 2.6 support, see https://github.com/python-distro/distro/tree/python2.6-support
  50. ## Installation
  51. Installation of the latest released version from PyPI:
  52. ```shell
  53. pip install distro
  54. ```
  55. Installation of the latest development version:
  56. ```shell
  57. pip install https://github.com/python-distro/distro/archive/master.tar.gz
  58. ```
  59. To use as a standalone script, download `distro.py` directly:
  60. ```shell
  61. curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
  62. python distro.py
  63. ```
  64. ``distro`` is safe to vendor within projects that do not wish to add
  65. dependencies.
  66. ```shell
  67. cd myproject
  68. curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
  69. ```
  70. ## Usage
  71. ```bash
  72. $ distro
  73. Name: Antergos Linux
  74. Version: 2015.10 (ISO-Rolling)
  75. Codename: ISO-Rolling
  76. $ distro -j
  77. {
  78. "codename": "ISO-Rolling",
  79. "id": "antergos",
  80. "like": "arch",
  81. "version": "16.9",
  82. "version_parts": {
  83. "build_number": "",
  84. "major": "16",
  85. "minor": "9"
  86. }
  87. }
  88. $ python
  89. >>> import distro
  90. >>> distro.name(pretty=True)
  91. 'CentOS Linux 8'
  92. >>> distro.id()
  93. 'centos'
  94. >>> distro.version(best=True)
  95. '8.4.2105'
  96. ```
  97. ## Documentation
  98. On top of the aforementioned API, several more functions are available. For a complete description of the
  99. API, see the [latest API documentation](http://distro.readthedocs.org/en/latest/).
  100. ## Background
  101. An alternative implementation became necessary because Python 3.5 deprecated
  102. this function, and Python 3.8 removed it altogether. Its predecessor function
  103. [`platform.dist`](https://docs.python.org/3.7/library/platform.html#platform.dist)
  104. was already deprecated since Python 2.6 and removed in Python 3.8. Still, there
  105. are many cases in which access to that information is needed. See [Python issue
  106. 1322](https://bugs.python.org/issue1322) for more information.
  107. The `distro` package implements a robust and inclusive way of retrieving the
  108. information about a distribution based on new standards and old methods,
  109. namely from these data sources (from high to low precedence):
  110. * The os-release file `/etc/os-release` if present, with a fall-back on `/usr/lib/os-release` if needed.
  111. * The output of the `lsb_release` command, if available.
  112. * The distro release file (`/etc/*(-|_)(release|version)`), if present.
  113. * The `uname` command for BSD based distrubtions.
  114. ## Python and Distribution Support
  115. `distro` is supported and tested on Python 3.6+ and PyPy and on any
  116. distribution that provides one or more of the data sources covered.
  117. This 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).
  118. ## Testing
  119. ```shell
  120. git clone git@github.com:python-distro/distro.git
  121. cd distro
  122. pip install tox
  123. tox
  124. ```
  125. ## Contributions
  126. Pull requests are always welcome to deal with specific distributions or just
  127. for general merriment.
  128. See [CONTRIBUTIONS](https://github.com/python-distro/distro/blob/master/CONTRIBUTING.md) for contribution info.
  129. Reference implementations for supporting additional distributions and file
  130. formats can be found here:
  131. * https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172
  132. * https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb
  133. * https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py
  134. * https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc
  135. ## Package manager distributions
  136. * https://src.fedoraproject.org/rpms/python-distro
  137. * https://www.archlinux.org/packages/community/any/python-distro/
  138. * https://launchpad.net/ubuntu/+source/python-distro
  139. * https://packages.debian.org/stable/python3-distro
  140. * https://packages.gentoo.org/packages/dev-python/distro
  141. * https://pkgs.org/download/python3-distro
  142. * https://slackbuilds.org/repository/14.2/python/python-distro/