distro

A much more elaborate replacement for removed Python's `platform.linux_distribution()` method

https://github.com/python-distro/distro

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

distribution distro hacktoberfest linux linux-distribution python python-library

Keywords from Contributors

pallets jinja unit-testing fuzzing l10n build-tools radiuss aws-cli cloud-management cldr
Last synced: 6 months ago · JSON representation

Repository

A much more elaborate replacement for removed Python's `platform.linux_distribution()` method

Basic Info
Statistics
  • Stars: 271
  • Watchers: 8
  • Forks: 68
  • Open Issues: 17
  • Releases: 19
Topics
distribution distro hacktoberfest linux linux-distribution python python-library
Created about 10 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog Contributing License

README.md

Distro - an OS platform information API

CI Status PyPI version Supported Python Versions Code Coverage Is Wheel Latest Github Release

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-release if present, with a fall-back on /usr/lib/os-release if needed.
  • The output of the lsb_release command, if available.
  • The distro release file (/etc/*(-|_)(release|version)), if present.
  • The uname command 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

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

All Time
  • Total Commits: 299
  • Total Committers: 47
  • Avg Commits per committer: 6.362
  • Development Distribution Score (DDS): 0.692
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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...

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
bug (13) area: code (11) enhancement (8) area: docs (7) area: test (5) discussion needed (3) resolution: fixed (3) help wanted (3) resolution: duplicate (2) resolution: invalid (1) question (1) resolution: wontfix (1)
Pull Request Labels
enhancement (40) area: code (29) area: test (18) bug (14) area: docs (10) area: setup (4) backport (1)

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

  • Versions: 16
  • Dependent Packages: 397
  • Dependent Repositories: 12,322
  • Downloads: 95,352,773 Last month
  • Docker Downloads: 5,864,735,717
Rankings
Docker downloads count: 0.0%
Downloads: 0.0%
Dependent packages count: 0.1%
Dependent repos count: 0.1%
Average: 2.0%
Stargazers count: 5.3%
Forks count: 6.8%
Maintainers (3)
Last synced: 6 months ago
proxy.golang.org: github.com/python-distro/distro
  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 3.1%
Stargazers count: 3.4%
Average: 6.7%
Dependent packages count: 9.6%
Dependent repos count: 10.8%
Last synced: 6 months ago
alpine-v3.18: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 7.5%
Forks count: 14.5%
Stargazers count: 15.4%
Last synced: 6 months ago
alpine-v3.18: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 7.5%
Forks count: 14.5%
Stargazers count: 15.4%
Last synced: 6 months ago
alpine-edge: py3-distro

A Linux OS platform information API

  • Versions: 5
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 3.4%
Average: 8.9%
Forks count: 15.6%
Stargazers count: 16.6%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.17: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 11.6%
Forks count: 13.5%
Stargazers count: 14.0%
Dependent packages count: 19.0%
Last synced: 6 months ago
alpine-edge: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 11.8%
Dependent packages count: 14.3%
Forks count: 15.9%
Stargazers count: 17.0%
Maintainers (1)
Last synced: 6 months ago
anaconda.org: distro

distro provides information about the OS distribution it runs on, such as a reliable machine-readable ID, or version information.

  • Versions: 3
  • Dependent Packages: 6
  • Dependent Repositories: 7
Rankings
Dependent packages count: 7.1%
Average: 30.4%
Forks count: 36.3%
Stargazers count: 37.4%
Dependent repos count: 40.8%
Last synced: 6 months ago
alpine-v3.22: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.20: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.22: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.21: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.21: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.19: py3-distro-pyc

Precompiled Python bytecode for py3-distro

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 6 months ago
alpine-v3.19: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 6 months ago
alpine-v3.20: py3-distro

A Linux OS platform information API

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago

Dependencies

dev-requirements.txt pypi
  • black *
  • mypy *
  • pre-commit ==2.13.0
  • pytest *
  • pytest-cov *
  • sphinx >=1.1
.github/workflows/ci.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/deploy.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi