Skip to main content

No project description provided

Project description

surfing-python

License: MIT Python PyPI

A Python binding for the surfing Rust crate - extract JSON from text streams.

Description

surfing-python provides Python bindings for the Rust surfing library, allowing you to easily extract JSON objects from unstructured text. It's perfect for scenarios where you need to extract structured data from logs, text files, or other sources that may contain JSON mixed with other content.

Installation

pip install surfing-python

Usage

Basic Example

import surfing_python

# Extract JSON from a text string
text = 'some random text {"key": "value"} more random text'
json_str = surfing_python.extract_json_to_string(text)
print(json_str)  # Output: {"key": "value"}

Error Handling

import surfing_python

try:
    # No JSON in this string
    json_str = surfing_python.extract_json_to_string("no json here")
except ValueError as e:
    print(f"Error: {e}")  # Will print an error message

Features

  • Fast and efficient JSON extraction powered by Rust
  • Simple Python API
  • Detailed error messages
  • Works with nested and complex JSON structures

Development

Prerequisites

  • Python 3.8+
  • Rust toolchain
  • maturin for building the package

Building from source

  1. Clone the repository

    git clone https://github.com/your-username/surfing-python.git
    cd surfing-python
    
  2. Create and activate a virtual environment

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install development dependencies

    pip install maturin
    
  4. Build and install in development mode

    maturin develop
    

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • surfing - The Rust library this package wraps
  • PyO3 - Rust bindings for Python
  • maturin - Build, package and upload Python extensions

Project details


Download files

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

Source Distribution

surfing_python-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

surfing_python-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (181.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file surfing_python-0.1.1.tar.gz.

File metadata

  • Download URL: surfing_python-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.6

File hashes

Hashes for surfing_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 956907f5c202dc7f79b695c54ca49481435b5e8968f08779862a552324782600
MD5 50e536d4c8187460e34b17126852fe61
BLAKE2b-256 7873f4d163bf35a722cfa0e18a7d861dbd0048e925d6f2072ac2169d205a7b42

See more details on using hashes here.

File details

Details for the file surfing_python-0.1.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for surfing_python-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fd56081e536ee95d0d8ee7a36e525acbf60debaf7375a78179fb2223ab97ac5
MD5 3730c10426b24216b5cb5202dd67e7d9
BLAKE2b-256 4303f02d6b691eb5fc4024e4f39f8b9d5d106ae71784cda86de237fc36d445c0

See more details on using hashes here.

Supported by

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