--- id: selinux version: "0.3.0" license: MIT license license_treatment: permissive maintenance: active --- # selinux — shim selinux module License: permissive · Maintenance: active · Downloads: 1.8M/mo ## What it is and what it does This package is a workaround for a specific virtualenv limitation: selinux normally cannot be imported from inside isolated Python environments even when the system library is installed. The selinux shim bridges that gap by providing a pure-Python wrapper that allows code running in a virtualenv to import selinux. The shim requires that libselinux Python bindings be present on the host system—it does not replace them, only makes them accessible from within a virtualenv. It has been tested to work both inside, outside virtualenvs without interfering with the original library. The package depends only on distro for runtime operation, supports Python 3.9 or later. Use it for: - Importing selinux in isolated Python environments for system administration tasks - Testing or developing tools that depend on selinux in a containerized or virtualenv-based CI/CD pipeline - Running code that requires selinux from within a virtualenv without system-level workarounds ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a pure-Python shim for the selinux module that works inside virtualenvs, allowing tools to import selinux without requiring system-level virtualenv configuration. Yes, if you need to use selinux from inside a virtualenv. The package solves a specific problem with minimal dependencies, no security issues, active maintenance status. The gap since the latest release is a minor concern, but the package remains actively maintained, marked Production/Stable. Install only if you encounter the virtualenv selinux import problem. ## Install pip install selinux uv add selinux poetry add selinux ## Installing selinux Before you install: Low install friction with a single runtime dependency (distro). The package is actively maintained with recent commits, though the latest release was over three years ago; it remains marked as Production/Stable with support for current Python versions. License in practice: MIT license permits unrestricted use, modification, in both open-source, proprietary projects with minimal obligations. Quickstart: pip install selinux import selinux libselinux Python bindings must be installed on the system; the shim bridges access to them from within a virtualenv. Verify before relying: - Whether the shim works with all selinux functions or only a subset of the API - Whether it works with selinux versions other than those tested at release time - Compatibility with Ansible modules specifically ## Package facts - License: MIT license (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags selinux virtualenv import, selinux python shim, virtualenv selinux compatibility, isolated environment selinux, selinux module wrapper, selinux, virtualenv-compat [View on SkillFed](https://skillfed.io/packages/selinux) · [View on PyPI](https://pypi.org/project/selinux/)