Skip to main content
Edit this page on GitHub

Guidelines

Pull Request Guidelines

A philosophy we would like to strongly encourage is

Before creating a PR, create an issue.

The purpose is to separate problem from possible solutions.

Bug fixes: If you’re only fixing a small bug, it’s fine to submit a pull request right away but we highly recommend to file an issue detailing what you’re fixing. This is helpful in case we don’t accept that specific fix but want to keep track of the issue. Please keep in mind that the project maintainers reserve the rights to accept or reject incoming PRs, so it is better to separate the issue and the code to fix it from each other. In some cases, project maintainers may request you to create a separate issue from PR before proceeding.

Refactor: For small refactors, it can be a standalone PR itself detailing what you are refactoring and why. If there are concerns, project maintainers may request you to create a #SIP for the PR before proceeding.

Feature/Large changes: If you intend to change the public API, or make any non-trivial changes to the implementation, we require you to file a new issue as #SIP (Superset Improvement Proposal). This lets us reach an agreement on your proposal before you put significant effort into it. You are welcome to submit a PR along with the SIP (sometimes necessary for demonstration), but we will not review/merge the code until the SIP is approved.

In general, small PRs are always easier to review than large PRs. The best practice is to break your work into smaller independent PRs and refer to the same issue. This will greatly reduce turnaround time.

If you wish to share your work which is not ready to merge yet, create a Draft PR. This will enable maintainers and the CI runner to prioritize mature PR's.

Finally, never submit a PR that will put master branch in broken state. If the PR is part of multiple PRs to complete a large feature and cannot work on its own, you can create a feature branch and merge all related PRs into the feature branch before creating a PR from feature branch to master.

Protocol

Authoring

  • Fill in all sections of the PR template.

  • Title the PR with one of the following semantic prefixes (inspired by Karma):

    • feat (new feature)
    • fix (bug fix)
    • docs (changes to the documentation)
    • style (formatting, missing semi colons, etc; no application logic change)
    • refactor (refactoring code)
    • test (adding missing tests, refactoring tests; no application logic change)
    • chore (updating tasks etc; no application logic change)
    • perf (performance-related change)
    • build (build tooling, Docker configuration change)
    • ci (test runner, GitHub Actions workflow changes)
    • other (changes that don't correspond to the above -- should be rare!)
    • Examples:
      • feat: export charts as ZIP files
      • perf(api): improve API info performance
      • fix(chart-api): cached-indicator always shows value is cached
  • Add prefix [WIP] to title if not ready for review (WIP = work-in-progress). We recommend creating a PR with [WIP] first and remove it once you have passed CI test and read through your code changes at least once.

  • If you believe your PR contributes a potentially breaking change, put a ! after the semantic prefix but before the colon in the PR title, like so: feat!: Added foo functionality to bar

  • Screenshots/GIFs: Changes to user interface require before/after screenshots, or GIF for interactions

    • Recommended capture tools (Kap, LICEcap, Skitch)
    • If no screenshot is provided, the committers will mark the PR with need:screenshot label and will not review until screenshot is provided.
  • Dependencies: Be careful about adding new dependency and avoid unnecessary dependencies.

    • For Python, include it in pyproject.toml denoting any specific restrictions and in requirements.txt pinned to a specific version which ensures that the application build is deterministic.
    • For TypeScript/JavaScript, include new libraries in package.json
  • Tests: The pull request should include tests, either as doctests, unit tests, or both. Make sure to resolve all errors and test failures. See Testing for how to run tests.

  • Documentation: If the pull request adds functionality, the docs should be updated as part of the same PR.

  • CI: Reviewers will not review the code until all CI tests are passed. Sometimes there can be flaky tests. You can close and open PR to re-run CI test. Please report if the issue persists. After the CI fix has been deployed to master, please rebase your PR.

  • Code coverage: Please ensure that code coverage does not decrease.

  • Remove [WIP] when ready for review. Please note that it may be merged soon after approved so please make sure the PR is ready to merge and do not expect more time for post-approval edits.

  • If the PR was not ready for review and inactive for > 30 days, we will close it due to inactivity. The author is welcome to re-open and update.

Reviewing

  • Use constructive tone when writing reviews.
  • If there are changes required, state clearly what needs to be done before the PR can be approved.
  • If you are asked to update your pull request with some changes there's no need to create a new one. Push your changes to the same branch.
  • The committers reserve the right to reject any PR and in some cases may request the author to file an issue.

Test Environments

  • Members of the Apache GitHub org can launch an ephemeral test environment directly on a pull request by creating a comment containing (only) the command /testenv up.
    • Note that org membership must be public in order for this validation to function properly.
  • Feature flags may be set for a test environment by specifying the flag name (prefixed with FEATURE_) and value after the command.
    • Format: /testenv up FEATURE_<feature flag name>=true|false
    • Example: /testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true
    • Multiple feature flags may be set in single command, separated by whitespace
  • A comment will be created by the workflow script with the address and login information for the ephemeral environment.
  • Test environments may be created once the Docker build CI workflow for the PR has completed successfully.
  • Test environments do not currently update automatically when new commits are added to a pull request.
  • Test environments do not currently support async workers, though this is planned.
  • Running test environments will be shutdown upon closing the pull request.

Merging

  • At least one approval is required for merging a PR.
  • PR is usually left open for at least 24 hours before merging.
  • After the PR is merged, close the corresponding issue(s).

Post-merge Responsibility

  • Project maintainers may contact the PR author if new issues are introduced by the PR.
  • Project maintainers may revert your changes if a critical issue is found, such as breaking master branch CI.

Managing Issues and PRs

To handle issues and PRs that are coming in, committers read issues/PRs and flag them with labels to categorize and help contributors spot where to take actions, as contributors usually have different expertises.

Triaging goals

  • For issues: Categorize, screen issues, flag required actions from authors.
  • For PRs: Categorize, flag required actions from authors. If PR is ready for review, flag required actions from reviewers.

First, add Category labels (a.k.a. hash labels). Every issue/PR must have one hash label (except spam entry). Labels that begin with # defines issue/PR type:

Labelfor Issuefor PR
#bugBug reportBug fix
#code-qualityDescribe problem with code, architecture or productivityRefactor, tests, tooling
#featureNew feature requestNew feature implementation
#refinePropose improvement such as adjusting padding or refining UI style, excluding new features, bug fixes, and refactoring.Implementation of improvement such as adjusting padding or refining UI style, excluding new features, bug fixes, and refactoring.
#docDocumentationDocumentation
#questionTroubleshooting: Installation, Running locally, Ask how to do something. Can be changed to #bug later.N/A
#SIPSuperset Improvement ProposalN/A
#ASFTasks related to Apache Software Foundation policyTasks related to Apache Software Foundation policy

Then add other types of labels as appropriate.

  • Descriptive labels (a.k.a. dot labels): These labels that begin with . describe the details of the issue/PR, such as .ui, .js, .install, .backend, etc. Each issue/PR can have zero or more dot labels.
  • Need labels: These labels have pattern need:xxx, which describe the work required to progress, such as need:rebase, need:update, need:screenshot.
  • Risk labels: These labels have pattern risk:xxx, which describe the potential risk on adopting the work, such as risk:db-migration. The intention was to better understand the impact and create awareness for PRs that need more rigorous testing.
  • Status labels: These labels describe the status (abandoned, wontfix, cant-reproduce, etc.) Issue/PRs that are rejected or closed without completion should have one or more status labels.
  • Version labels: These have the pattern vx.x such as v0.28. Version labels on issues describe the version the bug was reported on. Version labels on PR describe the first release that will include the PR.

Committers may also update title to reflect the issue/PR content if the author-provided title is not descriptive enough.

If the PR passes CI tests and does not have any need: labels, it is ready for review, add label review and/or design-review.

If an issue/PR has been inactive for >=30 days, it will be closed. If it does not have any status label, add inactive.

When creating a PR, if you're aiming to have it included in a specific release, please tag it with the version label. For example, to have a PR considered for inclusion in Superset 1.1 use the label v1.1.

Revert Guidelines

Reverting changes that are causing issues in the master branch is a normal and expected part of the development process. In an open source community, the ramifications of a change cannot always be fully understood. With that in mind, here are some considerations to keep in mind when considering a revert:

  • Availability of the PR author: If the original PR author or the engineer who merged the code is highly available and can provide a fix in a reasonable time frame, this would counter-indicate reverting.
  • Severity of the issue: How severe is the problem on master? Is it keeping the project from moving forward? Is there user impact? What percentage of users will experience a problem?
  • Size of the change being reverted: Reverting a single small PR is a much lower-risk proposition than reverting a massive, multi-PR change.
  • Age of the change being reverted: Reverting a recently-merged PR will be more acceptable than reverting an older PR. A bug discovered in an older PR is unlikely to be causing widespread serious issues.
  • Risk inherent in reverting: Will the reversion break critical functionality? Is the medicine more dangerous than the disease?
  • Difficulty of crafting a fix: In the case of issues with a clear solution, it may be preferable to implement and merge a fix rather than a revert.

Should you decide that reverting is desirable, it is the responsibility of the Contributor performing the revert to:

  • Contact the interested parties: The PR's author and the engineer who merged the work should both be contacted and informed of the revert.
  • Provide concise reproduction steps: Ensure that the issue can be clearly understood and duplicated by the original author of the PR.
  • Put the revert through code review: The revert must be approved by another committer.

Design Guidelines

Capitalization guidelines

Sentence case

Use sentence-case capitalization for everything in the UI (except these **).

Sentence case is predominantly lowercase. Capitalize only the initial character of the first word, and other words that require capitalization, like:

  • Proper nouns. Objects in the product are not considered proper nouns e.g. dashboards, charts, saved queries etc. Proprietary feature names eg. SQL Lab, Preset Manager are considered proper nouns
  • Acronyms (e.g. CSS, HTML)
  • When referring to UI labels that are themselves capitalized from sentence case (e.g. page titles - Dashboards page, Charts page, Saved queries page, etc.)
  • User input that is reflected in the UI. E.g. a user-named a dashboard tab

Sentence case vs. Title case: Title case: "A Dog Takes a Walk in Paris" Sentence case: "A dog takes a walk in Paris"

Why sentence case?

  • It’s generally accepted as the quickest to read
  • It’s the easiest form to distinguish between common and proper nouns

How to refer to UI elements

When writing about a UI element, use the same capitalization as used in the UI.

For example, if an input field is labeled “Name” then you refer to this as the “Name input field”. Similarly, if a button has the label “Save” in it, then it is correct to refer to the “Save button”.

Where a product page is titled “Settings”, you refer to this in writing as follows: “Edit your personal information on the Settings page”.

Often a product page will have the same title as the objects it contains. In this case, refer to the page as it appears in the UI, and the objects as common nouns:

  • Upload a dashboard on the Dashboards page
  • Go to Dashboards
  • View dashboard
  • View all dashboards
  • Upload CSS templates on the CSS templates page
  • Queries that you save will appear on the Saved queries page
  • Create custom queries in SQL Lab then create dashboards

**Exceptions to sentence case:

  • Input labels, buttons and UI tabs are all caps
  • User input values (e.g. column names, SQL Lab tab names) should be in their original case

Programming Language Conventions

Python

Parameters in the config.py (which are accessible via the Flask app.config dictionary) are assumed to always be defined and thus should be accessed directly via,

blueprints = app.config["BLUEPRINTS"]

rather than,

blueprints = app.config.get("BLUEPRINTS")

or similar as the later will cause typing issues. The former is of type List[Callable] whereas the later is of type Optional[List[Callable]].

Typing / Types Hints

To ensure clarity, consistency, all readability, all new functions should use type hints and include a docstring.

Note per PEP-484 no syntax for listing explicitly raised exceptions is proposed and thus the recommendation is to put this information in a docstring, i.e.,

import math
from typing import Union


def sqrt(x: Union[float, int]) -> Union[float, int]:
"""
Return the square root of x.

:param x: A number
:returns: The square root of the given number
:raises ValueError: If the number is negative
"""

return math.sqrt(x)

TypeScript

TypeScript is fully supported and is the recommended language for writing all new frontend components. When modifying existing functions/components, migrating to TypeScript is appreciated, but not required. Examples of migrating functions/components to TypeScript can be found in #9162 and #9180.