{ "info": { "author": "Nick Iodice, Erik Schlegel", "author_email": "niiodice@microsoft.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# nile\n\n- [nile](#nile)\n - [About](#about)\n - [Installation](#installation)\n - [Samples](#samples)\n - [Basic Usage](#basic-usage)\n - [Advanced usage](#advanced-usage)\n - [Contributing](#contributing)\n\n## About\n\n[![Build Status](https://travis-ci.org/microsoft/nile.svg?branch=master)](https://travis-ci.org/microsoft/nile/)\n[![codecov](https://codecov.io/gh/microsoft/nile/branch/master/graph/badge.svg)](https://codecov.io/gh/microsoft/nile)\n[![PyPI version](https://badge.fury.io/py/nile.svg)](https://badge.fury.io/py/nile)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nile.svg)](https://pypi.org/project/nile/)\n[![PyPI - License](https://img.shields.io/pypi/l/nile.svg)](https://pypi.org/project/nile/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/nile.svg)](https://pypi.org/project/nile/)\n\n`nile` is a library that aims to simplify building applications that leverage real time data collected from one or more sensors or media devices. `nile` simplifies this process by implementing the boiler plate code that orchestrates configurations composed of these key abstractions:\n\n- Device abstraction that yields data\n- Functional layer to transform data\n- Processing layer that applies logic to transformation output\n\n`nile` will handle all device orchestration including wiring up the correct device, transformer and processing layers, managing device lifecycle and cleaning up unused resources.\n\n## Installation\n\n`nile` currently supports Python versions `3.4`, `3.5`, `3.6` and `3.7`. It can be installed by running `pip install nile`.\n\n## Samples\n\nA dockerized sample is included with this repository. In this sample `nile` orchestrates streaming from multiple webcam devices pipes the feeds to a camera-specific set of consumers which print output in a table format to `stdout`. More specifically, the following configurations are used:\n\n- Intersection Webcam\n - Frames converted to grayscale\n - Output piped to ML model that counts vehicals\n - Output piped to brightness detection\n- College Campus Webcam\n - Frames converted to grayscale\n - Output piped to brightness detection\n\nThe sample can be run locally by running the following commands:\n\n```bash\n# clone the repo\ngit clone https://github.com/microsoft/nile.git\n# enter the nile directory\ncd nile/\n# ensure Docker is running\ndocker --version\n# build the project\ndocker build . -t nile\n# run the samples\ndocker run nile\n```\n\n## Basic Usage\n\nIn order to use `nile` you must implement three abstractions ([documentation here](./nile/interfaces.py)):\n\n- `Device`: Represents a data stream adapter to a physical media device. For example you may build separate devices to stream audio from microphone and HTTP endpoints.\n- `Transformer`: Transform source data. For example, you may transform an MPEG audio stream into PCM/WAV format.\n- `Consumer`: Represents a consumer of the transformed device data. There may be many of these per device. For example, in an audio-streaming application you may build separate consumers to (1) analyze audio wave frequencies, (2) analyze audio wave amplitudes and (3) archive audio onto a cloud-provided storage endpoint.\n\nThe samples directory contains real-world implementations that target live webcam video analysis. [Examples can be found here](./samples/videostream/providers.py).\n\nOnce you have these you can orchestrate them using `nile`:\n\n```python\nfrom time import sleep\nfrom nile.controllers import DeviceController, DeviceFleetManager\n# import your implementations here...\n\n# the controller manages the configuration for a single device\ndevice_controller = DeviceController(\n YourCustomDevice(),\n YourCustomTransformer(),\n (YourCustomDeviceConsumer(),),\n throttle_time_ms=-1 # a positive value specifies the polling delay on the device\n)\n\n# the fleet manager handles configurations for multiple devices\nfleet_manager = DeviceFleetManager()\nfleet_manager.set_controllers({device_controller})\n\n# process for 20 seconds\nsleep(20)\n\n# this closes all devices under management and cleans any resources for those devices\nfleet_controller.shutdown()\n```\n\n## Advanced usage\n\n`nile` supports non-trivial configurations as well and can update in real-time to configuration updates. Here is a more complex orchestration that leverages these features. The source code for the providers can be found [here](./samples/videostream/providers.py):\n\n```python\n# example runs brigtness detection on video frames for 20 seconds, and then adds a car count consumer\n# to one of the video feeds.\nfrom time import sleep\nfrom nile.controllers import DeviceController, DeviceFleetManager\nfrom providers import BrightnessMeasureConsumer, CarCounterConsumer, FrameToGrayscaleTransformer, HttpVideoCaptureDevice\n\n\n# ML model to count cars\ncar_count_consumer = CarCounterConsumer()\n\n# Measure avg. brightness\nbrightness_measure_consumer = BrightnessMeasureConsumer()\n\n# Convert img to grayscale\nimage_converter = FrameToGrayscaleTransformer()\n\nroad_cam = HttpVideoCaptureDevice('Tennasee Road', 'http://traf3.murfreesborotn.gov/axis-cgi/mjpg/video.cgi')\ncampus_cam = HttpVideoCaptureDevice('Bowdoin Campus', 'http://webcam1.bowdoin.edu:4200/axis-cgi/mjpg/video.cgi')\nfleet_controller = DeviceFleetManager()\n\n# start with both feeds running through brightness measuring\nfleet_controller.set_controllers({\n DeviceController(\n device=road_cam,\n transformer=image_converter,\n consumers=(brightness_measure_consumer,),\n throttle_time_ms=-1),\n DeviceController(\n device=campus_cam,\n transformer=image_converter,\n consumers=(brightness_measure_consumer,),\n throttle_time_ms=-1)\n})\n\n# process for 20 seconds\nsleep(20)\n\n# add car count detection on road cam\nfleet_controller.set_controllers({\n DeviceController(\n device=road_cam,\n transformer=image_converter,\n consumers=(brightness_measure_consumer, car_count_consumer),\n throttle_time_ms=-1),\n DeviceController(\n device=campus_cam,\n transformer=image_converter,\n consumers=(brightness_measure_consumer,),\n throttle_time_ms=-1)\n})\n\n# process for 20 seconds\nsleep(20)\n\n# close devices and clean up all resources\nfleet_controller.shutdown()\n```\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.microsoft.com.\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\nFor additional guidance, refer to the project-specific [contributing guidelines](./.github/CONTRIBUTING.md) as well as the [pull request template](./.github/PULL_REQUEST_TEMPLATE.md)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Microsoft/nile", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "nile", "package_url": "https://pypi.org/project/nile/", "platform": "", "project_url": "https://pypi.org/project/nile/", "project_urls": { "Homepage": "https://github.com/Microsoft/nile" }, "release_url": "https://pypi.org/project/nile/0.0.3/", "requires_dist": [ "codecov (==2.0.15) ; extra == 'dev'", "flake8 (==3.7.7) ; extra == 'dev'", "isort (==4.3.10) ; extra == 'dev'", "mypy-extensions (==0.4.1) ; extra == 'dev'", "mypy (==0.670) ; extra == 'dev'", "pydocstyle (==3.0.0) ; extra == 'dev'", "pylint (==2.3.1) ; extra == 'dev'", "pytest (==4.3.1) ; extra == 'dev'", "pytest-cov (==2.6.1) ; extra == 'dev'", "setuptools (==41.0.1) ; extra == 'dev'" ], "requires_python": ">=3.2.*", "summary": "Integration test harness useful for distributed deployments", "version": "0.0.3" }, "last_serial": 5243913, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "9d335e9b10c28a13bdc6f984450f286d", "sha256": "21b776235797a25cf2c4638327ece4a3e7e1ad3abab2cae7d17ceb2f73af186a" }, "downloads": -1, "filename": "nile-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9d335e9b10c28a13bdc6f984450f286d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.2.*", "size": 15008, "upload_time": "2019-05-08T17:47:43", "url": "https://files.pythonhosted.org/packages/e2/9f/6f984df3b50a018ac1814611be9fb6cd84d22ce0756e495c238844edb8ac/nile-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4e069e91f0d3ebf5cbebe7a81a06b52a", "sha256": "6f4e1975aebe17c8fb8a47163d40b3849a29745e2e6f9fd51ee04f98ffa06626" }, "downloads": -1, "filename": "nile-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4e069e91f0d3ebf5cbebe7a81a06b52a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.2.*", "size": 14074, "upload_time": "2019-05-08T17:47:45", "url": "https://files.pythonhosted.org/packages/dc/92/7723c3bd0aaa7dfe0f86c4613ed949946934935fc86e01f08fe752ca6503/nile-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9d335e9b10c28a13bdc6f984450f286d", "sha256": "21b776235797a25cf2c4638327ece4a3e7e1ad3abab2cae7d17ceb2f73af186a" }, "downloads": -1, "filename": "nile-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9d335e9b10c28a13bdc6f984450f286d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.2.*", "size": 15008, "upload_time": "2019-05-08T17:47:43", "url": "https://files.pythonhosted.org/packages/e2/9f/6f984df3b50a018ac1814611be9fb6cd84d22ce0756e495c238844edb8ac/nile-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4e069e91f0d3ebf5cbebe7a81a06b52a", "sha256": "6f4e1975aebe17c8fb8a47163d40b3849a29745e2e6f9fd51ee04f98ffa06626" }, "downloads": -1, "filename": "nile-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4e069e91f0d3ebf5cbebe7a81a06b52a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.2.*", "size": 14074, "upload_time": "2019-05-08T17:47:45", "url": "https://files.pythonhosted.org/packages/dc/92/7723c3bd0aaa7dfe0f86c4613ed949946934935fc86e01f08fe752ca6503/nile-0.0.3.tar.gz" } ] }