oslex
OS-independent wrapper for shlex and mslex
Decision gist · record as of 2026-08-14
Yes. It solves a real cross-platform pain point with minimal overhead (one dependency, low friction), active maintenance, no known vulnerabilities, and a permissive license. Install it if you build command-line tools or subprocess wrappers that must work on both Windows and POSIX systems.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a single runtime dependency (mslex).
- Actively maintained with recent commits and releases spanning multiple Python versions (3.8–3.14).
License · maintenance · safety
permissive license (permissive) — Permissive MIT license; the package itself is MIT-licensed, though it depends on mslex which is Apache 2.0-licensed, so combined use carries both permissive terms.
last release 2026-05-10 (96 days) · last repo commit 2026-05-10 · 10 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 780,671 downloads/mo, #5,082 on PyPI
Alternatives
Verify before relying
import oslex
# Quote arguments for the current platform
quoted = oslex.quote('my argument')
# Join a command list
cmd = oslex.join(['echo', 'hello world'])
# Split a command string
args = oslex.split('echo "hello world"')- Whether Path object support extends to all three main functions or only specific ones
- Performance characteristics when handling large argument lists or deeply nested quoting
What it is and what it does
oslex is a thin abstraction layer that provides a single, consistent interface for shell argument handling across Windows and POSIX systems. It forwards calls to either the standard library's shlex (on POSIX) or the mslex library (on Windows), so developers can write platform-agnostic code without conditional logic. The three core functions—join(), quote(), and split()—mirror their underlying implementations but automatically select the right one based on the current OS.
The package is useful when building command-line tools, subprocess wrappers, or any code that constructs or parses shell commands and needs to work correctly on both Windows and Unix-like systems. It accepts Path objects as arguments and converts them transparently, and exposes platform-specific keyword arguments (prefixed ms_ or sh_) for fine-tuning behavior when needed. It also provides _sh and _ms variants to force a specific implementation regardless of platform.
Use it for
- Build cross-platform CLI tools that safely escape and join command arguments without platform-specific branching
- Parse shell command strings consistently on Windows and POSIX in subprocess or shell integration code
- Quote file paths and arguments safely when constructing system commands in deployment or automation scripts
- Handle mixed str and Path arguments in a single join or quote call without manual conversion
- Test shell-quoting logic against both Windows and POSIX rules in the same codebase
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
It solves a real cross-platform pain point with minimal overhead (one dependency, low friction), active maintenance, no known vulnerabilities, and a permissive license. Install it if you build command-line tools or subprocess wrappers that must work on both Windows and POSIX systems.
Install
oslex on PyPI
Before you install
Low install friction with a single runtime dependency (mslex). Actively maintained with recent commits and releases spanning multiple Python versions (3.8–3.14).
License in practice
Permissive MIT license; the package itself is MIT-licensed, though it depends on mslex which is Apache 2.0-licensed, so combined use carries both permissive terms.
Quickstart
import oslex
# Quote arguments for the current platform
quoted = oslex.quote('my argument')
# Join a command list
cmd = oslex.join(['echo', 'hello world'])
# Split a command string
args = oslex.split('echo "hello world"')
Verify before relying
- Whether Path object support extends to all three main functions or only specific ones
- Performance characteristics when handling large argument lists or deeply nested quoting
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagemslex |
| Maintenance | Actively maintained 96 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 780,671 / month, #5,082 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: oslex-2.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cross-platform shell argument quoting”
- oslexProvides a unified API for shell argument quoting and parsing that…
- mslexProvides Windows-compatible command-line argument parsing and…
- shellescapeProvides a `quote()` function that shell-escapes Python strings to…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also bashlex · mslex · shellescape · sspilib · shellcheck-py · manygo · flake8-quotes · quotequail · mozprocess · strict-kwargs