semvec/pypi-packages huggingface dataset:
Streamly 0.3
Streamly is a very simple yet powerful wrapper for streams.
License: MIT
Requires Python: >=3.1

========
Streamly
========

Streamly is a very simple yet powerful wrapper for streams (file-like objects). It is primarily designed to help with the cleaning up of flat data during on the fly read operations.

A typical use case that is especially prevalent within digital marketing, is wanting to download/upload a web stream to some target location that expects clean, flat delimited data but the stream includes unwanted header and footer data. Developers often deal with this by loading the data as-is into an interim location and then opening the file and culling the unwanted leading and trailing lines. This approach works but limitations include: not easily reproducible; increases the complexity of the solution; assumes a storage component; inefficient with large data sets.

Streamly solves this problem by handling the unwanted headers and footers on the fly in a highly efficient manner.

Documentation: https://streamly.readthedocs.io


Installation
------------

**Requires** `Python 3.1+ <https://www.python.org/downloads/>`_

With `pipenv <https://packaging.python.org/tutorials/managing-dependencies>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Install:

.. code-block:: text

    pipenv install streamly

**OR** Update:

.. code-block:: text

    pipenv update streamly

With `pip <https://pip.pypa.io/en/stable/quickstart/>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Install & Update:

.. code-block:: text

    pip install streamly --upgrade


Example Usage
-------------

The below example writes a byte stream to a file, removing the unwanted header and footer details on the fly.

.. code-block:: python

    import io

    import streamly


    my_stream = io.BytesIO(
    b"""Header
    Metadata
    Unwanted
    =
    Garabage

    Report Fields:
    col1,col2,col3,col4,col5
    data,that,we,actually,want
    and,potentially,loads,of,it,
    foo,bar,baz,lorem,ipsum
    foo,bar,baz,lorem,ipsum
    foo,bar,baz,lorem,ipsum
    ...,...,...,...,...
    Grand Total:,0,0,1000,0
    More
    Footer
    Garbage
    """
    )

    wrapped_stream = streamly.Streamly(my_stream, header_row_identifier=b"Report Fields:\n",
                                       footer_identifier=b"Grand")

    data = wrapped_stream.read(50)
    while data:
        print(data)
        data = wrapped_stream.read(50)


Features
--------

Includes the following functionality during on the fly read operations:

* Adjoining of multiple streams
* Removal of header and footer data, identified by a value (e.g. byte string or string)
* Logging of read progress
* Guaranteed read size (where the data is not yet exhausted)
* Consistent API for streams returning byte strings or strings
nuclio 0.1.0
Convert Jupyter notebook to nuclio
License: MIT

# nuclio Jupyter Export

<!--
Uncomment once we enable travis

[![Build Status](https://travis-ci.org/nu/nuclio.svg?branch=master)](https://travis-ci.org/nuclio/nuclio-jupyter) 
-->

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Convert Jupyter notebook to Python code that can run as [nuclio](https://nuclio.io/) handler

## Usage

When developing, import `Context` and `Event` from `nucilo` and use it to
generate a mock context and request.

```python
# nuclio: ignore
from nuclio import Context, Event

context = Context()
event = Event(body='Hello Nuclio')
# your code goes here
```

In the cell you'd like to become the handler, added the comment `#
nuclio:handler`. If there's a specific line you'd like to be the returned one -
added `# nuclio:return` at the end of it.

Cells containing `# nuclio: ignore` comment will be commented out in the export
process.

Now choose `File/Download as/Nuclio` in Jupyter notebook

![](doc/menu.png)

Or you can run

```
jupyter nbconvert --to nuclio example.ipynb
```


This will create `example.py` with your code wrapped in handler function and all
cells with `# nuclio: ignore` commented out.

### Example

![](doc/example.png)

Will generate

```python
# coding: utf-8

# In[1]:
def greeting(name):
    return 'Hi ' + name + '. How are you?'

# In[2]:
default_name = 'Dave'

# In[3]:
# # nuclio:ignore
# from nuclio import Context, Event
# context = Context()
# event = Event(body=default_name)

# In[4]:
def handler(context, event):
    # nuclio:handler
    return greeting(event.body)
```

## Try It Out

You can build a docker image and try it out

### Build

    $ docker build -t jupyter-nuclio .

### Run

    $ docker run -p 8888:8888 jupyter-nuclio

Then open your browser at http://localhost:8888 and enter the password `nuclio`
when prompted.


## Developing

We're using [pipenv](https://docs.pipenv.org/) as package manager. To install
dependencies run

    $ pipenv sync -d

To run the tests run

    $ pipenv run python -m pytest -v tests

## Licence

Apache 2.0 (see [LICENSE.txt](LICENSE.txt))