Skip to main content

A platform detection library for Python. It uses various methods to attempt to determine the operating system, distribution, release, version, etc., to aid callers in making platform-specific decisions.

lionshead was originally written for “platform-specific wheels” that were a solution to the Linux wheel problem before the creation of manylinux. Rather than be wasted effort, it’s been spun in to a separate library (which would’ve been necessary anyway to be consumed by both pip and wheel).

The development repository can be found at https://github.com/natefoo/lionshead

Documentation is available at http://lionshead.readthedocs.io

The package is published to PyPI at https://pypi.python.org/pypi/lionshead

Quick start

On Debian stretch/sid:

>>> from lionshead import *
>>> get_specific_platform()
SpecificPlatform(dist='debian', major_vers='stretch/sid', full_vers='stretch/sid', stability='unstable')
>>> get_specific_platform_string()
'debian-stretch_sid'
>>> get_platform_stability_string()
'unstable'

On CentOS 7:

>>> from lionshead import *
>>> get_specific_platform()
SpecificPlatform(dist='centos', major_vers='7', full_vers='7', stability='stable')
>>> get_specific_platform_string()
'centos-7'
>>> get_platform_stability_string()
'stable'

Installation of the module also installs lionshead-platform and lionshead-stability commands that return the output of get_specific_platform_string and get_platform_stability_string, respectively.

FAQ

How can I help?

See if your OS/distribution is listed and/or correct in this gist, and if not, follow the instructions and create an issue with your findings.

Does this work on anything other than Linux?

Not currently, but as an avid illumos fan, I plan to add support for other operating systems such as illumos and the BSDs. Here’s the data collection I did for Ansible’s illumos detection to get started.

What is a “stable” vs. “unstable” platform?

“Stable” platforms are operating system releases which commit to a defined, non-changing ABI for the lifetime of the release. This means that the ABI remains consisntent even after OS updates (this typically means that all software is maintained at a specific version). Examples of “stable” releases include:

  • Red Hat Enterprise Linux and derivatives

  • Ubuntu

  • Debian (stable and past stable releases)

  • SUSE Linux Enterprise Server

  • openSUSE (releases)

Conversely, “unstable” platforms are operating systems that use a “rolling release” model where software versions can change with each OS update. Examples of “unstable” releases include:

  • Debian (testing/sid)

  • openSUSE (tumbleweed)

  • Arch

What’s with the name?

The name is a reference to Indiana Jones and the Last Crusade, specifically the scene where Indy takes the “leap of faith” on to the invisible bridge in the Temple of the Sun.

“Only in the leap from the lion’s head will he prove his worth.”

The leap detects the (presence of the) platform underneath… get it? ;P

Code of Conduct

Everyone interacting in the lionshead project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

History

0.1.1 (2017-01-07)

  • Fix detection of Amazon Linux

0.1 (2017-01-03)

  • Yanked platform module out of my pip/wheel forks and adapted as a standalone module for initial version.

  • Wrote a bit of documentation.

Release files for lionshead 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 lionshead 0.1.1
File Size Uploaded
lionshead-0.1.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lionshead 0.1.1
File Interpreter ABI Platform
lionshead-0.1.1-py2-none-any.whl Python 2 none any Details

Total release size: 16.7 kB

Release files / lionshead-0.1.1.tar.gz

Download URL lionshead-0.1.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f44e241fa259ac9101dd21125b9ba16d3e22ac29ca112f1d6736fd12c7b18aa6
BLAKE2b-256 checksum
How to use checksums
f31abf9a377aa5a8b88be7c9e6869e27e8d717d113cf3986a735103a59893d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / lionshead-0.1.1-py2-none-any.whl

Download URL lionshead-0.1.1-py2-none-any.whl
Size 10.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
14b8368a092cf8b22e0fb564de4cd4549267e71c50df93c40d556fa9701822c0
BLAKE2b-256 checksum
How to use checksums
d8f27009e6dc18ccdac6c4c58866c4c2912def69d3b3edf29b5f114d2352cd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

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