Install & Compatibility
Where this runs
tested against v0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.1MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Parser
✓ from stringparser import Parser
✗ from stringparser import StringParser
This quickstart demonstrates how to create a `StringParser` instance with a pattern string and use it to extract data from input strings. The pattern uses `{key:type}` syntax for named capture groups and type conversion.
from stringparser import StringParser
# Define a parser using a pattern string
parser = StringParser("Hello {name:s}! Your age is {age:d}.")
# Parse a matching string
result = parser.parse("Hello Alice! Your age is 30.")
print(result)
# Expected output: {'name': 'Alice', 'age': 30}
# Example with a different pattern and input
date_parser = StringParser("{day:d}/{month:d}/{year:d}")
date_result = date_parser.parse("25/12/2023")
print(date_result)
# Expected output: {'day': 25, 'month': 12, 'year': 2023}
Debug
Known issues
gotchastringparser patterns are NOT regular expressions. While they define matching rules, they use a distinct syntax based on 'parsy' for structured parsing, not regex.fixRefer to the stringparser documentation for its specific pattern syntax, which uses '{name:type}' for capturing and type conversion. affects: All versions (0.1+)
gotchaAs a 0.x version library, stringparser's API stability is not strictly guaranteed. Minor versions (e.g., 0.7 to 0.8) may introduce backward-incompatible changes.fixPin your dependency to a specific minor version (e.g., `stringparser==0.7`) and review the project's changelog or GitHub releases for any breaking changes before upgrading.
affects: All 0.x versions
gotchaInput strings must match the defined pattern exactly. If a portion of the input does not conform to the pattern, a `ParsingError` will be raised, unlike regex which might partially match or return None.fixEnsure your input data strictly adheres to the defined pattern. For more flexible parsing, you might need to combine multiple patterns or handle `ParsingError` explicitly.
affects: All versions (0.1+)
Upgrade
Version history
0.7latest on PyPI · released Nov 16, 2023
Audit
Dependencies
parsyrequiredCore parsing engine used internally by stringparser.