{ "info": { "author": "Jim Pivarski (IRIS-HEP)", "author_email": "pivarski@princeton.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: MacOS", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development", "Topic :: Utilities" ], "description": ".. image:: https://raw.githubusercontent.com/scikit-hep/vegascope/master/logo-300px.png\n :alt: VegaScope\n :target: https://github.com/scikit-hep/vegascope\n\n|\n\nVegaScope is a minimal viewer of `Vega `__ and `Vega-Lite `__ graphics from Python. The Python process generating the graphics does not need to be on the same machine as the web browser viewing them.\n\nVegaScope has zero dependencies and can be installed as a single file. It can be used as a Python library or as a shell command, watching a file or stdin.\n\nTo install, simply\n\n.. code-block:: bash\n\n pip install vegascope\n\n(with ``--user`` if not superuser) or copy the single `vegascope.py `__ file to the desired location.\n\nExample\n-------\n\nSuppose that we have a process that generates Vega graphics, such as `PdVega `__ (example requires pip packages ``pdvega`` and ``vega_datasets``):\n\n\n.. code-block:: python\n\n >>> from vega_datasets import data\n >>> import pdvega\n >>> stocks = data.stocks(pivoted=True)\n >>> stocks.vgplot.line().spec\n\n.. code-block::\n\n {'selection': {'grid': {'bind': 'scales', 'type': 'interval'}}, 'encoding': {'y': {'fi\n eld': 'value', 'type': 'quantitative'}, 'x': {'field': 'date', 'type': 'temporal'}, 'c\n olor': {'field': 'variable', 'type': 'nominal'}}, 'height': 300, 'width': 450, '$schem\n a': 'https://vega.github.io/schema/vega-lite/v2.json', 'mark': 'line', 'data': {'value\n s': [{'date': '2000-01-01', 'variable': 'AAPL', 'value': 25.94}, {'date': '2000-01-02'\n ...\n\nThis ``stocks.vgplot.line().spec`` is a JSON object representing a timeseries of stock prices. It is too complicated to read manually.\n\nImport ``vegascope`` and create a ``LocalCanvas``. It opens a tab in your web browser (**hint:** look for it on other desktops or create a browser window in the current desktop first!) for drawing Vega graphics.\n\nEvery time the canvas is called as a function on a Vega graphic, the web page will be updated with the latest plot. There is no need to refresh your browser.\n\n.. code-block:: python\n\n >>> import vegascope\n >>> canvas = vegascope.LocalCanvas()\n Created new window in existing browser session.\n 127.0.0.1 connected\n\n >>> canvas.how()\n Point web browser at: http://localhost:40142\n\n >>> canvas(stocks.vgplot.line().spec)\n\n|\n\n.. image:: https://raw.githubusercontent.com/scikit-hep/vegascope/master/example.png\n\n|\n\nPdVega was only used as an example; the graphic could have come from anywhere. It could be a URL string:\n\n\n.. code-block:: python\n\n >>> canvas(\"https://vega.github.io/vega/examples/stacked-bar-chart.vg.json\")\n\nOr a JSON string:\n\n.. code-block:: python\n\n >>> graphic = \"\"\"{\n ... \"$schema\": \"https://vega.github.io/schema/vega-lite/v2.json\",\n ... \"description\": \"A simple bar chart with embedded data.\",\n ... \"data\": {\n ... \"values\": [\n ... {\"a\": \"A\",\"b\": 28}, {\"a\": \"B\",\"b\": 55}, {\"a\": \"C\",\"b\": 43},\n ... {\"a\": \"D\",\"b\": 91}, {\"a\": \"E\",\"b\": 81}, {\"a\": \"F\",\"b\": 53},\n ... {\"a\": \"G\",\"b\": 19}, {\"a\": \"H\",\"b\": 87}, {\"a\": \"I\",\"b\": 52}\n ... ]\n ... },\n ... \"mark\": \"bar\",\n ... \"encoding\": {\n ... \"x\": {\"field\": \"a\", \"type\": \"ordinal\"},\n ... \"y\": {\"field\": \"b\", \"type\": \"quantitative\"}\n ... }\n ... }\"\"\"\n >>> canvas(graphic)\n\nOr a JSON object as nested Python dicts. It supports the Vega 3 and Vega-Lite 2 specifications.\n\nInteractive features\n--------------------\n\nIn addition to any interactivity the Vega graphic may have on its own, VegaScope has five interactive features:\n\n- **Save as PNG:** create a PNG image in your downloads folder (file name is the current title + ``.png``).\n- **Save as SVG:** create a SVG image in your downloads folder (ending in ``.svg``). SVG files can be edited as vector graphics (you can move the data points around, add annotations) and converted losslessly to sharp PDFs. My favorite tool for editing SVG and converting to PDF is `Inkscape `__.\n- **Zoom buttons/box:** scale the graphic on the web page. Does not affect saved file size.\n- **View source:** to see the raw JSON.\n- **View in editor:** to edit and view the graphic in the official `Vega editor `__. This editor gives you a lot of insight into how Vega declarations translate into graphics, but it's not optimal for rapid-fire plotting.\n\nSaving images from a script\n---------------------------\n\nYou may want to save images programmatically (in a loop, for instance), so the VegaScope canvas has methods for invoking this from the server:\n\n.. code-block:: python\n\n >>> canvas.png(graphic, title=\"filename\") # saves filename.png\n >>> canvas.svg(graphic, title=\"filename\") # saves filename.svg\n\nHowever, your web browser will probably interpret this as a pop-up. You usually don't want web servers to remotely write files to your disk! In most web browsers, an indicator appears in the location bar the first time you try to write a file programmatically; select it and allow pop-ups for this server.\n\n**Hint:** your web browser will remember the setting if you always use the same port number:\n\n.. code-block:: python\n\n >>> canvas = vegascope.LocalCanvas(port=12345)\n\nRemote viewing\n--------------\n\nAll of the examples above used ``vegascope.LocalCanvas``. To make the web server visible to the world, create a ``vegascope.Canvas``.\n\n.. code-block:: python\n\n >>> canvas = vegascope.Canvas()\n Point web browser at: http://8.8.8.8:50060\n\nwhere ``8.8.8.8`` is the real IP address of the machine running VegaScope. Everything proceeds as before except that the web browser is no longer restricted to the same machine as the server.\n\nHowever, the connection may be blocked at any step between the server and the client. Most system administrators block all ports except a list of justified exceptions; you may need to ask for a port to be opened and explicitly pass that port.\n\n.. code-block:: python\n\n >>> canvas = vegascope.Canvas(port=12345)\n Point web browser at: http://8.8.8.8:12345\n\nEven beyond port blocking, some administrators may block the HTTP protocol, since web servers can be used for less benign activities than plotting. They may cite a security risk in projecting your data to anyone with the address (though you can monitor who's watching with ``canvas.connections``). It depends on the sensitivity of your data.\n\nIf an unrestricted web server is not an option for you, but ssh is (after all, how are you connecting to the machine's terminal?), consider ``vegascope.TunnelCanvas``.\n\n.. code-block:: python\n\n >>> canvas = vegascope.TunnelCanvas()\n Type into terminal: ssh -L 43213:localhost:43213 username@8.8.8.8\n Point web browser at: http://localhost:43213\n\nThe TunnelCanvas is only available locally, but you can extend the meaning of \"local\" through an ssh tunnel. Assuming that you're already connected to the remote machine through one ssh terminal, open another terminal and paste the new ssh command into it. As long as that second terminal is open, your local web browser will see ``http://localhost:43213`` as the remote one.\n\nWhereas ``vegascope.Canvas`` is world-readable, ``vegascope.TunnelCanvas`` is as safe as ssh. Choose the option that best fits your security constraints.\n\nVega version\n------------\n\nVegaScope instructs your web browser to use a recent `Vega `__, `Vega-Lite `__, and `Vega-Embed `__ version from cdn.jsdelivr.net. If you'd like a different version, you can specify ``vega=\"3.3.1\"``, ``vegalite=\"2.5.2\"``, ``vegaembed=\"3.15.0\"`` in any ``Canvas`` constructor.\n\nPassing ``None`` or an empty string uses a standalone version embedded within the vegascope.py file. This is useful if your computer (specifically, the one your web browser is running on) is disconnected from the internet.\n\nAs a shell command\n------------------\n\nIf it's more convenient to use VegaScope as a separate process, it can run as a shell command, watching a file for changes or stdin. All of the options are available as command line switches:\n\n.. code-block::\n\n usage: vegascope.py [-h] [-w WAIT] [-t {Canvas,LocalCanvas,TunnelCanvas}]\n [-T TITLE] [-b HOST] [-p PORT] [-q] [-Q] [--vega VERSION]\n [--vega-lite VERSION] [--vega-embed VERSION]\n [FILE]\n\n VegaScope can be used within Python (import vegascope) or a shell command.\n\n positional arguments:\n FILE file to watch for changes; default is '-' for lines on\n stdin (stdin requires one JSON object per line)\n\n optional arguments:\n -h, --help show this help message and exit\n -w WAIT, --wait WAIT poll wait time in seconds; default is 0.1 (100 ms);\n not applicable to stdin\n -t {Canvas,LocalCanvas,TunnelCanvas}, --type {Canvas,LocalCanvas,TunnelCanvas}\n type of Canvas; default is LocalCanvas\n -T TITLE, --title TITLE\n browser window title and saved file name prefix\n -b HOST, --host HOST host name to bind to; default is 0.0.0.0 for any\n address (not applicable to LocalCanvas or\n TunnelVanvas)\n -p PORT, --port PORT port to bind to; default is 0 for any open port\n -q, --no-verbose if supplied, do not log output to stdout (opposite of\n verbose)\n -Q, --no-newtab if supplied, do not open a browser window (opposite of\n newtab, only applicable to LocalCanvas)\n --vega VERSION Vega version to request from cdn.jsdelivr.net or \"\" to\n use an standalone copy.\n --vega-lite VERSION Vega-Lite version to request from cdn.jsdelivr.net or\n \"\" to use an standalone copy.\n --vega-embed VERSION Vega-Embed version to request from cdn.jsdelivr.net or\n \"\" to use an standalone copy.\n\nIn file-watching mode, the canvas will update when the file is overwritten. In stdin-watching mode, the canvas will update when a one-line JSON document is passed to stdin.", "description_content_type": "", "docs_url": null, "download_url": "https://raw.githubusercontent.com/scikit-hep/vegascope/master/vegascope.py", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scikit-hep/vegascope", "keywords": "", "license": "BSD 3-clause", "maintainer": "Jim Pivarski (IRIS-HEP)", "maintainer_email": "pivarski@princeton.edu", "name": "vegascope", "package_url": "https://pypi.org/project/vegascope/", "platform": "Any", "project_url": "https://pypi.org/project/vegascope/", "project_urls": { "Download": "https://raw.githubusercontent.com/scikit-hep/vegascope/master/vegascope.py", "Homepage": "https://github.com/scikit-hep/vegascope" }, "release_url": "https://pypi.org/project/vegascope/1.0.13/", "requires_dist": null, "requires_python": "", "summary": "View Vega/Vega-Lite plots in your web browser from local or remote Python processes.", "version": "1.0.13" }, "last_serial": 5412721, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6c103659a1ca362a0495c3975d1cedb1", "sha256": "8b08e9069fb3d2d49a9d367cd619e4a694bc20aba4396683ccde1746ae7666a1" }, "downloads": -1, "filename": "vegascope-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6c103659a1ca362a0495c3975d1cedb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 228318, "upload_time": "2018-03-15T12:56:24", "url": "https://files.pythonhosted.org/packages/28/8c/6e68900c9acf95dcd1576ffc6003ab8375c395ac7b758a7707e1bea4aa0c/vegascope-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "81a05efd1089a2e37d5d81be84e84032", "sha256": "cbdb0d9d777f284be3aadc292a60549a2f2e548567a32c61f68899b6c8eb6c1d" }, "downloads": -1, "filename": "vegascope-1.0.1.tar.gz", "has_sig": false, "md5_digest": "81a05efd1089a2e37d5d81be84e84032", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 289618, "upload_time": "2018-03-15T13:38:28", "url": "https://files.pythonhosted.org/packages/87/43/f19fe429b5bde0f292fbf80a8c20cccac7edea9d55dda746f279775b701c/vegascope-1.0.1.tar.gz" } ], "1.0.10": [ { "comment_text": "", "digests": { "md5": "3b4b3449f10ff285322539e841ab4b8e", "sha256": "de68b39146dcc77d0ad061cb8281e02af6d9f352eeb7f67332e6bfa67b422c8c" }, "downloads": -1, "filename": "vegascope-1.0.10.tar.gz", "has_sig": false, "md5_digest": "3b4b3449f10ff285322539e841ab4b8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 335104, "upload_time": "2018-06-15T08:51:55", "url": "https://files.pythonhosted.org/packages/43/d0/f16076fff1f43f569eda7f2be0320c1fc12d093818d29a8714a48e521011/vegascope-1.0.10.tar.gz" } ], "1.0.11": [ { "comment_text": "", "digests": { "md5": "1b427a6e7046c3c6b95acc3e8075f06d", "sha256": "57cd37c9e443345fc5f5fcd43d4efeea285fab3c68397eca6be1a37613e576ba" }, "downloads": -1, "filename": "vegascope-1.0.11.tar.gz", "has_sig": false, "md5_digest": "1b427a6e7046c3c6b95acc3e8075f06d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 335102, "upload_time": "2018-06-22T19:40:24", "url": "https://files.pythonhosted.org/packages/83/d6/c74d9923e74cc9b9d7e53b7e77e7a1c4ebf682bd18a582a2aa86f9954a62/vegascope-1.0.11.tar.gz" } ], "1.0.12": [ { "comment_text": "", "digests": { "md5": "9a1a3cc46ea75fa32e76ef8763601d92", "sha256": "14411efd8868df39b818c709af0f4508985339a2254b164843eb994bedd096cb" }, "downloads": -1, "filename": "vegascope-1.0.12.tar.gz", "has_sig": false, "md5_digest": "9a1a3cc46ea75fa32e76ef8763601d92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 340056, "upload_time": "2018-10-26T20:01:24", "url": "https://files.pythonhosted.org/packages/21/79/443d39f25c29e5ad895f0f222c4c38c8c2be6792862a13e5c8ca4c14e306/vegascope-1.0.12.tar.gz" } ], "1.0.13": [ { "comment_text": "", "digests": { "md5": "59929b3b9c4b30891482cd19740c3553", "sha256": "5b546be1a68a626ead37a18b1b2444103312d707e66be9cec92a1ec147cc1414" }, "downloads": -1, "filename": "vegascope-1.0.13.tar.gz", "has_sig": false, "md5_digest": "59929b3b9c4b30891482cd19740c3553", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 360703, "upload_time": "2019-06-18T00:33:57", "url": "https://files.pythonhosted.org/packages/31/80/5c82af5b72421daf4f964d63bff36d351c78746b1411a2e3f1154db7b3ff/vegascope-1.0.13.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "0fb6ff973c7cbc623d24db9472b023e3", "sha256": "ea2fae4e979d267766f0dc3c64b346c92c170b857ab08657bd0b0f310ad15dc0" }, "downloads": -1, "filename": "vegascope-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0fb6ff973c7cbc623d24db9472b023e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 289761, "upload_time": "2018-03-15T14:17:47", "url": "https://files.pythonhosted.org/packages/f9/a5/01c62d9525cc09980752fcf8f860fa17436d55d6d39c56ba8137556e1c0f/vegascope-1.0.2.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "b0d838235a6b0c30fe0c85cb381d88d8", "sha256": "e4888cf00a054807113e6be1c726f2fd316176b18871bf370743979ba2d2fd12" }, "downloads": -1, "filename": "vegascope-1.0.4.tar.gz", "has_sig": false, "md5_digest": "b0d838235a6b0c30fe0c85cb381d88d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 279126, "upload_time": "2018-05-19T17:33:01", "url": "https://files.pythonhosted.org/packages/c0/a4/b95b19413012795d34c6c3f3149ef3ffaf5053d0b98fc028696ba6ca2386/vegascope-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "4e5ebb9fdfd0c7d5d57eb719796f318e", "sha256": "78ca382087884396087ca4f6ad25ee69070040567a14fc5d3719e3ad9b5b9e25" }, "downloads": -1, "filename": "vegascope-1.0.5.tar.gz", "has_sig": false, "md5_digest": "4e5ebb9fdfd0c7d5d57eb719796f318e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 279126, "upload_time": "2018-05-19T17:37:31", "url": "https://files.pythonhosted.org/packages/2d/de/fcb71ec6114e17abfebd16b4920658512396c5eed2032d3e5dc71aa1a2ad/vegascope-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "265c386b312bf561204be5aece95c858", "sha256": "88e3b9706dd1e8fba774a3e038f360645ae92456b1b623aba03887bf2c69c1c4" }, "downloads": -1, "filename": "vegascope-1.0.6.tar.gz", "has_sig": false, "md5_digest": "265c386b312bf561204be5aece95c858", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 279120, "upload_time": "2018-05-19T17:40:17", "url": "https://files.pythonhosted.org/packages/e9/a9/95c9914379ef8ab2d87ca9ad6ea126579d62796be8e1cdb12090a702255a/vegascope-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "933e42906ab94a9c29fc0a5b7cc11361", "sha256": "fa199b7ccaeda884cfc59042c5e7e3fdf830ecb7853ffd934a65f91cd0399b5d" }, "downloads": -1, "filename": "vegascope-1.0.7.tar.gz", "has_sig": false, "md5_digest": "933e42906ab94a9c29fc0a5b7cc11361", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 279411, "upload_time": "2018-06-07T22:53:48", "url": "https://files.pythonhosted.org/packages/77/da/790466c0f09503fb87b5ce8e0f9aafcae46da80bc7fe0fcfcbd2ff91bf4b/vegascope-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "11373ecc5d5dcfc555e876fbad524a02", "sha256": "ddfbdf2b431f930dfb9a617edc72ee690e4e49442181d645808bd56cccc29dea" }, "downloads": -1, "filename": "vegascope-1.0.8.tar.gz", "has_sig": false, "md5_digest": "11373ecc5d5dcfc555e876fbad524a02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 335049, "upload_time": "2018-06-15T08:40:15", "url": "https://files.pythonhosted.org/packages/bc/d9/71629e5bfe859fa9ec5f53db512b06ebbea3b6af459a6eefc8b7ab9c7bbe/vegascope-1.0.8.tar.gz" } ], "1.0.9": [ { "comment_text": "", "digests": { "md5": "739aeed70c0709a12456061f4ba5ff6b", "sha256": "603acc11459432d87787077fe011b29ae22413acae4080675b4c777d18ab7b2a" }, "downloads": -1, "filename": "vegascope-1.0.9.tar.gz", "has_sig": false, "md5_digest": "739aeed70c0709a12456061f4ba5ff6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 335077, "upload_time": "2018-06-15T08:47:33", "url": "https://files.pythonhosted.org/packages/69/79/7aab89702d3cb95a5c2d5b11a8fea4289ae6176e402c498e00152fffa540/vegascope-1.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "59929b3b9c4b30891482cd19740c3553", "sha256": "5b546be1a68a626ead37a18b1b2444103312d707e66be9cec92a1ec147cc1414" }, "downloads": -1, "filename": "vegascope-1.0.13.tar.gz", "has_sig": false, "md5_digest": "59929b3b9c4b30891482cd19740c3553", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 360703, "upload_time": "2019-06-18T00:33:57", "url": "https://files.pythonhosted.org/packages/31/80/5c82af5b72421daf4f964d63bff36d351c78746b1411a2e3f1154db7b3ff/vegascope-1.0.13.tar.gz" } ] }