Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Nompy

A Python parser combinator library inspired by the Nom library in Rust. This project is in no way affiliated with the original Nom Rust project.

Examples

Parse Name

Parse a name and apply a simple transformation.

from nom.combinators import succeeded, tag, take_rest, take_until, tuple_
from nom.modifiers import apply

to_parse = "john doe"

parser = tuple_(
    apply(succeeded(take_until(" "), tag(" ")), str.capitalize),
    apply(take_rest(), str.capitalize),
)
result, remaining = parser(to_parse)
firstname, lastname = result
print(firstname, lastname)  # John Doe

Parse Phone Number

Parse an MSISDN with preceeding +

from nom.combinators import preceeded, tag, take_while

to_parse = "+1234567890"

parser = preceeded(take_while(str.isnumeric), tag("+"))
result, remaining = parser(to_parse)
print(result)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nom-0.1.0b3.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nom-0.1.0b3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file nom-0.1.0b3.tar.gz.

File metadata

  • Download URL: nom-0.1.0b3.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nom-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 dd5fe2893fd9392d518b7ec1708eec4d8e661b8f85848be3207ba4783ab2c3cd
MD5 956695b4e8ec409f7f2995ccb12db65e
BLAKE2b-256 4846528320dc239f843cb7d41a235255af93671d8cc76a54f86f983d43c38c9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nom-0.1.0b3.tar.gz:

Publisher: publish.yml on Harry-Lees/Nompy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nom-0.1.0b3-py3-none-any.whl.

File metadata

  • Download URL: nom-0.1.0b3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nom-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 c97635aa344a1d01f2a48926f7f059b048dcc0a76029edf97dad2e6c23659f2e
MD5 a4a586ad3238c6d15bd1917adedeafd1
BLAKE2b-256 8e0bf7008de1a0eef13d151e67518809fc90f462f1a980203f327bb51d945a7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nom-0.1.0b3-py3-none-any.whl:

Publisher: publish.yml on Harry-Lees/Nompy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0b3 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page