Skip to main content

SQuiRL

    SQuiRL is a Python library for interacting with any type of data storage structure, including filesystems, databases, caches, and various text file types. It provides a unified API to read, write, query, and manage data across diverse storage systems, abstracting away the complexities of different backends for seamless integration in applications.
    
    ## Features
    
    - **Unified Interface**: Interact with filesystems (local, remote), databases (SQL, NoSQL), caches (in-memory, distributed), and text files (CSV, JSON, XML, etc.) through a consistent Pythonic API.
    - **Extensible Backends**: Support for multiple storage types with pluggable adapters; easily add custom backends.
    - **Data Operations**: Perform CRUD (Create, Read, Update, Delete) operations, queries, and transformations across storage structures.
    - **Configuration-Driven**: Use YAML or Python configs to define storage connections and behaviors.
    - **Cross-Platform Compatibility**: Works on Windows, macOS, and Linux.
    - **Error Handling and Logging**: Built-in mechanisms for robust error management and detailed logging.
    - **Performance Optimizations**: Efficient handling for large datasets, batch operations, and caching layers.
    
    ## Installation
    
    You can install SQuiRL via pip:
    
    ```bash
    pip install squirrl
    ```
    
    Alternatively, clone the repository and install from source:
    
    ```bash
    git clone https://github.com/<USER_OR_ORG>/squirrl.git
    cd squirrl
    pip install -e .
    ```
    
    ### Requirements
    
    - Python 3.<MIN_VERSION> or higher
    - Dependencies: pyyaml, <DB_LIB>, <CACHE_LIB>, <FILE_LIB> (automatically installed via pip where applicable)
    
    ## Quick Start
    
    Import the module, configure a storage backend, and perform operations:
    
    ```python
    import squirrl
    
    # Load configuration for a storage type
    config = squirrl.load_config('path/to/filesystem.yaml')
    
    # Initialize the storage interface
    storage = squirrl.Storage(config)
    
    # Write data
    storage.write('key/path', 'Hello, World!')
    
    # Read data
    data = storage.read('key/path')
    print(data)  # Output: Hello, World!
    ```
    
    ## Usage
    
    ### Loading Configurations
    
    SQuiRL relies on YAML files to define storage backends. A sample YAML for a database might look like:
    
    ```yaml
    storage_type: database
    backend: <DB_LIB>
    connection:
      host: localhost
      port: 5432
      user: <USER>
      password: <PASS>
      db_name: mydb
    operations:
      query: sql_query_method
      insert: insert_method
    ```
    
    Use `squirrl.load_config(yaml_path)` to parse and validate the config.
    
    ### Interacting with Storage
    
    ```python
    # Initialize with config
    config = squirrl.load_config('cache.yaml')
    cache = squirrl.Storage(config)
    
    # Set and get cache values
    cache.set('user_data', {'id': 1, 'name': 'Alice'})
    value = cache.get('user_data')
    
    # Delete
    cache.delete('user_data')
    ```
    
    ### Handling Different Storage Types
    
    - **Filesystems**: Local directories, S3 buckets, etc.
    - **Databases**: SQLite, PostgreSQL, MongoDB, etc.
    - **Caches**: Redis, Memcached, in-memory dicts.
    - **Text Files**: Read/write CSV, JSON, YAML, XML with parsing support.
    
    ```python
    # Example with text file
    config = squirrl.load_config('json_file.yaml')
    file_storage = squirrl.Storage(config)
    data = file_storage.read('data.json')  # Returns parsed dict
    file_storage.write('data.json', {'key': 'value'})
    ```
    
    ## Examples
    
    ### Example 1: Database Querying
    
    ```python
    import squirrl
    
    config = squirrl.load_config('database.yaml')
    db = squirrl.Storage(config)
    db.connect()
    
    # Execute query
    results = db.query('SELECT * FROM users WHERE active = ?', (True,))
    
    # Insert data
    db.insert('INSERT INTO users (name, active) VALUES (?, ?)', ('Bob', True))
    
    db.close()
    ```
    
    ### Example 2: Multi-Storage Workflow
    
    ```python
    import squirrl
    
    configs = ['filesystem.yaml', 'cache.yaml']
    storages = [squirrl.Storage(squirrl.load_config(cfg)) for cfg in configs]
    
    # Read from filesystem, cache it
    data = storages[0].read('file.txt')
    storages[1].set('cached_file', data)
    
    # Retrieve from cache
    cached_data = storages[1].get('cached_file')
    ```
    
    ## Configuration Guide
    
    Each YAML config must include:
    
    - `storage_type`: String identifier (e.g., 'filesystem', 'database', 'cache', 'textfile')
    - `backend`: The underlying library or driver (e.g., '<FS_LIB>', '<DB_LIB>')
    - `connection`: Dictionary of connection parameters
    - `operations`: Mapping of SQuiRL methods to backend-specific calls
    
    For advanced customization, refer to the [docs/config-reference.md](docs/config-reference.md).
    
    ## Contributing
    
    Contributions are welcome! Please follow these steps:
    
    1. Fork the repository.
    2. Create a feature branch (`git checkout -b feature/<FEATURE_NAME>`).
    3. Commit your changes (`git commit -am 'Add some feature'`).
    4. Push to the branch (`git push origin feature/<FEATURE_NAME>`).
    5. Open a Pull Request.
    
    See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
    
    ## License
    
    This project is licensed under the <LICENSE_TYPE> License - see the [LICENSE](LICENSE) file for details.
    
    ## Acknowledgments
    
    - Built with inspiration from open-source data handling communities.
    - Thanks to contributors of underlying libraries like <DB_LIB>, <CACHE_LIB>, <FILE_LIB>.

Metadata

Release files for squirl 0.0.1.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for squirl 0.0.1.post1
File Size Uploaded Provenance Actions
squirl-0.0.1.post1.tar.gz 174.1 kB Without provenance Details for squirl-0.0.1.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for squirl 0.0.1.post1
File Interpreter ABI Platform Actions
squirl-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details for squirl-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Total release size: 382.1 kB

Release files / squirl-0.0.1.post1.tar.gz

Download URL squirl-0.0.1.post1.tar.gz
Size 174.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3eee05ba5051511cfe7ae7824c3f7dc9d2163c176f9de00702b3b8c3bb26c7e3
BLAKE2b-256 checksum
How to use checksums
c63124cf00b17c2711d297a8c47d51d62f733f0ca9c5487ad1c0f31600b80e47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / squirl-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL squirl-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 208.0 kB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
81549a340d31a687f7741c8bc2cc90d62d89b77d184ad234e9718319c1a6d74c
BLAKE2b-256 checksum
How to use checksums
4420990eeab14bf70c2c0c5691e07a87be7395a844cdae56c762a44d44903894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for squirl 0.0.1.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page