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.2.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.2-cp39-cp39-macosx_11_0_arm64.whl (182.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: surfing_python-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0ad40c12f8568a708612f39846fe1fb50fd19ae2f0095e51e98dcad1cba98e8f
MD5 39796233a3f84bcdb16600f9716f66a0
BLAKE2b-256 598bd3ffe33376384f4e4da6ffe25f5735fafe4b9b434a0f73c2ee950f8e193a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for surfing_python-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69821eca21b577e92e061dd64ad61a5607c9168ba472f20820c8be64375758b7
MD5 e5fef001eab8e9a9bbc791d82c51fab8
BLAKE2b-256 cd1b0c428a8899d165133bf6f5e8fa3948efbf1413a721f36f45e3c1a25411c6

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