# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['acr_cloud']

package_data = \
{'': ['*']}

install_requires = \
['requests>=2.22,<3.0']

setup_kwargs = {
    'name': 'acr-cloud',
    'version': '0.1.10',
    'description': 'acrcloud music recognition wrapper',
    'long_description': '# Eel\n\nEel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries.\n\n> **Eel hosts a local webserver, then lets you annotate functions in Python so that they can be called from Javascript, and vice versa.**\n\nEel is designed to take the hassle out of writing short and simple GUI applications. If you are familiar with Python and web development, probably just jump to [this example](https://github.com/ChrisKnott/Eel/tree/master/examples/04%20-%20file_access) which picks random file names out of the given folder (something that is impossible from a browser).\n\n<p align="center"><img src="https://raw.githubusercontent.com/samuelhwilliams/Eel/master/examples/04%20-%20file_access/Screenshot.png" ></p>\n\n<!-- TOC -->\n\n- [Eel](#eel)\n  - [Intro](#intro)\n  - [Install](#install)\n  - [Usage](#usage)\n    - [Directory Structure](#directory-structure)\n    - [Starting the app](#starting-the-app)\n    - [App options](#app-options)\n      - [Chrome/Chromium flags](#chromechromium-flags)\n    - [Exposing functions](#exposing-functions)\n    - [Eello, World!](#eello-world)\n    - [Return values](#return-values)\n      - [Callbacks](#callbacks)\n      - [Synchronous returns](#synchronous-returns)\n  - [Asynchronous Python](#asynchronous-python)\n  - [Building distributable binary with PyInstaller](#building-distributable-binary-with-pyinstaller)\n  - [Microsoft Edge](#microsoft-edge)\n\n<!-- /TOC -->\n\n## Intro\n\nThere are several options for making GUI apps in Python, but if you want to use HTML/JS (in order to use jQueryUI or Bootstrap, for example) then you generally have to write a lot of boilerplate code to communicate from the Client (Javascript) side to the Server (Python) side.\n\nThe closest Python equivalent to Electron (to my knowledge) is [cefpython](https://github.com/cztomczak/cefpython). It is a bit heavy weight for what I wanted.\n\nEel is not as fully-fledged as Electron or cefpython - it is probably not suitable for making full blown applications like Atom - but it is very suitable for making the GUI equivalent of little utility scripts that you use internally in your team.\n\nFor some reason many of the best-in-class number crunching and maths libraries are in Python (Tensorflow, Numpy, Scipy etc) but many of the best visualization libraries are in Javascript (D3, THREE.js etc). Hopefully Eel makes it easy to combine these into simple utility apps for assisting your development.\n\n## Install\n\nInstall from pypi with `pip`:\n\n```shell\npip install eel\n```\n\n## Usage\n\n### Directory Structure\n\nAn Eel application will be split into a frontend consisting of various web-technology files (.html, .js, .css) and a backend consisting of various Python scripts.\n\nAll the frontend files should be put in a single directory (they can be further divided into folders inside this if necessary).\n\n```\nmy_python_script.py     <-- Python scripts\nother_python_module.py\nstatic_web_folder/      <-- Web folder\n  main_page.html\n  css/\n    style.css\n  img/\n    logo.png\n```\n\n### Starting the app\n\nSuppose you put all the frontend files in a directory called `web`, including your start page `main.html`, then the app is started like this;\n\n```python\nimport eel\neel.init(\'web\')\neel.start(\'main.html\')\n```\n\nThis will start a webserver on the default settings (http://localhost:8000) and open a browser to http://localhost:8000/main.html.\n\nIf Chrome or Chromium is installed then by default it will open in that in App Mode (with the `--app` cmdline flag), regardless of what the OS\'s default browser is set to (it is possible to override this behaviour).\n\n### App options\n\nAdditional options can be passed to `eel.start()` as keyword arguments.\n\nSome of the options include the mode the app is in (e.g. \'chrome\'), the port the app runs on, the host name of the app, and adding additional command line flags.\n\nAs of Eel v0.11.0, the following options are available to `start()`:\n - **mode**, a string specifying what browser to use (e.g. `\'chrome\'`, `\'electron\'`, `\'edge\'`, `\'custom\'`). Can also be `None` or `False` to not open a window. *Default: `\'chrome\'`*\n - **host**, a string specifying what hostname to use for the Bottle server. *Default: `\'localhost\'`)*\n - **port**, an int specifying what port to use for the Bottle server. Use `0` for port to be picked automatically. *Default: `8000`*.\n - **block**, a bool saying whether or not the call to `start()` should block the calling thread. *Default: `True`*\n - **jinja_templates**, a string specifying a folder to use for Jinja2 templates, e.g. `my_templates`. *Default:  `None`*\n - **cmdline_args**, a list of strings to pass to the command to start the browser. For example, we might add extra flags for Chrome; ```eel.start(\'main.html\', mode=\'chrome-app\', port=8080, cmdline_args=[\'--start-fullscreen\', \'--browser-startup-dialog\'])```. *Default: `[]`*\n - **size**, a tuple of ints specifying the (width, height) of the main window in pixels *Default: `None`*\n - **position**, a tuple of ints specifying the (left, top) of the main window in pixels *Default: `None`*\n - **geometry**, a dictionary specifying the size and position for all windows. The keys should be the relative path of the page, and the values should be a dictionary of the form `{\'size\': (200, 100), \'position\': (300, 50)}`. *Default: {}*\n - **close_callback**, a lambda or function that is called when a websocket to a window closes (i.e. when the user closes the window). It should take two arguments; a string which is the relative path of the page that just closed, and a list of other websockets that are still open. *Default: `None`*\n - **app**, an instance of Bottle which will be used rather than creating a fresh one. This can be used to install middleware on the\n instance before starting eel, e.g. for session management, authentication, etc.\n\n\n\n### Exposing functions\n\nIn addition to the files in the frontend folder, a Javascript library will be served at `/eel.js`. You should include this in any pages:\n\n```html\n<script type="text/javascript" src="/eel.js"></script>\n```\n\nIncluding this library creates an `eel` object which can be used to communicate with the Python side.\n\nAny functions in the Python code which are decorated with `@eel.expose` like this...\n\n```python\n@eel.expose\ndef my_python_function(a, b):\n    print(a, b, a + b)\n```\n\n...will appear as methods on the `eel` object on the Javascript side, like this...\n\n```javascript\nconsole.log("Calling Python...");\neel.my_python_function(1, 2); // This calls the Python function that was decorated\n```\n\nSimilarly, any Javascript functions which are exposed like this...\n\n```javascript\neel.expose(my_javascript_function);\nfunction my_javascript_function(a, b, c, d) {\n  if (a < b) {\n    console.log(c * d);\n  }\n}\n```\n\ncan be called from the Python side like this...\n\n```python\nprint(\'Calling Javascript...\')\neel.my_javascript_function(1, 2, 3, 4)  # This calls the Javascript function\n```\n\nWhen passing complex objects as arguments, bear in mind that internally they are converted to JSON and sent down a websocket (a process that potentially loses information).\n\n### Eello, World!\n\n> See full example in: [examples/01 - hello_world](https://github.com/ChrisKnott/Eel/tree/master/examples/01%20-%20hello_world)\n\nPutting this together into a **Hello, World!** example, we have a short HTML page, `web/hello.html`:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <title>Hello, World!</title>\n\n    <!-- Include eel.js - note this file doesn\'t exist in the \'web\' directory -->\n    <script type="text/javascript" src="/eel.js"></script>\n    <script type="text/javascript">\n      eel.expose(say_hello_js); // Expose this function to Python\n      function say_hello_js(x) {\n        console.log("Hello from " + x);\n      }\n\n      say_hello_js("Javascript World!");\n      eel.say_hello_py("Javascript World!"); // Call a Python function\n    </script>\n  </head>\n\n  <body>\n    Hello, World!\n  </body>\n</html>\n```\n\nand a short Python script `hello.py`:\n\n```python\nimport eel\n\n# Set web files folder and optionally specify which file types to check for eel.expose()\n#   *Default allowed_extensions are: [\'.js\', \'.html\', \'.txt\', \'.htm\', \'.xhtml\']\neel.init(\'web\', allowed_extensions=[\'.js\', \'.html\'])\n\n@eel.expose                         # Expose this function to Javascript\ndef say_hello_py(x):\n    print(\'Hello from %s\' % x)\n\nsay_hello_py(\'Python World!\')\neel.say_hello_js(\'Python World!\')   # Call a Javascript function\n\neel.start(\'hello.html\')             # Start (this blocks and enters loop)\n```\n\nIf we run the Python script (`python hello.py`), then a browser window will open displaying `hello.html`, and we will see...\n\n```\nHello from Python World!\nHello from Javascript World!\n```\n\n...in the terminal, and...\n\n```\nHello from Javascript World!\nHello from Python World!\n```\n\n...in the browser console (press F12 to open).\n\nYou will notice that in the Python code, the Javascript function is called before the browser window is even started - any early calls like this are queued up and then sent once the websocket has been established.\n\n### Return values\n\nWhile we want to think of our code as comprising a single application, the Python interpreter and the browser window run in separate processes. This can make communicating back and forth between them a bit of a mess, especially if we always had to explicitly _send_ values from one side to the other.\n\nEel supports two ways of retrieving _return values_ from the other side of the app, which helps keep the code concise.\n\n#### Callbacks\n\nWhen you call an exposed function, you can immediately pass a callback function afterwards. This callback will automatically be called asynchrounously with the return value when the function has finished executing on the other side.\n\nFor example, if we have the following function defined and exposed in Javascript:\n\n```javascript\neel.expose(js_random);\nfunction js_random() {\n  return Math.random();\n}\n```\n\nThen in Python we can retrieve random values from the Javascript side like so:\n\n```python\ndef print_num(n):\n    print(\'Got this from Javascript:\', n)\n\n# Call Javascript function, and pass explicit callback function\neel.js_random()(print_num)\n\n# Do the same with an inline lambda as callback\neel.js_random()(lambda n: print(\'Got this from Javascript:\', n))\n```\n\n(It works exactly the same the other way around).\n\n#### Synchronous returns\n\nIn most situations, the calls to the other side are to quickly retrieve some piece of data, such as the state of a widget or contents of an input field. In these cases it is more convenient to just synchronously wait a few milliseconds then continue with your code, rather than breaking the whole thing up into callbacks.\n\nTo synchronously retrieve the return value, simply pass nothing to the second set of brackets. So in Python we would write:\n\n```python\nn = eel.js_random()()  # This immediately returns the value\nprint(\'Got this from Javascript:\', n)\n```\n\nYou can only perform synchronous returns after the browser window has started (after calling `eel.start()`), otherwise obviously the call with hang.\n\nIn Javascript, the language doesn\'t allow us to block while we wait for a callback, except by using `await` from inside an `async` function. So the equivalent code from the Javascript side would be:\n\n```javascript\nasync function run() {\n  // Inside a function marked \'async\' we can use the \'await\' keyword.\n\n  let n = await eel.py_random()(); // Must prefix call with \'await\', otherwise it\'s the same syntax\n  console.log("Got this from Python: " + n);\n}\n\nrun();\n```\n\n## Asynchronous Python\n\nEel is built on Bottle and Gevent, which provide an asynchronous event loop similar to Javascript. A lot of Python\'s standard library implicitly assumes there is a single execution thread - to deal with this, Gevent can "[monkey patch](https://en.wikipedia.org/wiki/Monkey_patch)" many of the standard modules such as `time`. ~~This monkey patching is done automatically when you call `import eel`~~. If you need monkey patching you should `import gevent.monkey` and call `gevent.monkey.patch_all()` _before_ you `import eel`. Monkey patching can interfere with things like debuggers so should be avoided unless necessary.\n\nFor most cases you should be fine by avoiding using `time.sleep()` and instead using the versions provided by `gevent`. For convenience, the two most commonly needed gevent methods, `sleep()` and `spawn()` are provided directly from Eel (to save importing `time` and/or `gevent` as well).\n\nIn this example...\n\n```python\nimport eel\neel.init(\'web\')\n\ndef my_other_thread():\n    while True:\n        print("I\'m a thread")\n        eel.sleep(1.0)                  # Use eel.sleep(), not time.sleep()\n\neel.spawn(my_other_thread)\n\neel.start(\'main.html\', block=False)     # Don\'t block on this call\n\nwhile True:\n    print("I\'m a main loop")\n    eel.sleep(1.0)                      # Use eel.sleep(), not time.sleep()\n```\n\n...we would then have three "threads" (greenlets) running;\n\n1. Eel\'s internal thread for serving the web folder\n2. The `my_other_thread` method, repeatedly printing **"I\'m a thread"**\n3. The main Python thread, which would be stuck in the final `while` loop, repeatedly printing **"I\'m a main loop"**\n\n## Building distributable binary with PyInstaller\n\nIf you want to package your app into a program that can be run on a computer without a Python interpreter installed, you should use **PyInstaller**.\n\n1. Configure a virtualenv with desired Python version and minimum necessary Python packages\n2. Install PyInstaller `pip install PyInstaller`\n3. In your app\'s folder, run `python -m eel [your_main_script] [your_web_folder]` (for example, you might run `python -m eel hello.py web`)\n4. This will create a new folder `dist/`\n5. Valid PyInstaller flags can be passed through, such as excluding modules with the flag: `--exclude module_name`. For example, you might run `python -m eel file_access.py web --exclude win32com --exclude numpy --exclude cryptography`\n6. When happy that your app is working correctly, add `--onefile --noconsole` flags to build a single executable file\n\nConsult the [documentation for PyInstaller](http://PyInstaller.readthedocs.io/en/stable/) for more options.\n\n## Microsoft Edge\n\nFor Windows 10 users, Microsoft Edge (`eel.start(.., mode=\'edge\')`) is installed by default and a useful fallback if a preferred browser is not installed. See the examples:\n\n- A Hello World example using Microsoft Edge: [examples/01 - hello_world-Edge/](https://github.com/ChrisKnott/Eel/tree/master/examples/01%20-%20hello_world-Edge)\n- Example implementing browser-fallbacks: [examples/07 - CreateReactApp/eel_CRA.py](https://github.com/ChrisKnott/Eel/tree/master/examples/07%20-%20CreateReactApp/eel_CRA.py)\n',
    'author': 'Andriy Orehov',
    'author_email': 'andriyorehov@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://www.example.org/',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.5,<4.0',
}


setup(**setup_kwargs)
