Skip to content

chore(extensions): clean up backend entrypoints and file globs#38360

Merged
villebro merged 4 commits intoapache:masterfrom
villebro:villebro/ext-automan
Mar 3, 2026
Merged

chore(extensions): clean up backend entrypoints and file globs#38360
villebro merged 4 commits intoapache:masterfrom
villebro:villebro/ext-automan

Conversation

@villebro
Copy link
Member

@villebro villebro commented Mar 3, 2026

SUMMARY

Simplifies extension development by establishing convention-over-configuration for backend entry points. Eliminates the need to configure entryPoints arrays by requiring standard file locations instead.

Before:

{
  "backend": {
    "entryPoints": ["my_extension.entrypoint"],
    "files": ["backend/src/**/*.py"]
  }
}

After:

  • no more backend section in extension.json
  • Single backend entry point (convention): backend/src/superset_extensions/{publisher}/{name}/entrypoint.py
  • Build config with include and exclude glob arrays (convention): backend/pyproject.toml

Breaking Changes

⚠️ Extensions must migrate to use conventional entry points:

  1. Remove backend section from extension.json
  2. Use a single entry point: backend/src/superset_extensions/{publisher}/{name}/entrypoint.py
  3. Add build config to backend/pyproject.toml:
    [tool.apache_superset_extensions.build]
    include = ["src/superset_extensions/{publisher}/{name}/**/*.py"]
    exclude = []

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions bot added the doc Namespace | Anything related to documentation label Mar 3, 2026
@villebro villebro self-assigned this Mar 3, 2026
@dosubot dosubot bot added change:backend Requires changing the backend doc:developer Developer documentation labels Mar 3, 2026
@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 825af7f
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a6a9352f2c9b0009a5f43c
😎 Deploy Preview https://deploy-preview-38360--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 66.12903% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.09%. Comparing base (1bd0546) to head (dabaa7f).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...-extensions-cli/src/superset_extensions_cli/cli.py 71.92% 16 Missing ⚠️
superset/initialization/__init__.py 0.00% 5 Missing ⚠️

❌ Your project status has failed because the head coverage (96.03%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #38360      +/-   ##
==========================================
+ Coverage   64.29%   65.09%   +0.79%     
==========================================
  Files        1811     2489     +678     
  Lines       71491   123865   +52374     
  Branches    22775    28647    +5872     
==========================================
+ Hits        45965    80625   +34660     
- Misses      25526    41843   +16317     
- Partials        0     1397    +1397     
Flag Coverage Δ
hive 41.11% <0.00%> (?)
mysql 64.05% <0.00%> (?)
postgres 64.13% <0.00%> (?)
presto 41.13% <0.00%> (?)
python 65.90% <0.00%> (?)
sqlite 63.72% <0.00%> (?)
superset-extensions-cli 89.94% <71.92%> (?)
unit 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


Extensions use standardized entry point locations:

- **Backend**: `backend/src/superset_extensions/{publisher}/{name}/entrypoint.py`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structure would be a bit weird when working on an extension, each extension would have backend/src/superset_extensions directory right? Having this superset_extensions directory inside an extension seems wrong to me. Is my understanding flawed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This convention is already part of the framework. Without this namespacing, an extension with the publisher pandas would be able to override functionality in the pandas dependency. This just ensures that all extensions are collision free, both among external libraries, but also other extensions.

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #2c389c

Actionable Suggestions - 4
  • superset-extensions-cli/tests/test_templates.py - 1
    • Parametrize decorator argument type error · Line 90-90
  • superset-extensions-cli/src/superset_extensions_cli/cli.py - 3
Review Details
  • Files reviewed - 8 · Commit Range: 825af7f..825af7f
    • superset-core/src/superset_core/extensions/types.py
    • superset-extensions-cli/src/superset_extensions_cli/cli.py
    • superset-extensions-cli/src/superset_extensions_cli/templates/backend/pyproject.toml.j2
    • superset-extensions-cli/src/superset_extensions_cli/templates/extension.json.j2
    • superset-extensions-cli/tests/test_cli_build.py
    • superset-extensions-cli/tests/test_cli_init.py
    • superset-extensions-cli/tests/test_cli_validate.py
    • superset-extensions-cli/tests/test_templates.py
  • Files skipped - 1
    • docs/developer_docs/extensions/development.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo


@pytest.mark.unit
@pytest.mark.parametrize(
"include_frontend,include_backend,expected_sections",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parametrize decorator argument type error

Line 90: pytest.mark.parametrize first argument should be a tuple of parameter names, not a string. Change "include_frontend,include_backend,expected_sections" to ("include_frontend", "include_backend", "expected_sections") or use a tuple.

Code suggestion
Check the AI-generated fix before applying
Suggested change
"include_frontend,include_backend,expected_sections",
("include_frontend", "include_backend", "expected_sections"),

Code Review Run #2c389c


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +225 to 228
"""Copy backend files based on pyproject.toml build configuration (validation already passed)."""
dist_dir = cwd / "dist"
extension = read_json(cwd / "extension.json")
if not extension:
click.secho("❌ No extension.json file found.", err=True, fg="red")
sys.exit(1)
backend_dir = cwd / "backend"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of assert statement detected

Line 227 uses assert which should be replaced with proper error handling. Use explicit validation with if statement and sys.exit() instead.

Code suggestion
Check the AI-generated fix before applying
Suggested change
"""Copy backend files based on pyproject.toml build configuration (validation already passed)."""
dist_dir = cwd / "dist"
extension = read_json(cwd / "extension.json")
if not extension:
click.secho("❌ No extension.json file found.", err=True, fg="red")
sys.exit(1)
backend_dir = cwd / "backend"
# Read build config from pyproject.toml
pyproject = read_toml(backend_dir / "pyproject.toml")
if not pyproject:
click.secho("❌ Failed to read backend pyproject.toml", err=True, fg="red")
sys.exit(1)
build_config = (

Code Review Run #2c389c


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous reply - we have a validation step that ensures all the requirements here are satisfied.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion replaces a bare assert pyproject with an explicit check that provides a clear error message and exits gracefully if pyproject.toml can't be read. This improves error handling in the copy_backend_files function, preventing unhandled AssertionErrors and ensuring consistent CLI behavior.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Mar 3, 2026

Code Review Agent Run #996f9d

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-extensions-cli/src/superset_extensions_cli/cli.py - 1
    • Missing Type Hints · Line 168-170
      The new variables `publisher_snake`, `name_snake`, and `entrypoint` lack explicit type annotations. Per the project's coding standards, all new code must include type hints for better consistency and static type checking support.
      Code suggestion
       @@ -167,5 +167,5 @@
      -        # Generate conventional entry point
      -        publisher_snake = kebab_to_snake_case(extension.publisher)
      -        name_snake = kebab_to_snake_case(extension.name)
      -        entrypoint = f"superset_extensions.{publisher_snake}.{name_snake}.entrypoint"
      -        backend = ManifestBackend(entrypoint=entrypoint)
      +        # Generate conventional entry point
      +        publisher_snake: str = kebab_to_snake_case(extension.publisher)
      +        name_snake: str = kebab_to_snake_case(extension.name)
      +        entrypoint: str = f"superset_extensions.{publisher_snake}.{name_snake}.entrypoint"
      +        backend = ManifestBackend(entrypoint=entrypoint)
  • superset/initialization/__init__.py - 1
    • Blind exception catch without specific handling · Line 593-593
      Line 593 catches a blind `Exception` without specific error handling. Consider catching specific exception types (e.g., `DatabaseError`, `ImportError`) or add logging to understand failure modes. The `noqa: S110` directive is also unused and should be removed.
      Code suggestion
       @@ -591,3 +591,3 @@
                        try:
                            eager_import(backend.entrypoint)
      -                except Exception as ex:  # pylint: disable=broad-except  # noqa: S110
      +                except (ImportError, AttributeError) as ex:
                            # Surface exceptions during initialization of extensions
      -                    print(ex)
Review Details
  • Files reviewed - 4 · Commit Range: 825af7f..0932030
    • superset-core/src/superset_core/extensions/types.py
    • superset-extensions-cli/src/superset_extensions_cli/cli.py
    • superset-extensions-cli/tests/test_cli_build.py
    • superset/initialization/__init__.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@michael-s-molina
Copy link
Member

@villebro Previously, we accepted multiple entry points and now it's a single one. Is this intended? I thought entry points would just be another contribution type like tools, APIs, etc and you would just need to annotate a file instead of a convention.

@villebro
Copy link
Member Author

villebro commented Mar 3, 2026

@villebro Previously, we accepted multiple entry points and now it's a single one. Is this intended? I thought entry points would just be another contribution type like tools, APIs, etc and you would just need to annotate a file instead of a convention.

@michael-s-molina Yes, this is intentional. The single entrypoint mirrors our frontend module federation pattern where index.tsx serves as the main entry point. So on the frontend we have a convention of index.tsx, while on the backend we have entrypoint.py.

Initially, I did consider adding entrypoints as a contribution type. However, thinking about it more closely, an entrypoint isn't really a contribution type like APIs or tools - it's infrastructure that simply registers contributions or triggers arbitrary code you wish to execute during bootstrap time. The frontend doesn't have "entrypoint contributions" either, and multiple entrypoints felt redundant since you can simply import multiple modules within a single entrypoint. If the need does come up for these types of "eager code execution containers" we can definitely consider it, but in that case we should probably consider it on both the frontend and backend.

TL;DR: the proposed design here harmonizes backend/frontend architecture while maintaining full flexibility through imports, and aims to minimize developer overhead.

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Mar 3, 2026
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the additional context @villebro!

@villebro villebro merged commit c35bf34 into apache:master Mar 3, 2026
73 of 75 checks passed
@github-project-automation github-project-automation bot moved this from To Do to Done in Superset Extensions Mar 3, 2026
@villebro villebro deleted the villebro/ext-automan branch March 3, 2026 17:45
@bito-code-review
Copy link
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend doc:developer Developer documentation doc Namespace | Anything related to documentation size/XL

Projects

Development

Successfully merging this pull request may close these issues.

3 participants