shlex for windows
Free software: Apache Software License 2.0
Documentation: https://mslex.readthedocs.io.
Features
This is the missing shlex package for windows shell quoting. It provides three functions – split, quote, and join – just like shlex.
Windows Quoting
Since time immemorial, windows quoting behavior has been strange. Prior to (I think) Visual Studio 2005, it exhibited the extremely strange modulo 3 periodic behavior which is emulated here in split_msvcrt(). Programs compiled with the C runtime from Visual Studio 2005 and later exhibit the somewhat less strange behavior emulated in split_ucrt().
Microsoft still ships a dll called msvcrt.dll as part of Windows, for compatibility reasons. And even though they have been very clear in their documentation that nobody should ever link against this dll, people still do, either for compatibility reasons of their own, or because it is universally available on any version of windows you might care about without needing to run an installer. And msvcrt.dll preserves the extremely strange argument parsing behavior from prior to VS 2005.
You can can download the latest version of msys2 today and build an executable linking msvcrt.dll on Windows 11, and it will parse arguments like Windows 95.
mslex will produce quoted strings that will be parsed correctly by either modern C runtimes or by msvcrt.dll. When parsing, mslex parses it both ways and raises an error if they disagree. This can be overridden by passing ucrt=True or ucrt=False to split.
See also:
Automatic selection between mslex and shlex
If you want to automatically use mslex on Windows, and shlex otherwise, check out the oslex package.
Metadata
Release files for mslex 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mslex-1.3.0.tar.gz | 11.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mslex-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / mslex-1.3.0.tar.gz
| Download URL | mslex-1.3.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
641c887d1d3db610eee2af37a8e5abda3f70b3006cdfd2d0d29dc0d1ae28a85d
|
|
BLAKE2b-256 checksum How to use checksums |
e0977022667073c99a0fe028f2e34b9bf76b49a611afd21b02527fbfd92d4cd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / mslex-1.3.0-py3-none-any.whl
| Download URL | mslex-1.3.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7074b347201b3466fc077c5692fbce9b5f62a63a51f537a53fbbd02eff2eea4
|
|
BLAKE2b-256 checksum How to use checksums |
64f266bd65ca0139675a0d7b18f0bada6e12b51a984e41a76dbe44761bf1b3ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for mslex 1.3.0
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.