Skip to main content

MicroMole

    MicroMole is a Python package that provides tools to collect and store data from various sources such as local files, databases, website APIs, and more. It offers a unified interface for data ingestion, transformation, and persistence, enabling seamless integration of diverse data streams into your applications or pipelines. With support for multiple collectors and storage backends, MicroMole simplifies data management tasks for developers and data scientists.
    
    ## Features
    
    - **Data Collectors**: Modules for fetching data from local files (CSV, JSON, XML, etc.), databases (SQL, NoSQL), web APIs (REST, GraphQL), and other sources like streams or sensors.
    - **Storage Backends**: Support for storing collected data in files, databases, caches, or cloud storage with configurable options.
    - **Unified API**: Consistent methods for collection, processing, and storage across different sources.
    - **Data Transformation**: Built-in tools for cleaning, filtering, and transforming data during collection.
    - **Configuration-Driven**: Use YAML or JSON configs to define sources, transformations, and destinations.
    - **Error Handling and Logging**: Robust mechanisms for retries, validation, and detailed logging.
    - **Extensible**: Easily add custom collectors or storage adapters.
    - **Cross-Platform Compatibility**: Works on Windows, macOS, and Linux.
    
    ## Installation
    
    You can install MicroMole via pip:
    
    ```bash
    pip install micromole
    ```
    
    Alternatively, clone the repository and install from source:
    
    ```bash
    git clone https://github.com/<USER_OR_ORG>/micromole.git
    cd micromole
    pip install -e .
    ```
    
    ### Requirements
    
    - Python 3.<MIN_VERSION> or higher
    - Dependencies: requests, pandas, sqlalchemy, pyyaml (automatically installed via pip where applicable)
    
    ## Quick Start
    
    Import the module, configure a collector, and fetch data:
    
    ```python
    import micromole
    
    # Load configuration for a source
    config = micromole.load_config('path/to/api.yaml')
    
    # Initialize collector
    collector = micromole.Collector(config)
    
    # Collect data
    data = collector.fetch()
    
    # Store data
    micromole.store(data, 'path/to/storage.db')
    ```
    
    ## Usage
    
    ### Loading Configurations
    
    MicroMole uses YAML files to define data sources and storage. A sample YAML for a web API might look like:
    
    ```yaml
    source_type: api
    url: https://api.example.com/data
    method: GET
    headers:
      Authorization: Bearer <TOKEN>
    params:
      query: value
    transform:
      filter: key == 'active'
    storage:
      type: database
      engine: sqlite
      file: data.db
    ```
    
    Use `micromole.load_config(yaml_path)` to parse and validate the config.
    
    ### Collecting Data
    
    ```python
    # From local file
    file_config = micromole.load_config('file.yaml')
    file_collector = micromole.Collector(file_config)
    file_data = file_collector.fetch()
    
    # From database
    db_config = micromole.load_config('db.yaml')
    db_collector = micromole.Collector(db_config)
    db_data = db_collector.query('SELECT * FROM table')
    ```
    
    ### Storing Data
    
    ```python
    # Store to file
    micromole.store(data, 'output.csv', format='csv')
    
    # Store to database
    micromole.store(data, 'sqlite:///data.db', table='results')
    ```
    
    ### Supported Sources
    
    - Local Files: CSV, JSON, Excel, Parquet, etc.
    - Databases: SQLite, PostgreSQL, MySQL, MongoDB, etc.
    - Web APIs: RESTful services, with authentication support.
    - Others: Streams, FTP, cloud APIs (configurable via extensions).
    
    ## Examples
    
    ### Example 1: Collecting from API and Storing to Database
    
    ```python
    import micromole
    
    config = micromole.load_config('weather_api.yaml')
    collector = micromole.Collector(config)
    weather_data = collector.fetch()
    
    # Transform data
    transformed = micromole.transform(weather_data, filter=lambda x: x['temp'] > 20)
    
    # Store
    micromole.store(transformed, 'weather.db', table='daily')
    ```
    
    ### Example 2: Batch Collection from Multiple Sources
    
    ```python
    import micromole
    
    configs = ['file1.yaml', 'api2.yaml', 'db3.yaml']
    data_list = []
    
    for cfg in configs:
        config = micromole.load_config(cfg)
        collector = micromole.Collector(config)
        data = collector.fetch()
        data_list.append(data)
    
    # Combine and store
    combined = micromole.merge(data_list)
    micromole.store(combined, 'combined.json', format='json')
    ```
    
    ## Configuration Guide
    
    Each YAML config must include:
    
    - `source_type`: String identifier (e.g., 'file', 'api', 'database')
    - `connection`: Dictionary of parameters (e.g., path, url, credentials)
    - `transform`: Optional list of transformations (filter, map, etc.)
    - `storage`: Optional details for immediate storage after collection
    
    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 ingestion communities.
    - Thanks to contributors of underlying libraries like requests, pandas, sqlalchemy.

Metadata

Release files for micromole 0.0.1.post1

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

Built distribution (wheel)

Table of built distributions (wheels) for micromole 0.0.1.post1
File Interpreter ABI Platform Actions
micromole-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 micromole-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

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

Download URL micromole-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 30.0 kB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
221cb6bd64b8cd6232a7bc3b9919d4a68487c202e55cff66b0daec3e8fa4c6bb
BLAKE2b-256 checksum
How to use checksums
6ed89ce08a53a6fc1a8148aad065c01c02a7a493c9d9d49fc6b7e3d0fca37ca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for micromole 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