rusackas commented on code in PR #36298: URL: https://github.com/apache/superset/pull/36298#discussion_r2566414191
########## docs/developer_portal/extensions/development.md: ########## @@ -0,0 +1,245 @@ +--- +title: Development +sidebar_position: 5 +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +# Development + +This guide covers everything you need to know about developing extensions for Superset, from project structure to development workflow. + +## Project Structure + +The `apache-superset-extensions-cli` package provides a command-line interface (CLI) that streamlines the extension development workflow. It offers the following commands: + +``` +superset-extensions init: Generates the initial folder structure and scaffolds a new extension project. + +superset-extensions build: Builds extension assets. + +superset-extensions bundle: Packages the extension into a .supx file. + +superset-extensions dev: Automatically rebuilds the extension as files change. +``` + +When creating a new extension with `superset-extensions init <extension-name>`, the CLI generates a standardized folder structure: + +``` +dataset_references/ +├── extension.json +├── frontend/ +│ ├── src/ +│ ├── webpack.config.js +│ ├── tsconfig.json +│ └── package.json +├── backend/ +│ ├── src/ +│ └── dataset_references/ +│ ├── tests/ +│ ├── pyproject.toml +│ └── requirements.txt +├── dist/ +│ ├── manifest.json +│ ├── frontend +│ └── dist/ +│ ├── remoteEntry.d7a9225d042e4ccb6354.js +│ └── 900.038b20cdff6d49cfa8d9.js +│ └── backend +│ └── dataset_references/ +│ ├── __init__.py +│ ├── api.py +│ └── entrypoint.py +├── dataset_references-1.0.0.supx +└── README.md +``` + +The `extension.json` file serves as the declared metadata for the extension, containing the extension's name, version, author, description, and a list of capabilities. This file is essential for the host application to understand how to load and manage the extension. + +The `frontend` directory contains the source code for the frontend components of the extension, including React components, styles, and assets. The `webpack.config.js` file is used to configure Webpack for building the frontend code, while the `tsconfig.json` file defines the TypeScript configuration for the project. The `package.json` file specifies the dependencies and scripts for building and testing the frontend code. + +The `backend` directory contains the source code for the backend components of the extension, including Python modules, tests, and configuration files. The `pyproject.toml` file is used to define the Python package and its dependencies, while the r`equirements.txt` file lists the required Python packages for the extension. The `src` folder contains the functional backend source files, `tests` directory contains unit tests for the backend code, ensuring that the extension behaves as expected and meets the defined requirements. Review Comment: ```suggestion The `backend` directory contains the source code for the backend components of the extension, including Python modules, tests, and configuration files. The `pyproject.toml` file is used to define the Python package and its dependencies, while the `requirements.txt` file lists the required Python packages for the extension. The `src` folder contains the functional backend source files, `tests` directory contains unit tests for the backend code, ensuring that the extension behaves as expected and meets the defined requirements. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
