Skip to main content

Py-osinfo should work without any extra programs or libraries, beyond what your OS provides. The goal is for this to work on every OS that Python supports. Works on Linux, OS X, Windows, BSD, Solaris, Cygwin, and Haiku.

Pip install

sudo pip install py-osinfo

sudo pip3 install py-osinfo

from osinfo import osinfo

Run as a script

$ python osinfo.py
type: Linux
brand: Slackware
release: 14.1
kernel: (3, 13, 0)

Run as a library

import osinfo
os_type, os_brand, os_release, os_kernel = osinfo.get_os_info()

if os_type in osinfo.OSType.linux:
    print("Looks like you're using Linux.")

    if os_kernel < (3, 13, 1):
        print("Your Linux kernel version is too old!")

if os_brand in osinfo.OSBrand.CentOS:
    print("Looks like you're using CentOS.")

if os_release == '99.01':
    print("OMG CentOS from 2099. Can I see the sorce code?")

Outputs

CentOS

type: Linux
brand: CentOS
release: 6.5
kernel: (2, 6, 32)

Cygwin

type: Cygwin
brand: CYGWIN_NT-6.3
release: 1.7.32
kernel: (1, 7, 32)

Crunch Bang

type: Linux
brand: CrunchBang
release: 11
kernel: (3, 2, 0)

Debian

type: Linux
brand: Debian
release: 7.6
kernel: (3, 2, 0)

Fedora 20

type: Linux
brand: Fedora
release: 20

FreeBSD 10

type: BSD
brand: FreeBSD
release: 10.0

Haiku

type: BeOS
brand: Haiku
release: 1
kernel: (1,)

Linux Mint

type: Linux
brand: LinuxMint
release: 10.9.4
kernel: (3, 11, 10)

Manjaro

type: Linux
brand: Manjaro
release: 0.8.10
kernel: (3, 12, 20)

Mac OS X

type: MacOS
brand: OSX
release: 10.9.4
kernel: (13, 3, 0)

NetBSD

type: BSD
brand: NetBSD
release: 6.1.4

Open Indiana

type: Solaris
brand: OpenIndiana
release: 151a8
kernel: (5, 11)

open SUSE

type: Linux
brand: openSUSE
release: 13.1
kernel: (3, 11, 10)

Open SXCE

type: Solaris
brand: OpenSXCE
release: pensxce2014.05__illumos20140505
kernel: (5, 11)

PCBSD

type: BSD
brand: FreeBSD
release: 10.0-release-p13

Redhat

type: Linux
brand: Redhat
release: 6.5
kernel: (2, 6, 32)

Sabayon

type: Linux
brand: Sabayon
release: 5.5
kernel: (2, 6, 37)

Scientific Linux

type: Linux
brand: ScientificLinux
release: 6.5
kernel: (2, 6, 32)

Ubuntu 14.04

type: Linux
brand: Ubuntu
release: 14.04
kernel: (3, 13, 0)

Windows 7

type: Windows
brand: Windows7
release: 6.1.7601
kernel: (6, 1, 7601)

Windows 8

type: Windows
brand: Windows8
release: 6.2.9200
kernel: (6, 2, 9200)

Windows XP

type: Windows
brand: WindowsXP
release: 5.1.2600
kernel: (5, 1, 2600)

Please submit a pull request with the results for your favorite OS!

Bugs and Corrections

Please report a Bug if you suspect any of this information is wrong.

Metadata

Release files for py-osinfo 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-osinfo 0.1.1
File Size Uploaded Provenance Actions
py-osinfo-0.1.1.tar.gz 5.2 kB Without provenance Details for py-osinfo-0.1.1.tar.gz

Release files / py-osinfo-0.1.1.tar.gz

Download URL py-osinfo-0.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d926b1635e2e7a75426ea612a5f1611eff57e6bdce690fbe56bf43a838c95c6d
BLAKE2b-256 checksum
How to use checksums
9f8a6cd5f9526fe8896640560957aa39cb71c1ee8e350452f79bd023208a15b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for py-osinfo 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page