blob: ff2a828c53b4dcd2c57f48d246b4a6638970839b [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-contributing/development" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.8.1">
<title data-rh="true">Setting up a Development Environment | Superset</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://superset.apache.org/docs/contributing/development"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Setting up a Development Environment | Superset"><meta data-rh="true" name="description" content="The documentation in this section is a bit of a patchwork of knowledge representing the"><meta data-rh="true" property="og:description" content="The documentation in this section is a bit of a patchwork of knowledge representing the"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://superset.apache.org/docs/contributing/development"><link data-rh="true" rel="alternate" href="https://superset.apache.org/docs/contributing/development" hreflang="en"><link data-rh="true" rel="alternate" href="https://superset.apache.org/docs/contributing/development" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://WR5FASX5ED-dsn.algolia.net" crossorigin="anonymous"><script data-rh="true" type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Setting up a Development Environment","item":"https://superset.apache.org/docs/contributing/development"}]}</script><link rel="search" type="application/opensearchdescription+xml" title="Superset" href="/opensearch.xml">
<script src="/script/matomo.js"></script>
<script src="https://widget.kapa.ai/kapa-widget.bundle.js" async data-website-id="c6a8a8b8-3127-48f9-97a7-51e9e10d20d0" data-project-name="Apache Superset" data-project-color="#FFFFFF" data-project-logo="https://images.seeklogo.com/logo-png/50/2/superset-icon-logo-png_seeklogo-500354.png" data-modal-override-open-id="ask-ai-input" data-modal-override-open-class="search-input" data-modal-disclaimer="This is a custom LLM for Apache Superset with access to all [documentation](superset.apache.org/docs/intro/), [GitHub Open Issues, PRs and READMEs](github.com/apache/superset).&amp;#10;&amp;#10;Companies deploy assistants like this ([built by kapa.ai](https://kapa.ai)) on docs via [website widget](https://docs.kapa.ai/integrations/website-widget) (Docker, Reddit), in [support forms](https://docs.kapa.ai/integrations/support-form-deflector) for ticket deflection (Monday.com, Mapbox), or as [Slack bots](https://docs.kapa.ai/integrations/slack-bot) with private sources." data-modal-example-questions="How do I install Superset?,How can I contribute to Superset?" data-button-text-color="rgb(81,166,197)" data-modal-header-bg-color="#ffffff" data-modal-title-color="rgb(81,166,197)" data-modal-title="Apache Superset AI" data-modal-disclaimer-text-color="#000000" data-consent-required="true" data-consent-screen-disclaimer="By clicking &quot;I agree, let&#39;s chat&quot;, you consent to the use of the AI assistant in accordance with kapa.ai&#39;s [Privacy Policy](https://www.kapa.ai/content/privacy-policy). This service uses reCAPTCHA, which requires your consent to Google&#39;s [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai&#39;s and Google&#39;s privacy policies."></script><link rel="stylesheet" href="/assets/css/styles.f45235af.css">
<script src="/assets/js/runtime~main.8a0ac6f2.js" defer="defer"></script>
<script src="/assets/js/main.40d5d6fa.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><defs>
<symbol id="theme-svg-external-link" viewBox="0 0 24 24"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"/></symbol>
</defs></svg>
<script>!function(){var t=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();document.documentElement.setAttribute("data-theme",t||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")),document.documentElement.setAttribute("data-theme-choice",t||"system")}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="theme-layout-navbar navbar navbar--fixed-top"><div class="navbar__inner"><div class="theme-layout-navbar-left navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/superset-logo-horiz.svg" alt="Superset Logo" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/superset-logo-horiz-dark.svg" alt="Superset Logo" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/docs/intro">Documentation</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/intro">Getting Started</a></li><li><a class="dropdown__link" href="/docs/faq">FAQ</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/community">Community</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/community">Resources</a></li><li><a href="https://github.com/apache/superset" target="_blank" rel="noopener noreferrer" class="dropdown__link">GitHub<svg width="12" height="12" aria-hidden="true" class="iconExternalLink_nPIU"><use href="#theme-svg-external-link"></use></svg></a></li><li><a href="http://bit.ly/join-superset-slack" target="_blank" rel="noopener noreferrer" class="dropdown__link">Slack<svg width="12" height="12" aria-hidden="true" class="iconExternalLink_nPIU"><use href="#theme-svg-external-link"></use></svg></a></li><li><a href="https://lists.apache.org/list.html?dev@superset.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Mailing List<svg width="12" height="12" aria-hidden="true" class="iconExternalLink_nPIU"><use href="#theme-svg-external-link"></use></svg></a></li><li><a href="https://stackoverflow.com/questions/tagged/apache-superset" target="_blank" rel="noopener noreferrer" class="dropdown__link">Stack Overflow<svg width="12" height="12" aria-hidden="true" class="iconExternalLink_nPIU"><use href="#theme-svg-external-link"></use></svg></a></li></ul></div></div><div class="theme-layout-navbar-right navbar__items navbar__items--right"><a class="navbar__item navbar__link default-button-theme get-started-button" href="/docs/intro">Get Started</a><a href="https://github.com/apache/superset" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link github-button"></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="system mode" aria-label="Switch between dark and light mode (currently system mode)"><svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" class="toggleIcon_g3eP lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" class="toggleIcon_g3eP darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" class="toggleIcon_g3eP systemToggleIcon_QzmC"><path fill="currentColor" d="m12 21c4.971 0 9-4.029 9-9s-4.029-9-9-9-9 4.029-9 9 4.029 9 9 9zm4.95-13.95c1.313 1.313 2.05 3.093 2.05 4.95s-0.738 3.637-2.05 4.95c-1.313 1.313-3.093 2.05-4.95 2.05v-14c1.857 0 3.637 0.737 4.95 2.05z"></path></svg></button></div><div class="navbarSearchContainer_Bca1"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search (Command+K)"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="theme-layout-main main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/intro">Introduction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/quickstart">Quickstart</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/installation/architecture">Installation</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/configuration/configuring-superset">Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/using-superset/creating-your-first-dashboard">Using Superset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" href="/docs/contributing/">Contributing</a></div><ul class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/contributing/">Contributing to Superset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/contributing/guidelines">Guidelines</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/docs/contributing/development">Setting up a Development Environment</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/contributing/howtos">Development How-tos</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/contributing/resources">Resources</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/contributing/misc">Miscellaneous</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/security/">Security</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/faq">FAQ</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/api">API</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Contributing</span></li><li class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link">Setting up a Development Environment</span></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Setting up a Development Environment</h1></header>
<p>The documentation in this section is a bit of a patchwork of knowledge representing the
multitude of ways that exist to run Superset (<code>docker compose</code>, just &quot;docker&quot;, on &quot;metal&quot;, using
a Makefile).</p>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>Now we have evolved to recommend and support <code>docker compose</code> more actively as the main way
to run Superset for development and preserve your sanity. <strong>Most people should stick to
the first few sections - (&quot;Fork &amp; Clone&quot;, &quot;docker compose&quot; and &quot;Installing Dev Tools&quot;)</strong></p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="fork-and-clone">Fork and Clone<a href="#fork-and-clone" class="hash-link" aria-label="Direct link to Fork and Clone" title="Direct link to Fork and Clone"></a></h2>
<p>First, <a href="https://help.github.com/articles/about-forks/" target="_blank" rel="noopener noreferrer">fork the repository on GitHub</a>,
then clone it.</p>
<p>Second, you can clone the main repository directly, but you won&#x27;t be able to send pull requests.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">git clone git@github.com:your-username/superset.git</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset</span><br></span></code></pre></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="docker-compose-recommended">docker compose (recommended!)<a href="#docker-compose-recommended" class="hash-link" aria-label="Direct link to docker compose (recommended!)" title="Direct link to docker compose (recommended!)"></a></h2>
<p>Setting things up to squeeze a &quot;hello world&quot; into any part of Superset should be as simple as</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># getting docker compose to fire up services, and rebuilding if some docker layers have changed</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># using the `--build` suffix may be slower and optional if layers like py dependencies haven&#x27;t changed</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose up --build</span><br></span></code></pre></div></div>
<p>Note that:</p>
<ul>
<li>this will pull/build docker images and run a cluster of services, including:<!-- -->
<ul>
<li>A Superset <strong>Flask web server</strong>, mounting the local python repo/code</li>
<li>A Superset <strong>Celery worker</strong>, also mounting the local python repo/code</li>
<li>A Superset <strong>Node service</strong>, mounting, compiling and bundling the JS/TS assets</li>
<li>A Superset <strong>Node websocket service</strong> to power the async backend</li>
<li><strong>Postgres</strong> as the metadata database and to store example datasets, charts and dashboards which
should be populated upon startup</li>
<li><strong>Redis</strong> as the message queue for our async backend and caching backend</li>
</ul>
</li>
<li>It&#x27;ll load up examples into the database upon the first startup</li>
<li>all other details and pointers available in
<a href="https://github.com/apache/superset/blob/master/docker-compose.yml" target="_blank" rel="noopener noreferrer">docker-compose.yml</a></li>
<li>The local repository is mounted within the services, meaning updating
the code on the host will be reflected in the docker images</li>
<li>Superset is served at localhost:9000/</li>
<li>You can login with admin/admin</li>
</ul>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>Installing and building Node modules for Apache Superset inside <code>superset-node</code> can take a
significant amount of time. This is normal due to the size of the dependencies. Please be
patient while the process completes, as long wait times do not indicate an issue with your setup.
If delays seem excessive, check your internet connection or system resources.</p></div></div>
<div class="theme-admonition theme-admonition-caution admonition_xJq3 alert alert--warning"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>caution</div><div class="admonitionContent_BuS1"><p>Since <code>docker compose</code> is primarily designed to run a set of containers on <strong>a single host</strong>
and can&#x27;t credibly support <strong>high availability</strong> as a result, we do not support nor recommend
using our <code>docker compose</code> constructs to support production-type use-cases. For single host
environments, we recommend using <a href="https://minikube.sigs.k8s.io/docs/start/" target="_blank" rel="noopener noreferrer">minikube</a> along
our <a href="https://superset.apache.org/docs/installation/running-on-kubernetes" target="_blank" rel="noopener noreferrer">installing on k8s</a>
documentation.
configured to be secure.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="supported-environment-variables">Supported environment variables<a href="#supported-environment-variables" class="hash-link" aria-label="Direct link to Supported environment variables" title="Direct link to Supported environment variables"></a></h3>
<p>Affecting the Docker build process:</p>
<ul>
<li><strong>SUPERSET_BUILD_TARGET (default=dev):</strong> which --target to build, either <code>lean</code> or <code>dev</code> are commonly used</li>
<li><strong>INCLUDE_FIREFOX (default=false):</strong> whether to include the Firefox headless browser in the build</li>
<li><strong>INCLUDE_CHROMIUM (default=false):</strong> whether to include the Chromium headless browser in the build</li>
<li><strong>BUILD_TRANSLATIONS(default=false):</strong> whether to compile the translations from the .po files available</li>
<li><strong>SUPERSET_LOAD_EXAMPLES (default=yes):</strong> whether to load the examples into the database upon startup,
save some precious time on startup by <code>SUPERSET_LOAD_EXAMPLES=no docker compose up</code></li>
<li><strong>SUPERSET_LOG_LEVEL (default=info)</strong>: Can be set to debug, info, warning, error, critical
for more verbose logging</li>
</ul>
<p>For more env vars that affect your configuration, see this
<a href="https://github.com/apache/superset/blob/master/docker/pythonpath_dev/superset_config.py" target="_blank" rel="noopener noreferrer">superset_config.py</a>
used in the <code>docker compose</code> context to assign env vars to the superset configuration.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="accessing-the-postgres-database">Accessing the postgres database<a href="#accessing-the-postgres-database" class="hash-link" aria-label="Direct link to Accessing the postgres database" title="Direct link to Accessing the postgres database"></a></h3>
<p>Sometimes it&#x27;s useful to access the database in the docker container directly.
You can enter a <code>psql</code> shell (the official Postgres client) by running the following command:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose exec db psql -U superset</span><br></span></code></pre></div></div>
<p>Also note that the database is exposed on port 5432, so you can connect to it using your favorite
Postgres client or even SQL Lab itselft directly in Superset by creating a new database connection
to <code>localhost:5432</code>.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="nuking-the-postgres-database">Nuking the postgres database<a href="#nuking-the-postgres-database" class="hash-link" aria-label="Direct link to Nuking the postgres database" title="Direct link to Nuking the postgres database"></a></h3>
<p>At times, it&#x27;s possible to end up with your development database in a bad state, it&#x27;s
common while switching branches that contain migrations for instance, where the database
version stamp that <code>alembic</code> manages is no longer available after switching branch.</p>
<p>In that case, the easy solution is to nuke the postgres db and start fresh. Note that the full
state of the database will be gone after doing this, so be cautious.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># first stop docker-compose if it&#x27;s running</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker-compose down</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># delete the volume containing the database</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker volume rm superset_db_home</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># restart docker-compose, which will init a fresh database and load examples</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker-compose up</span><br></span></code></pre></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="github-codespaces-cloud-development">GitHub Codespaces (Cloud Development)<a href="#github-codespaces-cloud-development" class="hash-link" aria-label="Direct link to GitHub Codespaces (Cloud Development)" title="Direct link to GitHub Codespaces (Cloud Development)"></a></h2>
<p>GitHub Codespaces provides a complete, pre-configured development environment in the cloud. This is ideal for:</p>
<ul>
<li>Quick contributions without local setup</li>
<li>Consistent development environments across team members</li>
<li>Working from devices that can&#x27;t run Docker locally</li>
<li>Safe experimentation in isolated environments</li>
</ul>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_BuS1"><p>We&#x27;re grateful to GitHub for providing this excellent cloud development service that makes
contributing to Apache Superset more accessible to developers worldwide.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="getting-started-with-codespaces">Getting Started with Codespaces<a href="#getting-started-with-codespaces" class="hash-link" aria-label="Direct link to Getting Started with Codespaces" title="Direct link to Getting Started with Codespaces"></a></h3>
<ol>
<li>
<p><strong>Create a Codespace</strong>: Use this pre-configured link that sets up everything you need:</p>
<p><a href="https://github.com/codespaces/new?skip_quickstart=true&amp;machine=standardLinux32gb&amp;repo=39464018&amp;ref=master&amp;devcontainer_path=.devcontainer%2Fdevcontainer.json&amp;geo=UsWest" target="_blank" rel="noopener noreferrer"><strong>Launch Superset Codespace →</strong></a></p>
<div class="theme-admonition theme-admonition-caution admonition_xJq3 alert alert--warning"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>caution</div><div class="admonitionContent_BuS1"><p><strong>Important</strong>: You must select at least the <strong>4 CPU / 16GB RAM</strong> machine type (pre-selected in the link above).
Smaller instances will not have sufficient resources to run Superset effectively.</p></div></div>
</li>
<li>
<p><strong>Wait for Setup</strong>: The initial setup takes several minutes. The Codespace will:</p>
<ul>
<li>Build the development container</li>
<li>Install all dependencies</li>
<li>Start all required services (PostgreSQL, Redis, etc.)</li>
<li>Initialize the database with example data</li>
</ul>
</li>
<li>
<p><strong>Access Superset</strong>: Once ready, check the <strong>PORTS</strong> tab in VS Code for port <code>9001</code>.
Click the globe icon to open Superset in your browser.</p>
<ul>
<li>Default credentials: <code>admin</code> / <code>admin</code></li>
</ul>
</li>
</ol>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="key-features">Key Features<a href="#key-features" class="hash-link" aria-label="Direct link to Key Features" title="Direct link to Key Features"></a></h3>
<ul>
<li><strong>Auto-reload</strong>: Both Python and TypeScript files auto-refresh on save</li>
<li><strong>Pre-installed Extensions</strong>: VS Code extensions for Python, TypeScript, and database tools</li>
<li><strong>Multiple Instances</strong>: Run multiple Codespaces for different branches/features</li>
<li><strong>SSH Access</strong>: Connect via terminal using <code>gh cs ssh</code> or through the GitHub web UI</li>
<li><strong>VS Code Integration</strong>: Works seamlessly with VS Code desktop app</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="managing-codespaces">Managing Codespaces<a href="#managing-codespaces" class="hash-link" aria-label="Direct link to Managing Codespaces" title="Direct link to Managing Codespaces"></a></h3>
<ul>
<li><strong>List active Codespaces</strong>: <code>gh cs list</code></li>
<li><strong>SSH into a Codespace</strong>: <code>gh cs ssh</code></li>
<li><strong>Stop a Codespace</strong>: Via GitHub UI or <code>gh cs stop</code></li>
<li><strong>Delete a Codespace</strong>: Via GitHub UI or <code>gh cs delete</code></li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="debugging-and-logs">Debugging and Logs<a href="#debugging-and-logs" class="hash-link" aria-label="Direct link to Debugging and Logs" title="Direct link to Debugging and Logs"></a></h3>
<p>Since Codespaces uses <code>docker-compose-light.yml</code>, you can monitor all services:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Stream logs from all services</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose -f docker-compose-light.yml logs -f</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Stream logs from a specific service</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose -f docker-compose-light.yml logs -f superset</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># View last 100 lines and follow</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose -f docker-compose-light.yml logs --tail=100 -f</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># List all running services</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose -f docker-compose-light.yml ps</span><br></span></code></pre></div></div>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_BuS1"><p>Codespaces automatically stop after 30 minutes of inactivity to save resources.
Your work is preserved and you can restart anytime.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="installing-development-tools">Installing Development Tools<a href="#installing-development-tools" class="hash-link" aria-label="Direct link to Installing Development Tools" title="Direct link to Installing Development Tools"></a></h2>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>While <code>docker compose</code> simplifies a lot of the setup, there are still
many things you&#x27;ll want to set up locally to power your IDE, and things like
<strong>commit hooks</strong>, <strong>linters</strong>, and <strong>test-runners</strong>. Note that you can do these
things inside docker images with commands like <code>docker compose exec superset_app bash</code> for
instance, but many people like to run that tooling from their host.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="python-environment">Python environment<a href="#python-environment" class="hash-link" aria-label="Direct link to Python environment" title="Direct link to Python environment"></a></h3>
<p>Assuming you already have a way to setup your python environments
like <code>pyenv</code>, <code>virtualenv</code> or something else, all you should have to
do is to install our dev, pinned python requirements bundle, after installing
the prerequisites mentioned in <a href="https://superset.apache.org/docs/installation/pypi/#os-dependencies" target="_blank" rel="noopener noreferrer">OS Dependencies</a></p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pip install -r requirements/development.txt</span><br></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="git-hooks">Git Hooks<a href="#git-hooks" class="hash-link" aria-label="Direct link to Git Hooks" title="Direct link to Git Hooks"></a></h3>
<p>Superset uses Git pre-commit hooks courtesy of <a href="https://pre-commit.com/" target="_blank" rel="noopener noreferrer">pre-commit</a>.
To install run the following:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit install</span><br></span></code></pre></div></div>
<p>This will install the hooks in your local repository. From now on, a series of checks will
automatically run whenever you make a Git commit.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="running-pre-commit-manually">Running Pre-commit Manually<a href="#running-pre-commit-manually" class="hash-link" aria-label="Direct link to Running Pre-commit Manually" title="Direct link to Running Pre-commit Manually"></a></h4>
<p>You can also run the pre-commit checks manually in various ways:</p>
<ul>
<li>
<p><strong>Run pre-commit on all files (same as CI):</strong></p>
<p>To run the pre-commit checks across all files in your repository, use the following command:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit run --all-files</span><br></span></code></pre></div></div>
<p>This is the same set of checks that will run during CI, ensuring your changes meet the project&#x27;s standards.</p>
</li>
<li>
<p><strong>Run pre-commit on a specific file:</strong></p>
<p>If you want to check or fix a specific file, you can do so by specifying the file path:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit run --files path/to/your/file.py</span><br></span></code></pre></div></div>
<p>This will only run the checks on the file(s) you specify.</p>
</li>
<li>
<p><strong>Run a specific pre-commit check:</strong></p>
<p>To run a specific check (hook) across all files or a particular file, use the following command:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit run &lt;hook_id&gt; --all-files</span><br></span></code></pre></div></div>
<p>Or for a specific file:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit run &lt;hook_id&gt; --files path/to/your/file.py</span><br></span></code></pre></div></div>
<p>Replace <code>&lt;hook_id&gt;</code> with the ID of the specific hook you want to run. You can find the list
of available hooks in the <code>.pre-commit-config.yaml</code> file.</p>
</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="working-with-llms">Working with LLMs<a href="#working-with-llms" class="hash-link" aria-label="Direct link to Working with LLMs" title="Direct link to Working with LLMs"></a></h2>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="environment-setup">Environment Setup<a href="#environment-setup" class="hash-link" aria-label="Direct link to Environment Setup" title="Direct link to Environment Setup"></a></h3>
<p>Ensure Docker Compose is running before starting LLM sessions:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose up</span><br></span></code></pre></div></div>
<p>Validate your environment:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">curl -f http://localhost:8088/health &amp;&amp; echo &quot;✅ Superset ready&quot;</span><br></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="llm-session-best-practices">LLM Session Best Practices<a href="#llm-session-best-practices" class="hash-link" aria-label="Direct link to LLM Session Best Practices" title="Direct link to LLM Session Best Practices"></a></h3>
<ul>
<li>Always validate environment setup first using the health checks above</li>
<li>Use focused validation commands: <code>pre-commit run</code> (not <code>--all-files</code>)</li>
<li><strong>Read <a href="https://github.com/apache/superset/blob/master/LLMS.md" target="_blank" rel="noopener noreferrer">LLMS.md</a> first</strong> - Contains comprehensive development guidelines, coding standards, and critical refactor information</li>
<li><strong>Check platform-specific files</strong> when available:<!-- -->
<ul>
<li><code>CLAUDE.md</code> - For Claude/Anthropic tools</li>
<li><code>CURSOR.md</code> - For Cursor editor</li>
<li><code>GEMINI.md</code> - For Google Gemini tools</li>
<li><code>GPT.md</code> - For OpenAI/ChatGPT tools</li>
</ul>
</li>
<li>Follow the TypeScript migration guidelines and avoid deprecated patterns listed in LLMS.md</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="key-development-commands">Key Development Commands<a href="#key-development-commands" class="hash-link" aria-label="Direct link to Key Development Commands" title="Direct link to Key Development Commands"></a></h3>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Frontend development</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset-frontend</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev # Development server on http://localhost:9000</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run test # Run all tests</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run test -- filename.test.tsx # Run single test file</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run lint # Linting and type checking</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Backend validation</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit run mypy # Type checking</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pytest # Run all tests</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pytest tests/unit_tests/specific_test.py # Run single test file</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pytest tests/unit_tests/ # Run all tests in directory</span><br></span></code></pre></div></div>
<p>For detailed development context, environment setup, and coding guidelines, see <a href="https://github.com/apache/superset/blob/master/LLMS.md" target="_blank" rel="noopener noreferrer">LLMS.md</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="alternatives-to-docker-compose">Alternatives to <code>docker compose</code><a href="#alternatives-to-docker-compose" class="hash-link" aria-label="Direct link to alternatives-to-docker-compose" title="Direct link to alternatives-to-docker-compose"></a></h2>
<div class="theme-admonition theme-admonition-caution admonition_xJq3 alert alert--warning"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>caution</div><div class="admonitionContent_BuS1"><p>This part of the documentation is a patchwork of information related to setting up
development environments without <code>docker compose</code> and is documented/supported to varying
degrees. It&#x27;s been difficult to maintain this wide array of methods and insure they&#x27;re
functioning across environments.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="flask-server">Flask server<a href="#flask-server" class="hash-link" aria-label="Direct link to Flask server" title="Direct link to Flask server"></a></h3>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="os-dependencies">OS Dependencies<a href="#os-dependencies" class="hash-link" aria-label="Direct link to OS Dependencies" title="Direct link to OS Dependencies"></a></h4>
<p>Make sure your machine meets the <a href="https://superset.apache.org/docs/installation/pypi#os-dependencies" target="_blank" rel="noopener noreferrer">OS dependencies</a> before following these steps.
You also need to install MySQL.</p>
<p>Ensure that you are using Python version 3.9, 3.10 or 3.11, then proceed with:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Create a virtual environment and activate it (recommended)</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">python3 -m venv venv # setup a python3 virtualenv</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">source venv/bin/activate</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Install external dependencies</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pip install -r requirements/development.txt</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Install Superset in editable (development) mode</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pip install -e .</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Initialize the database</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db upgrade</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Create an admin user in your metadata database (use `admin` as username to be able to load the examples)</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset fab create-admin</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Create default roles and permissions</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset init</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Load some data to play with.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Note: you MUST have previously created an admin user with the username `admin` for this command to work.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset load-examples</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Start the Flask dev web server from inside your virtualenv.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Note that your page may not have CSS at this point.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># See instructions below on how to build the front-end assets.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset run -p 8088 --with-threads --reload --debugger --debug</span><br></span></code></pre></div></div>
<p>Or you can install it via our Makefile</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Create a virtual environment and activate it (recommended)</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">$ python3 -m venv venv # setup a python3 virtualenv</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">$ source venv/bin/activate</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># install pip packages + pre-commit</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">$ make install</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Install superset pip packages and setup env only</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">$ make superset</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Setup pre-commit only</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">$ make pre-commit</span><br></span></code></pre></div></div>
<p><strong>Note: the FLASK_APP env var should not need to be set, as it&#x27;s currently controlled
via <code>.flaskenv</code>, however, if needed, it should be set to <code>superset.app:create_app()</code></strong></p>
<p>If you have made changes to the FAB-managed templates, which are not built the same way as the newer, React-powered front-end assets, you need to start the app without the <code>--with-threads</code> argument like so:
<code>superset run -p 8088 --reload --debugger --debug</code></p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="dependencies">Dependencies<a href="#dependencies" class="hash-link" aria-label="Direct link to Dependencies" title="Direct link to Dependencies"></a></h4>
<p>If you add a new requirement or update an existing requirement (per the <code>install_requires</code> section in <code>setup.py</code>) you must recompile (freeze) the Python dependencies to ensure that for CI, testing, etc. the build is deterministic. This can be achieved via,</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">python3 -m venv venv</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">source venv/bin/activate</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">python3 -m pip install -r requirements/development.txt</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">./scripts/uv-pip-compile.sh</span><br></span></code></pre></div></div>
<p>When upgrading the version number of a single package, you should run <code>./scripts/uv-pip-compile.sh</code> with the <code>-P</code> flag:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">./scripts/uv-pip-compile.sh -P some-package-to-upgrade</span><br></span></code></pre></div></div>
<p>To bring all dependencies up to date as per the restrictions defined in <code>setup.py</code> and <code>requirements/*.in</code>, run <code>./scripts/uv-pip-compile.sh --upgrade</code></p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">./scripts/uv-pip-compile.sh --upgrade</span><br></span></code></pre></div></div>
<p>This should be done periodically, but it is recommended to do thorough manual testing of the application to ensure no breaking changes have been introduced that aren&#x27;t caught by the unit and integration tests.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="logging-to-the-browser-console">Logging to the browser console<a href="#logging-to-the-browser-console" class="hash-link" aria-label="Direct link to Logging to the browser console" title="Direct link to Logging to the browser console"></a></h4>
<p>This feature is only available on Python 3. When debugging your application, you can have the server logs sent directly to the browser console using the <a href="https://github.com/betodealmeida/consolelog" target="_blank" rel="noopener noreferrer">ConsoleLog</a> package. You need to mutate the app, by adding the following to your <code>config.py</code> or <code>superset_config.py</code>:</p>
<div class="language-python codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-python codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token keyword" style="color:rgb(86, 156, 214)">from</span><span class="token plain"> console_log </span><span class="token keyword" style="color:rgb(86, 156, 214)">import</span><span class="token plain"> ConsoleLog</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token keyword" style="color:rgb(86, 156, 214)">def</span><span class="token plain"> </span><span class="token function" style="color:rgb(220, 220, 170)">FLASK_APP_MUTATOR</span><span class="token punctuation" style="color:rgb(212, 212, 212)">(</span><span class="token plain">app</span><span class="token punctuation" style="color:rgb(212, 212, 212)">)</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> app</span><span class="token punctuation" style="color:rgb(212, 212, 212)">.</span><span class="token plain">wsgi_app </span><span class="token operator" style="color:rgb(212, 212, 212)">=</span><span class="token plain"> ConsoleLog</span><span class="token punctuation" style="color:rgb(212, 212, 212)">(</span><span class="token plain">app</span><span class="token punctuation" style="color:rgb(212, 212, 212)">.</span><span class="token plain">wsgi_app</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> app</span><span class="token punctuation" style="color:rgb(212, 212, 212)">.</span><span class="token plain">logger</span><span class="token punctuation" style="color:rgb(212, 212, 212)">)</span><br></span></code></pre></div></div>
<p>Then make sure you run your WSGI server using the right worker type:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">gunicorn &quot;superset.app:create_app()&quot; -k &quot;geventwebsocket.gunicorn.workers.GeventWebSocketWorker&quot; -b 127.0.0.1:8088 --reload</span><br></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="frontend">Frontend<a href="#frontend" class="hash-link" aria-label="Direct link to Frontend" title="Direct link to Frontend"></a></h3>
<p>Frontend assets (TypeScript, JavaScript, CSS, and images) must be compiled in order to properly display the web UI. The <code>superset-frontend</code> directory contains all NPM-managed frontend assets. Note that for some legacy pages there are additional frontend assets bundled with Flask-Appbuilder (e.g. jQuery and bootstrap). These are not managed by NPM and may be phased out in the future.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="prerequisite">Prerequisite<a href="#prerequisite" class="hash-link" aria-label="Direct link to Prerequisite" title="Direct link to Prerequisite"></a></h4>
<h5 class="anchor anchorWithStickyNavbar_LWe7" id="nvm-and-node">nvm and node<a href="#nvm-and-node" class="hash-link" aria-label="Direct link to nvm and node" title="Direct link to nvm and node"></a></h5>
<p>First, be sure you are using the following versions of Node.js and npm:</p>
<ul>
<li><code>Node.js</code>: Version 20</li>
<li><code>npm</code>: Version 10</li>
</ul>
<p>We recommend using <a href="https://github.com/nvm-sh/nvm" target="_blank" rel="noopener noreferrer">nvm</a> to manage your node environment:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">in case it shows &#x27;-bash: nvm: command not found&#x27;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">export NVM_DIR=&quot;$HOME/.nvm&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">[ -s &quot;$NVM_DIR/nvm.sh&quot; ] &amp;&amp; \. &quot;$NVM_DIR/nvm.sh&quot; # This loads nvm</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">[ -s &quot;$NVM_DIR/bash_completion&quot; ] &amp;&amp; \. &quot;$NVM_DIR/bash_completion&quot; # This loads nvm bash_completion</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset-frontend</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">nvm install --lts</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">nvm use --lts</span><br></span></code></pre></div></div>
<p>Or if you use the default macOS starting with Catalina shell <code>zsh</code>, try:</p>
<div class="language-zsh codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-zsh codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">sh -c &quot;$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh)&quot;</span><br></span></code></pre></div></div>
<p>For those interested, you may also try out <a href="https://github.com/nvm-sh/nvm#deeper-shell-integration" target="_blank" rel="noopener noreferrer">avn</a> to automatically switch to the node version that is required to run Superset frontend.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="install-dependencies">Install dependencies<a href="#install-dependencies" class="hash-link" aria-label="Direct link to Install dependencies" title="Direct link to Install dependencies"></a></h4>
<p>Install third-party dependencies listed in <code>package.json</code> via:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># From the root of the repository</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset-frontend</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Install dependencies from `package-lock.json`</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm ci</span><br></span></code></pre></div></div>
<p>Note that Superset uses <a href="https://docs.scarf.sh" target="_blank" rel="noopener noreferrer">Scarf</a> to capture telemetry/analytics about versions being installed, including the <code>scarf-js</code> npm package and an analytics pixel. As noted elsewhere in this documentation, Scarf gathers aggregated stats for the sake of security/release strategy and does not capture/retain PII. <a href="https://docs.scarf.sh/package-analytics/" target="_blank" rel="noopener noreferrer">You can read here</a> about the <code>scarf-js</code> package, and various means to opt out of it, but you can opt out of the npm package <em>and</em> the pixel by setting the <code>SCARF_ANALYTICS</code> environment variable to <code>false</code> or opt out of the pixel by adding this setting in <code>superset-frontent/package.json</code>:</p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token comment" style="color:rgb(106, 153, 85)">// your-package/package.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token comment" style="color:rgb(106, 153, 85)">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;scarfSettings&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;enabled&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token boolean">false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token comment" style="color:rgb(106, 153, 85)">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="build-assets">Build assets<a href="#build-assets" class="hash-link" aria-label="Direct link to Build assets" title="Direct link to Build assets"></a></h4>
<p>There are three types of assets you can build:</p>
<ol>
<li><code>npm run build</code>: the production assets, CSS/JSS minified and optimized</li>
<li><code>npm run dev-server</code>: local development assets, with sourcemaps and hot refresh support</li>
<li><code>npm run build-instrumented</code>: instrumented application code for collecting code coverage from Cypress tests</li>
</ol>
<p>If while using the above commands you encounter an error related to the limit of file watchers:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">Error: ENOSPC: System limit for number of file watchers reached</span><br></span></code></pre></div></div>
<p>The error is thrown because the number of files monitored by the system has reached the limit.
You can address this error by increasing the number of inotify watchers.</p>
<p>The current value of max watches can be checked with:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">cat /proc/sys/fs/inotify/max_user_watches</span><br></span></code></pre></div></div>
<p>Edit the file <code>/etc/sysctl.conf</code> to increase this value.
The value needs to be decided based on the system memory <a href="https://stackoverflow.com/questions/535768/what-is-a-reasonable-amount-of-inotify-watches-with-linux" target="_blank" rel="noopener noreferrer">(see this StackOverflow answer for more context)</a>.</p>
<p>Open the file in an editor and add a line at the bottom specifying the max watches values.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">fs.inotify.max_user_watches=524288</span><br></span></code></pre></div></div>
<p>Save the file and exit the editor.
To confirm that the change succeeded, run the following command to load the updated value of max_user_watches from <code>sysctl.conf</code>:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">sudo sysctl -p</span><br></span></code></pre></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="webpack-dev-server">Webpack dev server<a href="#webpack-dev-server" class="hash-link" aria-label="Direct link to Webpack dev server" title="Direct link to Webpack dev server"></a></h4>
<p>The dev server by default starts at <code>http://localhost:9000</code> and proxies the backend requests to <code>http://localhost:8088</code>.</p>
<p>So a typical development workflow is the following:</p>
<ol>
<li>
<p><a href="#flask-server">run Superset locally</a> using Flask, on port <code>8088</code> — but don&#x27;t access it directly,<br></p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Install Superset and dependencies, plus load your virtual environment first, as detailed above.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset run -p 8088 --with-threads --reload --debugger --debug</span><br></span></code></pre></div></div>
</li>
<li>
<p>in parallel, run the Webpack dev server locally on port <code>9000</code>,<br></p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev-server</span><br></span></code></pre></div></div>
</li>
<li>
<p>access <code>http://localhost:9000</code> (the Webpack server, <em>not</em> Flask) in your web browser. This will use the hot-reloading front-end assets from the Webpack development server while redirecting back-end queries to Flask/Superset: your changes on Superset codebase — either front or back-end — will then be reflected live in the browser.</p>
</li>
</ol>
<p>It&#x27;s possible to change the Webpack server settings:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Start the dev server at http://localhost:9000</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev-server</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Run the dev server on a non-default port</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev-server -- --port=9001</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Proxy backend requests to a Flask server running on a non-default port</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev-server -- --env=--supersetPort=8081</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># Proxy to a remote backend but serve local assets</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run dev-server -- --env=--superset=https://superset-dev.example.com</span><br></span></code></pre></div></div>
<p>The <code>--superset=</code> option is useful in case you want to debug a production issue or have to setup Superset behind a firewall. It allows you to run Flask server in another environment while keep assets building locally for the best developer experience.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="other-npm-commands">Other npm commands<a href="#other-npm-commands" class="hash-link" aria-label="Direct link to Other npm commands" title="Direct link to Other npm commands"></a></h4>
<p>Alternatively, there are other NPM commands you may find useful:</p>
<ol>
<li><code>npm run build-dev</code>: build assets in development mode.</li>
<li><code>npm run dev</code>: built dev assets in watch mode, will automatically rebuild when a file changes</li>
</ol>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="docker-docker-compose">Docker (docker compose)<a href="#docker-docker-compose" class="hash-link" aria-label="Direct link to Docker (docker compose)" title="Direct link to Docker (docker compose)"></a></h4>
<p>See docs <a href="https://superset.apache.org/docs/installation/docker-compose" target="_blank" rel="noopener noreferrer">here</a></p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="updating-npm-packages">Updating NPM packages<a href="#updating-npm-packages" class="hash-link" aria-label="Direct link to Updating NPM packages" title="Direct link to Updating NPM packages"></a></h4>
<p>Use npm in the prescribed way, making sure that
<code>superset-frontend/package-lock.json</code> is updated according to <code>npm</code>-prescribed
best practices.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="feature-flags">Feature flags<a href="#feature-flags" class="hash-link" aria-label="Direct link to Feature flags" title="Direct link to Feature flags"></a></h4>
<p>Superset supports a server-wide feature flag system, which eases the incremental development of features. To add a new feature flag, simply modify <code>superset_config.py</code> with something like the following:</p>
<div class="language-python codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-python codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">FEATURE_FLAGS </span><span class="token operator" style="color:rgb(212, 212, 212)">=</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&#x27;SCOPED_FILTER&#x27;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token boolean">True</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<p>If you want to use the same flag in the client code, also add it to the FeatureFlag TypeScript enum in <a href="https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts" target="_blank" rel="noopener noreferrer">@superset-ui/core</a>. For example,</p>
<div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token keyword" style="color:rgb(86, 156, 214)">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(86, 156, 214)">enum</span><span class="token plain"> FeatureFlag </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token constant" style="color:rgb(100, 102, 149)">SCOPED_FILTER</span><span class="token plain"> </span><span class="token operator" style="color:rgb(212, 212, 212)">=</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;SCOPED_FILTER&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<p><code>superset/config.py</code> contains <code>DEFAULT_FEATURE_FLAGS</code> which will be overwritten by
those specified under FEATURE_FLAGS in <code>superset_config.py</code>. For example, <code>DEFAULT_FEATURE_FLAGS = { &#x27;FOO&#x27;: True, &#x27;BAR&#x27;: False }</code> in <code>superset/config.py</code> and <code>FEATURE_FLAGS = { &#x27;BAR&#x27;: True, &#x27;BAZ&#x27;: True }</code> in <code>superset_config.py</code> will result
in combined feature flags of <code>{ &#x27;FOO&#x27;: True, &#x27;BAR&#x27;: True, &#x27;BAZ&#x27;: True }</code>.</p>
<p>The current status of the usability of each flag (stable vs testing, etc) can be found in <code>RESOURCES/FEATURE_FLAGS.md</code>.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="git-hooks-1">Git Hooks<a href="#git-hooks-1" class="hash-link" aria-label="Direct link to Git Hooks" title="Direct link to Git Hooks"></a></h2>
<p>Superset uses Git pre-commit hooks courtesy of <a href="https://pre-commit.com/" target="_blank" rel="noopener noreferrer">pre-commit</a>. To install run the following:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pip3 install -r requirements/development.txt</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pre-commit install</span><br></span></code></pre></div></div>
<p>A series of checks will now run when you make a git commit.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="linting">Linting<a href="#linting" class="hash-link" aria-label="Direct link to Linting" title="Direct link to Linting"></a></h2>
<p>See <a href="/docs/contributing/howtos#linting">how tos</a></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="github-actions-and-act">GitHub Actions and <code>act</code><a href="#github-actions-and-act" class="hash-link" aria-label="Direct link to github-actions-and-act" title="Direct link to github-actions-and-act"></a></h2>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_BuS1"><p><code>act</code> compatibility of Superset&#x27;s GHAs is not fully tested. Running <code>act</code> locally may or may not
work for different actions, and may require fine tunning and local secret-handling.
For those more intricate GHAs that are tricky to run locally, we recommend iterating
directly on GHA&#x27;s infrastructure, by pushing directly on a branch and monitoring GHA logs.
For more targetted iteration, see the <code>gh workflow run --ref {BRANCH}</code> subcommand of the GitHub CLI.</p></div></div>
<p>For automation and CI/CD, Superset makes extensive use of GitHub Actions (GHA). You
can find all of the workflows and other assets under the <code>.github/</code> folder. This includes:</p>
<ul>
<li>running the backend unit test suites (<code>tests/</code>)</li>
<li>running the frontend test suites (<code>superset-frontend/src/**.*.test.*</code>)</li>
<li>running our Cypress end-to-end tests (<code>superset-frontend/cypress-base/</code>)</li>
<li>linting the codebase, including all Python, Typescript and Javascript, yaml and beyond</li>
<li>checking for all sorts of other rules conventions</li>
</ul>
<p>When you open a pull request (PR), the appropriate GitHub Actions (GHA) workflows will
automatically run depending on the changes in your branch. It&#x27;s perfectly reasonable
(and required!) to rely on this automation. However, the downside is that it&#x27;s mostly an
all-or-nothing approach and doesn&#x27;t provide much control to target specific tests or
iterate quickly.</p>
<p>At times, it may be more convenient to run GHA workflows locally. For that purpose
we use <a href="https://github.com/nektos/act" target="_blank" rel="noopener noreferrer">act</a>, a tool that allows you to run GitHub Actions (GHA)
workflows locally. It simulates the GitHub Actions environment, enabling developers to
test and debug workflows on their local machines before pushing changes to the repository. More
on how to use it in the next section.</p>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>In both GHA and <code>act</code>, we can run a more complex matrix for our tests, executing against different
database engines (PostgreSQL, MySQL, SQLite) and different versions of Python.
This enables us to ensure compatibility and stability across various environments.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="using-act">Using <code>act</code><a href="#using-act" class="hash-link" aria-label="Direct link to using-act" title="Direct link to using-act"></a></h3>
<p>First, install <code>act</code> -&gt; <a href="https://nektosact.com/" target="_blank" rel="noopener noreferrer">https://nektosact.com/</a></p>
<p>To list the workflows, simply:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">act --list</span><br></span></code></pre></div></div>
<p>To run a specific workflow:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">act pull_request --job {workflow_name} --secret GITHUB_TOKEN=$GITHUB_TOKEN --container-architecture linux/amd64</span><br></span></code></pre></div></div>
<p>In the example above, notice that:</p>
<ul>
<li>we target a specific workflow, using <code>--job</code></li>
<li>we pass a secret using <code>--secret</code>, as many jobs require read access (public) to the repo</li>
<li>we simulate a <code>pull_request</code> event by specifying it as the first arg,
similarly, we could simulate a <code>push</code> event or something else</li>
<li>we specify <code>--container-architecture</code>, which tends to emulate GHA more reliably</li>
</ul>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p><code>act</code> is a rich tool that offers all sorts of features, allowing you to simulate different
events (pull_request, push, ...), semantics around passing secrets where required and much
more. For more information, refer to <a href="https://nektosact.com/" target="_blank" rel="noopener noreferrer">act&#x27;s documentation</a></p></div></div>
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>Some jobs require secrets to interact with external systems and accounts that you may
not have in your possession. In those cases you may have to rely on remote CI or parameterize the
job further to target a different environment/sandbox or your own alongside the related
secrets.</p></div></div>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="testing">Testing<a href="#testing" class="hash-link" aria-label="Direct link to Testing" title="Direct link to Testing"></a></h2>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="python-testing">Python Testing<a href="#python-testing" class="hash-link" aria-label="Direct link to Python Testing" title="Direct link to Python Testing"></a></h3>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="unit-tests">Unit Tests<a href="#unit-tests" class="hash-link" aria-label="Direct link to Unit Tests" title="Direct link to Unit Tests"></a></h4>
<p>For unit tests located in <code>tests/unit_tests/</code>, it&#x27;s usually easy to simply run the script locally using:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pytest tests/unit_tests/*</span><br></span></code></pre></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="integration-tests">Integration Tests<a href="#integration-tests" class="hash-link" aria-label="Direct link to Integration Tests" title="Direct link to Integration Tests"></a></h4>
<p>For more complex pytest-defined integration tests (not to be confused with our end-to-end Cypress tests), many tests will require having a working test environment. Some tests require a database, Celery, and potentially other services or libraries installed.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="running-tests-with-act">Running Tests with <code>act</code><a href="#running-tests-with-act" class="hash-link" aria-label="Direct link to running-tests-with-act" title="Direct link to running-tests-with-act"></a></h3>
<p>To run integration tests locally using <code>act</code>, ensure you have followed the setup instructions from the <a href="#github-actions-and-act">GitHub Actions and <code>act</code></a> section. You can run specific workflows or jobs that include integration tests. For example:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">act --job test-python-38 --secret GITHUB_TOKEN=$GITHUB_TOKEN --event pull_request --container-architecture linux/amd64</span><br></span></code></pre></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="running-locally-using-a-test-script">Running locally using a test script<a href="#running-locally-using-a-test-script" class="hash-link" aria-label="Direct link to Running locally using a test script" title="Direct link to Running locally using a test script"></a></h4>
<p>There is also a utility script included in the Superset codebase to run Python integration tests. The <a href="https://github.com/apache/superset/tree/master/scripts/tests" target="_blank" rel="noopener noreferrer">readme can be found here</a>.</p>
<p>To run all integration tests, for example, run this script from the root directory:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">scripts/tests/run.sh</span><br></span></code></pre></div></div>
<p>You can run unit tests found in <code>./tests/unit_tests</code> with pytest. It is a simple way to run an isolated test that doesn&#x27;t need any database setup:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">pytest ./link_to_test.py</span><br></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="frontend-testing">Frontend Testing<a href="#frontend-testing" class="hash-link" aria-label="Direct link to Frontend Testing" title="Direct link to Frontend Testing"></a></h3>
<p>We use <a href="https://jestjs.io/" target="_blank" rel="noopener noreferrer">Jest</a> and <a href="https://airbnb.io/enzyme/" target="_blank" rel="noopener noreferrer">Enzyme</a> to test TypeScript/JavaScript. Tests can be run with:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset-frontend</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run test</span><br></span></code></pre></div></div>
<p>To run a single test file:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run test -- path/to/file.js</span><br></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="debugging-server-app">Debugging Server App<a href="#debugging-server-app" class="hash-link" aria-label="Direct link to Debugging Server App" title="Direct link to Debugging Server App"></a></h3>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="local">Local<a href="#local" class="hash-link" aria-label="Direct link to Local" title="Direct link to Local"></a></h4>
<p>For debugging locally using VSCode, you can configure a launch configuration file .vscode/launch.json such as</p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;version&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;0.2.0&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;configurations&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;Python: Flask&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;python&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;request&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;launch&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;module&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;flask&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;env&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;FLASK_APP&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;superset&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;SUPERSET_ENV&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;development&quot;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;args&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token string" style="color:rgb(206, 145, 120)">&quot;run&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;-p 8088&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;--with-threads&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;--reload&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;--debugger&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;jinja&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token boolean">true</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;justMyCode&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token boolean">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="raw-docker-without-docker-compose">Raw Docker (without <code>docker compose</code>)<a href="#raw-docker-without-docker-compose" class="hash-link" aria-label="Direct link to raw-docker-without-docker-compose" title="Direct link to raw-docker-without-docker-compose"></a></h4>
<p>Follow these instructions to debug the Flask app running inside a docker container. Note that
this will run a barebones Superset web server,</p>
<p>First, add the following to the ./docker-compose.yaml file</p>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset:</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> env_file: docker/.env</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> image: *superset-image</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> container_name: superset_app</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> command: [&quot;/app/docker/docker-bootstrap.sh&quot;, &quot;app&quot;]</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> restart: unless-stopped</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+ cap_add:</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+ - SYS_PTRACE</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> ports:</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> - 8088:8088</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+ - 5678:5678</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> user: &quot;root&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> depends_on: *superset-depends-on</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> volumes: *superset-volumes</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> environment:</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> CYPRESS_CONFIG: &quot;${CYPRESS_CONFIG}&quot;</span><br></span></code></pre></div></div>
<p>Start Superset as usual</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker compose up --build</span><br></span></code></pre></div></div>
<p>Install the required libraries and packages to the docker container</p>
<p>Enter the superset_app container</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">docker exec -it superset_app /bin/bash</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">root@39ce8cf9d6ab:/app#</span><br></span></code></pre></div></div>
<p>Run the following commands inside the container</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">apt update</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">apt install -y gdb</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">apt install -y net-tools</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">pip install debugpy</span><br></span></code></pre></div></div>
<p>Find the PID for the Flask process. Make sure to use the first PID. The Flask app will re-spawn a sub-process every time you change any of the python code. So it&#x27;s important to use the first PID.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">ps -ef</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">UID PID PPID C STIME TTY TIME CMD</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">root 1 0 0 14:09 ? 00:00:00 bash /app/docker/docker-bootstrap.sh app</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">root 6 1 4 14:09 ? 00:00:04 /usr/local/bin/python /usr/bin/flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">root 10 6 7 14:09 ? 00:00:07 /usr/local/bin/python /usr/bin/flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0</span><br></span></code></pre></div></div>
<p>Inject debugpy into the running Flask process. In this case PID 6.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">python3 -m debugpy --listen 0.0.0.0:5678 --pid 6</span><br></span></code></pre></div></div>
<p>Verify that debugpy is listening on port 5678</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">netstat -tunap</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">Active Internet connections (servers and established)</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">tcp 0 0 0.0.0.0:5678 0.0.0.0:* LISTEN 462/python</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 6/python</span><br></span></code></pre></div></div>
<p>You are now ready to attach a debugger to the process. Using VSCode you can configure a launch configuration file .vscode/launch.json like so.</p>
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;version&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;0.2.0&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;configurations&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;name&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;Attach to Superset App in Docker Container&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;type&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;python&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;request&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;attach&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;connect&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;host&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;127.0.0.1&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;port&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token number" style="color:rgb(181, 206, 168)">5678</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;pathMappings&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;localRoot&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;${workspaceFolder}&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token property">&quot;remoteRoot&quot;</span><span class="token operator" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&quot;/app&quot;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"></span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<p>VSCode will not stop on breakpoints right away. We&#x27;ve attached to PID 6 however it does not yet know of any sub-processes. In order to &quot;wake up&quot; the debugger you need to modify a python file. This will trigger Flask to reload the code and create a new sub-process. This new sub-process will be detected by VSCode and breakpoints will be activated.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="debugging-server-app-in-kubernetes-environment">Debugging Server App in Kubernetes Environment<a href="#debugging-server-app-in-kubernetes-environment" class="hash-link" aria-label="Direct link to Debugging Server App in Kubernetes Environment" title="Direct link to Debugging Server App in Kubernetes Environment"></a></h3>
<p>To debug Flask running in POD inside a kubernetes cluster, you&#x27;ll need to make sure the pod runs as root and is granted the SYS_TRACE capability.These settings should not be used in production environments.</p>
<div class="language-yaml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-yaml codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token key atrule">securityContext</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token key atrule">capabilities</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"> </span><span class="token key atrule">add</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token string" style="color:rgb(206, 145, 120)">&quot;SYS_PTRACE&quot;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><br></span></code></pre></div></div>
<p>See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-capabilities-for-a-container" target="_blank" rel="noopener noreferrer">set capabilities for a container</a> for more details.</p>
<p>Once the pod is running as root and has the SYS_PTRACE capability it will be able to debug the Flask app.</p>
<p>You can follow the same instructions as in <code>docker compose</code>. Enter the pod and install the required library and packages; gdb, netstat and debugpy.</p>
<p>Often in a Kubernetes environment nodes are not addressable from outside the cluster. VSCode will thus be unable to remotely connect to port 5678 on a Kubernetes node. In order to do this you need to create a tunnel that port forwards 5678 to your local machine.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">kubectl port-forward pod/superset-&lt;some random id&gt; 5678:5678</span><br></span></code></pre></div></div>
<p>You can now launch your VSCode debugger with the same config as above. VSCode will connect to 127.0.0.1:5678 which is forwarded by kubectl to your remote kubernetes POD.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="storybook">Storybook<a href="#storybook" class="hash-link" aria-label="Direct link to Storybook" title="Direct link to Storybook"></a></h3>
<p>Superset includes a <a href="https://storybook.js.org/" target="_blank" rel="noopener noreferrer">Storybook</a> to preview the layout/styling of various Superset components and variations thereof. To open and view the Storybook:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">cd superset-frontend</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">npm run storybook</span><br></span></code></pre></div></div>
<p>When contributing new React components to Superset, please try to add a Story alongside the component&#x27;s <code>jsx/tsx</code> file.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="tips">Tips<a href="#tips" class="hash-link" aria-label="Direct link to Tips" title="Direct link to Tips"></a></h2>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="adding-a-new-datasource">Adding a new datasource<a href="#adding-a-new-datasource" class="hash-link" aria-label="Direct link to Adding a new datasource" title="Direct link to Adding a new datasource"></a></h3>
<ol>
<li>
<p>Create Models and Views for the datasource, add them under superset folder, like a new my_models.py
with models for cluster, datasources, columns and metrics and my_views.py with clustermodelview
and datasourcemodelview.</p>
</li>
<li>
<p>Create DB migration files for the new models</p>
</li>
<li>
<p>Specify this variable to add the datasource model and from which module it is from in config.py:</p>
<p>For example:</p>
<div class="language-python codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-python codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">ADDITIONAL_MODULE_DS_MAP </span><span class="token operator" style="color:rgb(212, 212, 212)">=</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">{</span><span class="token string" style="color:rgb(206, 145, 120)">&#x27;superset.my_models&#x27;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(212, 212, 212)">[</span><span class="token string" style="color:rgb(206, 145, 120)">&#x27;MyDatasource&#x27;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(206, 145, 120)">&#x27;MyOtherDatasource&#x27;</span><span class="token punctuation" style="color:rgb(212, 212, 212)">]</span><span class="token punctuation" style="color:rgb(212, 212, 212)">}</span><br></span></code></pre></div></div>
<p>This means it&#x27;ll register MyDatasource and MyOtherDatasource in superset.my_models module in the source registry.</p>
</li>
</ol>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="visualization-plugins">Visualization Plugins<a href="#visualization-plugins" class="hash-link" aria-label="Direct link to Visualization Plugins" title="Direct link to Visualization Plugins"></a></h3>
<p>The topic of authoring new plugins, whether you&#x27;d like to contribute
it back or not has been well documented in the
<a href="https://superset.apache.org/docs/contributing/creating-viz-plugins" target="_blank" rel="noopener noreferrer">the documentation</a>, and in <a href="https://preset.io/blog/building-custom-viz-plugins-in-superset-v2" target="_blank" rel="noopener noreferrer">this blog post</a>.</p>
<p>To contribute a plugin to Superset, your plugin must meet the following criteria:</p>
<ul>
<li>The plugin should be applicable to the community at large, not a particularly specialized use case</li>
<li>The plugin should be written with TypeScript</li>
<li>The plugin should contain sufficient unit/e2e tests</li>
<li>The plugin should use appropriate namespacing, e.g. a folder name of <code>plugin-chart-whatever</code> and a package name of <code>@superset-ui/plugin-chart-whatever</code></li>
<li>The plugin should use theme variables via Emotion, as passed in by the ThemeProvider</li>
<li>The plugin should provide adequate error handling (no data returned, malformed data, invalid controls, etc.)</li>
<li>The plugin should contain documentation in the form of a populated <code>README.md</code> file</li>
<li>The plugin should have a meaningful and unique icon</li>
<li>Above all else, the plugin should come with a <em>commitment to maintenance</em> from the original author(s)</li>
</ul>
<p>Submissions will be considered for submission (or removal) on a case-by-case basis.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="adding-a-db-migration">Adding a DB migration<a href="#adding-a-db-migration" class="hash-link" aria-label="Direct link to Adding a DB migration" title="Direct link to Adding a DB migration"></a></h3>
<ol>
<li>
<p>Alter the model you want to change. This example will add a <code>Column</code> Annotations model.</p>
<p><a href="https://github.com/apache/superset/commit/6c25f549384d7c2fc288451222e50493a7b14104" target="_blank" rel="noopener noreferrer">Example commit</a></p>
</li>
<li>
<p>Generate the migration file</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db migrate -m &#x27;add_metadata_column_to_annotation_model&#x27;</span><br></span></code></pre></div></div>
<p>This will generate a file in <code>migrations/version/{SHA}_this_will_be_in_the_migration_filename.py</code>.</p>
<p><a href="https://github.com/apache/superset/commit/d3e83b0fd572c9d6c1297543d415a332858e262" target="_blank" rel="noopener noreferrer">Example commit</a></p>
</li>
<li>
<p>Upgrade the DB</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db upgrade</span><br></span></code></pre></div></div>
<p>The output should look like this:</p>
<div class="language-log codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-log codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Context impl SQLiteImpl.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Will assume transactional DDL.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -&gt; 40a0a483dd12, add_metadata_column_to_annotation_model.py</span><br></span></code></pre></div></div>
</li>
<li>
<p>Add column to view</p>
<p>Since there is a new column, we need to add it to the AppBuilder Model view.</p>
<p><a href="https://github.com/apache/superset/pull/5745/commits/6220966e2a0a0cf3e6d87925491f8920fe8a3458" target="_blank" rel="noopener noreferrer">Example commit</a></p>
</li>
<li>
<p>Test the migration&#x27;s <code>down</code> method</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db downgrade</span><br></span></code></pre></div></div>
<p>The output should look like this:</p>
<div class="language-log codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-log codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Context impl SQLiteImpl.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Will assume transactional DDL.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">INFO [alembic.runtime.migration] Running downgrade 40a0a483dd12 -&gt; 1a1d627ebd8e, add_metadata_column_to_annotation_model.py</span><br></span></code></pre></div></div>
</li>
</ol>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="merging-db-migrations">Merging DB migrations<a href="#merging-db-migrations" class="hash-link" aria-label="Direct link to Merging DB migrations" title="Direct link to Merging DB migrations"></a></h3>
<p>When two DB migrations collide, you&#x27;ll get an error message like this one:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">alembic.util.exc.CommandError: Multiple head revisions are present for</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">given argument &#x27;head&#x27;; please specify a specific target</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">revision, &#x27;&lt;branchname&gt;@head&#x27; to narrow to a specific head,</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">or &#x27;heads&#x27; for all heads`</span><br></span></code></pre></div></div>
<p>To fix it:</p>
<ol>
<li>
<p>Get the migration heads</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db heads</span><br></span></code></pre></div></div>
<p>This should list two or more migration hashes. E.g.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">1412ec1e5a7b (head)</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">67da9ef1ef9c (head)</span><br></span></code></pre></div></div>
</li>
<li>
<p>Pick one of them as the parent revision, open the script for the other revision
and update <code>Revises</code> and <code>down_revision</code> to the new parent revision. E.g.:</p>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">--- a/67da9ef1ef9c_add_hide_left_bar_to_tabstate.py</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+++ b/67da9ef1ef9c_add_hide_left_bar_to_tabstate.py</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">@@ -17,14 +17,14 @@</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">&quot;&quot;&quot;add hide_left_bar to tabstate</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">Revision ID: 67da9ef1ef9c</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">-Revises: c501b7c653a3</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+Revises: 1412ec1e5a7b</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">Create Date: 2021-02-22 11:22:10.156942</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">&quot;&quot;&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain"># revision identifiers, used by Alembic.</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">revision = &quot;67da9ef1ef9c&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">-down_revision = &quot;c501b7c653a3&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">+down_revision = &quot;1412ec1e5a7b&quot;</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">import sqlalchemy as sa</span><br></span><span class="token-line" style="color:#9CDCFE"><span class="token plain">from alembic import op</span><br></span></code></pre></div></div>
<p>Alternatively, you may also run <code>superset db merge</code> to create a migration script
just for merging the heads.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db merge {HASH1} {HASH2}</span><br></span></code></pre></div></div>
</li>
<li>
<p>Upgrade the DB to the new checkpoint</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#9CDCFE;--prism-background-color:#1E1E1E"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#9CDCFE;background-color:#1E1E1E"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#9CDCFE"><span class="token plain">superset db upgrade</span><br></span></code></pre></div></div>
</li>
</ol></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="row margin-top--sm theme-doc-footer-edit-meta-row"><div class="col"><a href="https://github.com/apache/superset/edit/master/docs/docs/contributing/development.mdx" target="_blank" rel="noopener noreferrer" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_JAkA"></div></div></footer></article><nav class="docusaurus-mt-lg pagination-nav" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/contributing/guidelines"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guidelines</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/contributing/howtos"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Development How-tos</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#fork-and-clone" class="table-of-contents__link toc-highlight">Fork and Clone</a></li><li><a href="#docker-compose-recommended" class="table-of-contents__link toc-highlight">docker compose (recommended!)</a><ul><li><a href="#supported-environment-variables" class="table-of-contents__link toc-highlight">Supported environment variables</a></li><li><a href="#accessing-the-postgres-database" class="table-of-contents__link toc-highlight">Accessing the postgres database</a></li><li><a href="#nuking-the-postgres-database" class="table-of-contents__link toc-highlight">Nuking the postgres database</a></li></ul></li><li><a href="#github-codespaces-cloud-development" class="table-of-contents__link toc-highlight">GitHub Codespaces (Cloud Development)</a><ul><li><a href="#getting-started-with-codespaces" class="table-of-contents__link toc-highlight">Getting Started with Codespaces</a></li><li><a href="#key-features" class="table-of-contents__link toc-highlight">Key Features</a></li><li><a href="#managing-codespaces" class="table-of-contents__link toc-highlight">Managing Codespaces</a></li><li><a href="#debugging-and-logs" class="table-of-contents__link toc-highlight">Debugging and Logs</a></li></ul></li><li><a href="#installing-development-tools" class="table-of-contents__link toc-highlight">Installing Development Tools</a><ul><li><a href="#python-environment" class="table-of-contents__link toc-highlight">Python environment</a></li><li><a href="#git-hooks" class="table-of-contents__link toc-highlight">Git Hooks</a></li></ul></li><li><a href="#working-with-llms" class="table-of-contents__link toc-highlight">Working with LLMs</a><ul><li><a href="#environment-setup" class="table-of-contents__link toc-highlight">Environment Setup</a></li><li><a href="#llm-session-best-practices" class="table-of-contents__link toc-highlight">LLM Session Best Practices</a></li><li><a href="#key-development-commands" class="table-of-contents__link toc-highlight">Key Development Commands</a></li></ul></li><li><a href="#alternatives-to-docker-compose" class="table-of-contents__link toc-highlight">Alternatives to <code>docker compose</code></a><ul><li><a href="#flask-server" class="table-of-contents__link toc-highlight">Flask server</a></li><li><a href="#frontend" class="table-of-contents__link toc-highlight">Frontend</a></li></ul></li><li><a href="#git-hooks-1" class="table-of-contents__link toc-highlight">Git Hooks</a></li><li><a href="#linting" class="table-of-contents__link toc-highlight">Linting</a></li><li><a href="#github-actions-and-act" class="table-of-contents__link toc-highlight">GitHub Actions and <code>act</code></a><ul><li><a href="#using-act" class="table-of-contents__link toc-highlight">Using <code>act</code></a></li></ul></li><li><a href="#testing" class="table-of-contents__link toc-highlight">Testing</a><ul><li><a href="#python-testing" class="table-of-contents__link toc-highlight">Python Testing</a></li><li><a href="#running-tests-with-act" class="table-of-contents__link toc-highlight">Running Tests with <code>act</code></a></li><li><a href="#frontend-testing" class="table-of-contents__link toc-highlight">Frontend Testing</a></li><li><a href="#debugging-server-app" class="table-of-contents__link toc-highlight">Debugging Server App</a></li><li><a href="#debugging-server-app-in-kubernetes-environment" class="table-of-contents__link toc-highlight">Debugging Server App in Kubernetes Environment</a></li><li><a href="#storybook" class="table-of-contents__link toc-highlight">Storybook</a></li></ul></li><li><a href="#tips" class="table-of-contents__link toc-highlight">Tips</a><ul><li><a href="#adding-a-new-datasource" class="table-of-contents__link toc-highlight">Adding a new datasource</a></li><li><a href="#visualization-plugins" class="table-of-contents__link toc-highlight">Visualization Plugins</a></li><li><a href="#adding-a-db-migration" class="table-of-contents__link toc-highlight">Adding a DB migration</a></li><li><a href="#merging-db-migrations" class="table-of-contents__link toc-highlight">Merging DB migrations</a></li></ul></li></ul></div></div></div></div></main></div></div></div><footer class="theme-layout-footer footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">
<div class="footer__applitools">
We use &nbsp;<a href="https://applitools.com/" target="_blank" rel="nofollow"><img src="/img/applitools.png" title="Applitools"></a>
</div>
<p>Copyright © 2024,
The <a href="https://www.apache.org/" target="_blank" rel="noreferrer">Apache Software Foundation</a>,
Licensed under the Apache <a href="https://apache.org/licenses/LICENSE-2.0" target="_blank" rel="noreferrer">License</a>.</p>
<p><small>Apache Superset, Apache, Superset, the Superset logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation. All other products or name brands are trademarks of their respective holders, including The Apache Software Foundation.
<a href="https://www.apache.org/" target="_blank">Apache Software Foundation</a> resources</small></p>
<img class="footer__divider" src="/img/community/line.png" alt="Divider">
<p>
<small>
<a href="/docs/security/" target="_blank" rel="noreferrer">Security</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noreferrer">Donate</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noreferrer">Thanks</a>&nbsp;|&nbsp;
<a href="https://apache.org/events/current-event" target="_blank" rel="noreferrer">Events</a>&nbsp;|&nbsp;
<a href="https://apache.org/licenses/" target="_blank" rel="noreferrer">License</a>&nbsp;|&nbsp;
<a href="https://privacy.apache.org/policies/privacy-policy-public.html" target="_blank" rel="noreferrer">Privacy</a>
</small>
</p>
<!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=39ae6855-95fc-4566-86e5-360d542b0a68">
</div></div></div></footer></div>
</body>
</html>