mslex
shlex for windows
Decision gist · record as of 2026-08-14
Yes, if you are building Windows command-line tools or cross-platform systems that invoke Windows programs. The package solves a real, non-obvious problem (Windows quoting is genuinely different from POSIX) with no dependencies and permissive licensing. However, dormant maintenance (667 days since last release) means you should verify it handles your specific Windows versions and C runtime targets before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.5 or later; designed for Windows but can be imported on other platforms.
- Low install friction; pure Python wheel with no runtime dependencies.
- Maintenance is dormant—last release was 667 days ago and the repository shows no recent activity, though it is not archived.
License · maintenance · safety
Apache Software License 2.0 (permissive) — Apache Software License 2.0 is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2024-10-16 (667 days) · last repo commit 2024-10-16 · 36 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,080,151 downloads/mo, #4,397 on PyPI
Alternatives
Verify before relying
pip install mslex
import mslex
quoted = mslex.quote('argument with spaces')
args = mslex.split(quoted)- Whether the package handles all edge cases in modern Windows command-line parsing beyond the documented VS 2005+ and msvcrt.dll behaviors.
- How well the package performs on non-Windows platforms when imported (whether it gracefully degrades or requires conditional logic).
- Real-world compatibility with Windows 11 and current C runtime versions.
What it is and what it does
mslex is a Windows-specific port of Python's shlex module that correctly handles Windows command-line quoting and parsing. Unlike shlex, which follows POSIX conventions, mslex accounts for the quirks of Windows argument parsing—specifically the different behaviors between legacy msvcrt.dll (which exhibits modulo-3 periodic quoting behavior from pre-VS 2005) and modern C runtimes (UCRT from VS 2005 onward). The package provides three functions—split, quote, and join—mirroring shlex's interface.
When parsing, mslex validates that a quoted string parses identically under both legacy and modern rules, raising an error if they disagree; you can override this by explicitly setting ucrt=True or ucrt=False. This is useful for developers building command-line tools on Windows, cross-platform build systems, or tools that invoke other Windows programs and need to correctly escape arguments. The package has no runtime dependencies and is marked Production/Stable, though development is dormant.
Use it for
- Building cross-platform CLI tools that need to invoke Windows executables with properly escaped arguments.
- Implementing build systems or package managers that must handle Windows command-line parsing correctly.
- Parsing command-line arguments from Windows programs that use either legacy or modern C runtime conventions.
- Testing or validating Windows argument quoting in tools that generate Windows batch or PowerShell commands.
- Migrating POSIX shell scripts to Windows while preserving correct argument handling.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building Windows command-line tools or cross-platform systems that invoke Windows programs.
The package solves a real, non-obvious problem (Windows quoting is genuinely different from POSIX) with no dependencies and permissive licensing. However, dormant maintenance (667 days since last release) means you should verify it handles your specific Windows versions and C runtime targets before relying on it in production.
Install
mslex on PyPI
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 667 days ago and the repository shows no recent activity, though it is not archived.
Requires Python 3.5 or later; designed for Windows but can be imported on other platforms.
License in practice
Apache Software License 2.0 is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install mslex
import mslex
quoted = mslex.quote('argument with spaces')
args = mslex.split(quoted)
Verify before relying
- Whether the package handles all edge cases in modern Windows command-line parsing beyond the documented VS 2005+ and msvcrt.dll behaviors.
- How well the package performs on non-Windows platforms when imported (whether it gracefully degrades or requires conditional logic).
- Real-world compatibility with Windows 11 and current C runtime versions.
Package facts
| License | Apache Software License 2.0 permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 667 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,080,151 / month, #4,397 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7 |
Evidence: mslex-1.3.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 › “windows command line parsing”
- mslexProvides Windows-compatible command-line argument parsing and…
- oslexProvides a unified API for shell argument quoting and parsing that…
- NakedNaked is a command-line application framework that provides a CLI…
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 oslex · flake8-quotes · bashlex · quotequail · shellescape · flake8-literal · tree-sitter-powershell · OpenCC · delvewheel · robotframework-whitelibrary