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 filing 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.
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!)feat: export charts as ZIP filesperf(api): improve API info performancefix(chart-api): cached-indicator always shows value is cachedAdd 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
Dependencies: Be careful about adding new dependency and avoid unnecessary dependencies.
pyproject.toml denoting any specific restrictions and in requirements.txt pinned to a specific version which ensures that the application build is deterministic.package.jsonTests: 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.
/testenv up.FEATURE_) and value after the command./testenv up FEATURE_<feature flag name>=true|false/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=trueYou can also access per-PR ephemeral environment directly using the following URL pattern: https://pr-{PR_NUMBER}.superset.apache.org
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
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:
| Label | for Issue | for PR |
|---|---|---|
#bug | Bug report | Bug fix |
#code-quality | Describe problem with code, architecture or productivity | Refactor, tests, tooling |
#feature | New feature request | New feature implementation |
#refine | Propose 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. |
#doc | Documentation | Documentation |
#question | Troubleshooting: Installation, Running locally, Ask how to do something. Can be changed to #bug later. | N/A |
#SIP | Superset Improvement Proposal | N/A |
#ASF | Tasks related to Apache Software Foundation policy | Tasks related to Apache Software Foundation policy |
Then add other types of labels as appropriate.
. 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:xxx, which describe the work required to progress, such as need:rebase, need:update, need:screenshot.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.abandoned, wontfix, cant-reproduce, etc.) Issue/PRs that are rejected or closed without completion should have one or more status labels.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 at least 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.
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:
Should you decide that reverting is desirable, it is the responsibility of the Contributor performing the revert to:
Revert liberally to keep master stable:
How to revert:
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:
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?
Good examples:
Bad examples:
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:
When writing about UI elements:
Only use title case for:
We use:
Python code should:
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]].
All new Python code should include type 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 List, Optional, Dict, Any, 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) def process_data( data: List[Dict[str, Any]], filter_empty: bool = True ) -> Optional[Dict[str, Any]]: """ Process a list of data dictionaries. Args: data: List of dictionaries containing data filter_empty: Whether to filter empty entries Returns: Processed data dictionary or None if no valid data """ if not data: return None # Process data... return processed_data
Use mypy to check types:
mypy superset
We use:
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.
TypeScript code should:
any types - use proper TypeScript typesExample:
interface User { id: number; name: string; email?: string; } export function processUser(user: User): string { // Avoid using 'any' const { name, email } = user; return email ? `${name} <${email}>` : name; }
Good: “Fix dashboard filter bug when dataset is deleted” Bad: “Fixed stuff”
If you have questions about these guidelines, ask in: