No project description provided
Project description
surfing-python
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
-
Clone the repository
git clone https://github.com/your-username/surfing-python.git cd surfing-python -
Create and activate a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install development dependencies
pip install maturin -
Build and install in development mode
maturin develop
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ad40c12f8568a708612f39846fe1fb50fd19ae2f0095e51e98dcad1cba98e8f
|
|
| MD5 |
39796233a3f84bcdb16600f9716f66a0
|
|
| BLAKE2b-256 |
598bd3ffe33376384f4e4da6ffe25f5735fafe4b9b434a0f73c2ee950f8e193a
|
File details
Details for the file surfing_python-0.1.2-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: surfing_python-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 182.2 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69821eca21b577e92e061dd64ad61a5607c9168ba472f20820c8be64375758b7
|
|
| MD5 |
e5fef001eab8e9a9bbc791d82c51fab8
|
|
| BLAKE2b-256 |
cd1b0c428a8899d165133bf6f5e8fa3948efbf1413a721f36f45e3c1a25411c6
|