distro
A much more elaborate replacement for removed Python's `platform.linux_distribution()` method
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 47 committers (6.4%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.2%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A much more elaborate replacement for removed Python's `platform.linux_distribution()` method
Basic Info
- Host: GitHub
- Owner: python-distro
- License: apache-2.0
- Language: Python
- Default Branch: master
- Homepage: https://distro.readthedocs.io/
- Size: 506 KB
Statistics
- Stars: 271
- Watchers: 8
- Forks: 68
- Open Issues: 17
- Releases: 19
Topics
Metadata Files
README.md
Distro - an OS platform information API
distro provides information about the
OS distribution it runs on, such as a reliable machine-readable ID, or
version information.
It is the recommended replacement for Python's original
platform.linux_distribution
function (removed in Python 3.8). It also provides much more functionality
which isn't necessarily Python bound, like a command-line interface.
Distro currently supports Linux and BSD based systems but Windows and OS X support is also planned.
For Python 2.6 support, see https://github.com/python-distro/distro/tree/python2.6-support
Installation
Installation of the latest released version from PyPI:
shell
pip install distro
Installation of the latest development version:
shell
pip install https://github.com/python-distro/distro/archive/master.tar.gz
To use as a standalone script, download distro.py directly:
shell
curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
python distro.py
distro is safe to vendor within projects that do not wish to add
dependencies.
shell
cd myproject
curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
Usage
```bash $ distro Name: Antergos Linux Version: 2015.10 (ISO-Rolling) Codename: ISO-Rolling
$ distro -j { "codename": "ISO-Rolling", "id": "antergos", "like": "arch", "version": "16.9", "versionparts": { "buildnumber": "", "major": "16", "minor": "9" } }
$ python
import distro distro.name(pretty=True) 'CentOS Linux 8' distro.id() 'centos' distro.version(best=True) '8.4.2105' ```
Documentation
On top of the aforementioned API, several more functions are available. For a complete description of the API, see the latest API documentation.
Background
An alternative implementation became necessary because Python 3.5 deprecated
this function, and Python 3.8 removed it altogether. Its predecessor function
platform.dist
was already deprecated since Python 2.6 and removed in Python 3.8. Still, there
are many cases in which access to that information is needed. See Python issue
1322 for more information.
The distro package implements a robust and inclusive way of retrieving the
information about a distribution based on new standards and old methods,
namely from these data sources (from high to low precedence):
- The os-release file
/etc/os-releaseif present, with a fall-back on/usr/lib/os-releaseif needed. - The output of the
lsb_releasecommand, if available. - The distro release file (
/etc/*(-|_)(release|version)), if present. - The
unamecommand for BSD based distrubtions.
Python and Distribution Support
distro is supported and tested on Python 3.6+ and PyPy and on any
distribution that provides one or more of the data sources covered.
This package is tested with test data that mimics the exact behavior of the data sources of a number of Linux distributions.
Testing
shell
git clone git@github.com:python-distro/distro.git
cd distro
pip install tox
tox
Contributions
Pull requests are always welcome to deal with specific distributions or just for general merriment.
See CONTRIBUTIONS for contribution info.
Reference implementations for supporting additional distributions and file formats can be found here:
- https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172
- https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb
- https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py
- https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc
Package manager distributions
- https://src.fedoraproject.org/rpms/python-distro
- https://www.archlinux.org/packages/community/any/python-distro/
- https://launchpad.net/ubuntu/+source/python-distro
- https://packages.debian.org/stable/python3-distro
- https://packages.gentoo.org/packages/dev-python/distro
- https://pkgs.org/download/python3-distro
- https://slackbuilds.org/repository/14.2/python/python-distro/
Owner
- Name: python-distro
- Login: python-distro
- Kind: organization
- Repositories: 1
- Profile: https://github.com/python-distro
GitHub Events
Total
- Issues event: 2
- Watch event: 11
- Delete event: 1
- Issue comment event: 7
- Push event: 3
- Pull request review event: 1
- Pull request event: 4
- Fork event: 3
- Create event: 2
Last Year
- Issues event: 2
- Watch event: 11
- Delete event: 1
- Issue comment event: 7
- Push event: 3
- Pull request review event: 1
- Pull request event: 4
- Fork event: 3
- Create event: 2
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| nir0s | n****g@g****m | 92 |
| Andreas Maier | a****r@g****e | 61 |
| Jon Dufresne | j****e@g****m | 26 |
| Samuel FORESTIER | H****t | 14 |
| Seth M. Larson | S****n | 13 |
| Seth Michael Larson | s****n@p****m | 13 |
| Samuel FORESTIER | d****v@s****s | 8 |
| dependabot[bot] | 4****] | 6 |
| Anthony Sottile | a****e@u****u | 6 |
| Frank Sachsenheim | f****e@r****t | 5 |
| Martijn Braam | m****n@b****l | 5 |
| Adam J. Stewart | a****6@g****m | 4 |
| Philippe Ombredanne | p****e@n****m | 4 |
| Lucas Holt | l****e@f****m | 3 |
| Arnon Yaari | a****y@i****m | 2 |
| Amir Rossert | u****n | 2 |
| Abhijeet Kasurde | a****e@r****m | 2 |
| Pedro Lamas | p****s@g****m | 2 |
| Petr Viktorin | e****u@g****m | 2 |
| Toshio Kuratomi | a****r@g****m | 2 |
| Todd Gamblin | t****n@l****v | 1 |
| The Gitter Badger | b****r@g****m | 1 |
| Sebastian Wagner | s****x@s****t | 1 |
| Manuel Muradas | m****s@a****m | 1 |
| OMOTO Kenji | k****o@m****m | 1 |
| Pavel Zaikin | p****n@c****m | 1 |
| lisongmin | l****n@1****m | 1 |
| Sebastian Pipping | s****n@p****g | 1 |
| Saltaformajo | s****x@g****m | 1 |
| SCC/楊志璿 | z****7@g****m | 1 |
| and 17 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 40
- Total pull requests: 75
- Average time to close issues: over 1 year
- Average time to close pull requests: about 1 month
- Total issue authors: 36
- Total pull request authors: 25
- Average comments per issue: 6.05
- Average comments per pull request: 2.55
- Merged pull requests: 61
- Bot issues: 0
- Bot pull requests: 8
Past Year
- Issues: 2
- Pull requests: 5
- Average time to close issues: about 1 hour
- Average time to close pull requests: 2 days
- Issue authors: 2
- Pull request authors: 3
- Average comments per issue: 2.0
- Average comments per pull request: 2.2
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- andy-maier (3)
- braindevices (2)
- adamjstewart (2)
- arossert (1)
- sethmlarson (1)
- studentenherz (1)
- pranavmarla (1)
- 0ne-zero (1)
- capsalad (1)
- Fizzadar (1)
- septatrix (1)
- NebularNerd (1)
- sc0ttj (1)
- jokurz (1)
- nagworld9 (1)
Pull Request Authors
- HorlogeSkynet (28)
- jdufresne (16)
- dependabot[bot] (9)
- pedrolamas (3)
- sethmlarson (3)
- hartwork (2)
- nir0s (2)
- dieresys (2)
- rpluem-vf (1)
- TechWiz-3 (1)
- sebix (1)
- terminalmage (1)
- coffebar (1)
- harshula (1)
- akxs14 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 16
-
Total downloads:
- pypi 95,352,773 last-month
- Total docker downloads: 5,864,735,717
-
Total dependent packages: 406
(may contain duplicates) -
Total dependent repositories: 12,329
(may contain duplicates) - Total versions: 57
- Total maintainers: 5
pypi.org: distro
Distro - an OS platform information API
- Homepage: https://github.com/python-distro/distro
- Documentation: https://distro.readthedocs.io/
- License: Apache License, Version 2.0
-
Latest release: 1.9.0
published about 2 years ago
Rankings
Maintainers (3)
proxy.golang.org: github.com/python-distro/distro
- Documentation: https://pkg.go.dev/github.com/python-distro/distro#section-documentation
- License: apache-2.0
-
Latest release: v1.9.0
published about 2 years ago
Rankings
alpine-v3.18: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.8.0-r2
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.8.0-r2
published almost 3 years ago
Rankings
Maintainers (1)
alpine-edge: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.17: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.8.0-r0
published over 3 years ago
Rankings
Maintainers (1)
alpine-edge: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published almost 2 years ago
Rankings
Maintainers (1)
anaconda.org: distro
distro provides information about the OS distribution it runs on, such as a reliable machine-readable ID, or version information.
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0
published almost 2 years ago
Rankings
alpine-v3.22: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.21: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.21: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.19: py3-distro-pyc
Precompiled Python bytecode for py3-distro
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.8.0-r2
published over 2 years ago
Rankings
alpine-v3.19: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.8.0-r2
published over 2 years ago
Rankings
alpine-v3.20: py3-distro
A Linux OS platform information API
- Homepage: https://github.com/python-distro/distro
- License: Apache-2.0
-
Latest release: 1.9.0-r2
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- black *
- mypy *
- pre-commit ==2.13.0
- pytest *
- pytest-cov *
- sphinx >=1.1
- actions/checkout v3 composite
- actions/setup-python v4 composite
- codecov/codecov-action v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite