Metadata-Version: 2.1
Name: PyOPath
Version: 0.0.1
Summary: Querying object structures neatly
Author-email: Pierre LeMoine <pypi@luben.se>
License: MIT License
        
        Copyright (c) 2024 Pierre LeMoine
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: objpath
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

## PyOPath

Test-status: [![Status](https://github.com/DrInfiniteExplorer/pyopath/actions/workflows/python-package.yml/badge.svg)](https://github.com/DrInfiniteExplorer/pyopath/actions/workflows/python-package.yml)


### Overview

PyOPath is a Python library designed to facilitate querying structures of
objects within application space. Inspired by XPath, JSONPath, and ObjectPath,
PyOPath extends the querying capabilities beyond traditional XML and JSON
documents to include a broader range of data structures.

### Key Features

- **Flexible Querying**: PyOPath allows querying of any kind of model as long
  as it meets certain criteria, expanding beyond the limitations of XML and
  JSON documents.
  
- **Application Space Integration**: Unlike traditional querying libraries,
  PyOPath enables querying directly within the application's data structures,
  leveraging Python's runtime introspection capabilities.

### Getting Started

To begin using PyOPath in your project:

1. Install PyOPath via pip:

    ```bash
    pip install pyopath
    ```

2. Import PyOPath into your Python script:

    ```python
    import pyopath
    ```

3. Start querying your application's data structures using PyOPath's compact
   syntax.

### Example

```python
# Assume we have a data structure 'my_data' representing a nested dictionary

my_data = {
    "name": "John",
    "age": 30,
    "address": {
        "city": "New York",
        "zipcode": "10001"
    },
    "pets": [
        {"type": "dog", "name": "Buddy"},
        {"type": "cat", "name": "Whiskers"}
    ]
}

# Querying the data structure with PyOPath

result = pyopath.query(my_data, "/address/city")
print(result)  # Output: "New York"

```

### Roadmap

Currently, PyOPath is focused on building a robust XPath AST. Future plans
 include expanding query capabilities and enhancing integration with various
 data structures and application models.

### Contributing

Contributions to PyOPath are welcome! Feel free to submit bug reports,
 feature requests, or pull requests via GitHub.

### License

PyOPath is licensed under the MIT License. See the LICENSE file for details.

# Notes and links

ply docs
https://github.com/dabeaz/ply/blob/master/doc/ply.md
https://ply.readthedocs.io/en/latest/ply.html

good parser review
https://tratt.net/laurie/blog/2020/which_parsing_approach.html

another xpathy thing using ply
https://github.com/emory-libraries/eulxml/blob/master/eulxml/xpath/__init__.py

parsing c with ply
https://github.com/dabeaz/ply/blob/master/example/ansic/cparse.py

Sanxion documentation
https://www.saxonica.com/documentation12/index.html#!expressions

xpath language reference
https://www.w3.org/TR/xpath-31/#doc-xpath31-PostfixExpr


