René's URL Explorer Experiment


Title: Orca integration for static image export · Issue #1105 · plotly/plotly.py · GitHub

Open Graph Title: Orca integration for static image export · Issue #1105 · plotly/plotly.py

X Title: Orca integration for static image export · Issue #1105 · plotly/plotly.py

Description: Overview This is design proposal for the integration of orca into plotly.py in order to support the programmatic export of high quality static images. Related issues: #880 #596 #564 Background The programmatic export of static raster and...

Open Graph Description: Overview This is design proposal for the integration of orca into plotly.py in order to support the programmatic export of high quality static images. Related issues: #880 #596 #564 Background The ...

X Description: Overview This is design proposal for the integration of orca into plotly.py in order to support the programmatic export of high quality static images. Related issues: #880 #596 #564 Background The ...

Opengraph URL: https://github.com/plotly/plotly.py/issues/1105

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Orca integration for static image export","articleBody":"## Overview\r\nThis is design proposal for the integration of orca into plotly.py in order to support the programmatic export of high quality static images.\r\n\r\n## Related issues:\r\n - https://github.com/plotly/plotly.py/issues/880\r\n - https://github.com/plotly/plotly.py/issues/596\r\n - https://github.com/plotly/plotly.py/issues/564\r\n\r\n## Background\r\nThe programmatic export of static raster and vector images from JavaScript-based data visualization libraries is a notoriously complicated problem.  One common solution is to combine selenium with a driver for a headless web browser like phantomjs or headless firefox/chrome. This approach is used by [Bokeh](https://bokeh.pydata.org/en/latest/docs/user_guide/export.html) and [Altair](https://altair-viz.github.io/user_guide/saving_charts.html) for example.  One challenge with this approach is that it requires the installation of dependencies that are not managed by a Python environment friendly package manager like `conda` (Although [phantomjs](https://github.com/ariya/phantomjs) is available through conda, its development has been suspended and it does not support WebGL).  This presents challenges in terms of portability and reproducibility.\r\n\r\nThe plotly.js team has taken a different approach with the [Orca project](https://github.com/plotly/orca). Orca is a standalone Electron application that can run as a command line image export tool, or it can run in a server mode and respond to image export requests interactively.  Orca is the backbone of the plot.ly image export service, and it was open sourced earlier this year.\r\n\r\nBecause Orca can be built into a standalone executable that does not depend on a system web browser, it is possible to package Orca as a conda package, and we've had [recent success](https://github.com/plotly/orca/pull/113) towards this goal.\r\n\r\nThis issue is for the discussion of how to build the best plotly.py image export experience on top of Orca.\r\n\r\n## Goals\r\n - Users shouldn't need to be aware of how complicated static image export is. At most it should require a single additional conda installation command.\r\n - It should be as easy and reliable to use as matplotlib's image export.\r\n - Nothing should flash on the screen or dock or taskbar during export.\r\n - For raster formats, it should support png, jpg, and webp with configurable resolution.\r\n - For vector formats it should support svg, pdf, and eps.\r\n - It should be possible to save images directly to the local filesystem, or to a writable file object.\r\n - It should be possible to return a byte string containing the image data without specifying filenames (and ideally without actually writing anything to temp files).\r\n - It should be fast enough to support use as an interactive plotting backend (See #1098)\r\n - It should provide really helpful error messages if the orca executable isn't found.\r\n\r\n## Potential Approaches\r\n\r\n### 1. Use command-line interface with figure as arg\r\nThe current Python instructions in the [Orca README](https://github.com/plotly/orca) suggest the following usage:\r\n\r\n```python\r\nfrom subprocess import call\r\nimport json\r\nimport plotly\r\n\r\nfig = {\"data\": [{\"y\": [1,2,1]}]}\r\ncall(['orca', 'graph', json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)])\r\n```\r\n\r\nHere the figure is serialized to a JSON string and passed as a command line argument to orca.  This is nice because it avoids the need to create a temporary file.  Unfortunately, there's a limit to how large the command line arguments can be, and large figures cross that boundary, resulting in an exception.\r\n\r\n### 2. Use command-line interface with figure as tmp file\r\n\r\nAn alternative that doesn't run into this scaling problem is to first write the figure to a temporary file and then call orca with the path to the file.  Furthermore, if a collection of figures needs to converted at once, the paths can all be passed to orca at once and orca will convert them in a batch mode.  This is much faster on average because the orca executable only has to start up and shut down once per batch, rather than once per figure.\r\n\r\n### 3. Use orca in server mode\r\n\r\nAnother approach would be to launch orca as a subprocess in server mode.  The Python library would send individual image export requests to the server on an agreed upon port. The server would respond with the byte string of the converted image.  This approach has several advantages, but also some increased complexity.\r\n\r\n#### 3.1 Advantages\r\n**Response time:** Launch orca as a command line program or as a server process takes roughly 2 seconds to complete.  However requests to an already running server process are much faster. I've seen round trip request to response times of under 50ms.  2 seconds is acceptable in the context of exporting figures to images on the filesystem, but it is not acceptable for interactive use as a static backend.  50ms feels as fast as matplotlib.\r\n\r\n**No temp files:** This approach doesn't involve the use of any temporary files, and it makes it much simpler to support the non-file image use cases, like returning a bytes string or `PIL.Image.Image` object to the user.\r\n\r\n\r\n#### 3.2 Complications\r\nThere are some additional complications to this approach.  First, the long runner server process would need to be managed by the Python library.  It's too resource intensive to run all the time by default, so the user would need to start it explicitly, or we would need to start it the first time an export is requested.\r\n\r\nThen there's the question of whether we leave the server process running indefinitely. Or do we implement some kind of timeout that would shut the process down after a (configurable) period of inactivity?\r\n\r\nFinally, the communication between the Python process and the server requires an open local port, so there's the potential for restrictive firewalls to be a problem. (But, on the other hand, this is also true of the Jupyter Notebook and most applications that interact with an ipython kernel.)\r\n\r\n## What's next\r\nNext we're going to work on testing and releasing conda packages for orca version 1.1.0. \r\n\r\nMethod 2 above (temp files) is probably the least risky approach, but I really want the advantages that come with Method 3 (server process), so I'd like to give this a shot first. I've already developed a prototype of the server mode approach, with automatic startup and timeout shutdown, and I have it working on OS X, Linux, and Windows.  So far I've found it to be very reliable, and the responsiveness is really exciting. \r\n\r\nSo, I'm quite hopeful that we'll be able to build a solid user experience on top of the server mode. But I would like hear some other perspectives here. \r\n\r\n@chriddyp @jackparmer @cldougl @nicolaskruchten @etpinard @Kully ","author":{"url":"https://github.com/jonmmease","@type":"Person","name":"jonmmease"},"datePublished":"2018-08-10T14:51:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/1105/plotly.py/issues/1105"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9a28f088-6bc6-8b37-a391-1f843ee7e17d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8574:305E50:59A10CE:7E2630C:6A572E36
html-safe-noncedb2dbe96797ac943c79a2c267b89ee8d6d97c76a2693c7302f6e7b50a681fe1d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTc0OjMwNUU1MDo1OUExMENFOjdFMjYzMEM6NkE1NzJFMzYiLCJ2aXNpdG9yX2lkIjoiMzYzMjg3NDk5ODIzODUzMTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac31791c874346bed4ac8365ae7cce6e72071c72454b5b5c79d0060f33fc3ec7d9
hovercard-subject-tagissue:349545916
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/1105/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bf6a19f62ed444b2b2fa44cae25ac861129c2108248874db405d2f7d5501512d/plotly/plotly.py/issues/1105
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bf6a19f62ed444b2b2fa44cae25ac861129c2108248874db405d2f7d5501512d/plotly/plotly.py/issues/1105
og:image:altOverview This is design proposal for the integration of orca into plotly.py in order to support the programmatic export of high quality static images. Related issues: #880 #596 #564 Background The ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejonmmease
hostnamegithub.com
expected-hostnamegithub.com
None4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98
turbo-cache-controlno-preview
go-importgithub.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git
octolytics-dimension-user_id5997976
octolytics-dimension-user_loginplotly
octolytics-dimension-repository_id14579099
octolytics-dimension-repository_nwoplotly/plotly.py
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14579099
octolytics-dimension-repository_network_root_nwoplotly/plotly.py
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2576d1f0198cf1588faf2edf27f1ed120903be10
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/plotly/plotly.py/issues/1105#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F1105
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F1105
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=plotly%2Fplotly.py
Reloadhttps://github.com/plotly/plotly.py/issues/1105
Reloadhttps://github.com/plotly/plotly.py/issues/1105
Reloadhttps://github.com/plotly/plotly.py/issues/1105
Please reload this pagehttps://github.com/plotly/plotly.py/issues/1105
plotly https://github.com/plotly
plotly.pyhttps://github.com/plotly/plotly.py
Please reload this pagehttps://github.com/plotly/plotly.py/issues/1105
Notifications https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Fork 2.8k https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Star 18.7k https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Code https://github.com/plotly/plotly.py
Issues 721 https://github.com/plotly/plotly.py/issues
Pull requests 54 https://github.com/plotly/plotly.py/pulls
Actions https://github.com/plotly/plotly.py/actions
Security and quality 0 https://github.com/plotly/plotly.py/security
Insights https://github.com/plotly/plotly.py/pulse
Code https://github.com/plotly/plotly.py
Issues https://github.com/plotly/plotly.py/issues
Pull requests https://github.com/plotly/plotly.py/pulls
Actions https://github.com/plotly/plotly.py/actions
Security and quality https://github.com/plotly/plotly.py/security
Insights https://github.com/plotly/plotly.py/pulse
Orca integration for static image exporthttps://github.com/plotly/plotly.py/issues/1105#top
v3.2.0https://github.com/plotly/plotly.py/milestone/6
https://github.com/jonmmease
jonmmeasehttps://github.com/jonmmease
on Aug 10, 2018https://github.com/plotly/plotly.py/issues/1105#issue-349545916
Directly save image (without opening in browser) #880https://github.com/plotly/plotly.py/issues/880
Bug: Offline Static Image Export #596https://github.com/plotly/plotly.py/issues/596
Is it possible to save graphs as images in offline mode without Ipython notebook? #564https://github.com/plotly/plotly.py/issues/564
Bokehhttps://bokeh.pydata.org/en/latest/docs/user_guide/export.html
Altairhttps://altair-viz.github.io/user_guide/saving_charts.html
phantomjshttps://github.com/ariya/phantomjs
Orca projecthttps://github.com/plotly/orca
recent successhttps://github.com/plotly/orca/pull/113
New module proposal: plotly.io #1098https://github.com/plotly/plotly.py/issues/1098
Orca READMEhttps://github.com/plotly/orca
@chriddyphttps://github.com/chriddyp
@jackparmerhttps://github.com/jackparmer
@cldouglhttps://github.com/cldougl
@nicolaskruchtenhttps://github.com/nicolaskruchten
@etpinardhttps://github.com/etpinard
@Kullyhttps://github.com/Kully
v3.2.0https://github.com/plotly/plotly.py/milestone/6
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.