This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 5.0-extensions in repository https://gitbox.apache.org/repos/asf/superset.git
commit 383f5389f33f42d2d6d49561a8c779123ffc6f3f Author: Michael S. Molina <70410625+michael-s-mol...@users.noreply.github.com> AuthorDate: Thu Aug 28 14:40:09 2025 -0300 fix: Rename apache-superset-cli to apache-superset-extensions-cli (#34883) (cherry picked from commit bcf156c96940b8dfbeae2d2e33980e214ec4b69b) --- .github/CODEOWNERS | 2 +- .github/actions/change-detector/action.yml | 6 ++-- ...uperset-cli.yml => superset-extensions-cli.yml} | 22 ++++++------- .pre-commit-config.yaml | 6 ++-- Dockerfile | 2 +- pyproject.toml | 10 +++--- requirements/development.in | 2 +- requirements/development.txt | 24 +++++++-------- scripts/change_detector.py | 6 ++-- .../CHANGELOG.md | 0 .../LICENSE.txt | 0 .../README.md | 6 ++-- .../pyproject.toml | 12 ++++---- .../src/superset_extensions_cli}/__init__.py | 0 .../src/superset_extensions_cli}/cli.py | 4 +-- .../src/superset_extensions_cli}/constants.py | 0 .../templates/backend/pyproject.toml.j2 | 0 .../templates/extension.json.j2 | 0 .../templates/frontend/package.json.j2 | 0 .../src/superset_extensions_cli}/utils.py | 0 .../tests/README.md | 4 +-- .../tests/__init__.py | 0 .../tests/conftest.py | 0 .../tests/test_cli_build.py | 36 +++++++++++----------- .../tests/test_cli_bundle.py | 18 +++++------ .../tests/test_cli_dev.py | 36 +++++++++++----------- .../tests/test_cli_init.py | 2 +- .../tests/test_cli_validate.py | 6 ++-- .../tests/test_templates.py | 4 ++- .../tests/test_utils.py | 2 +- .../tests/utils.py | 0 31 files changed, 107 insertions(+), 103 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 299e9a46e2..c7a8ee4afb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,7 +34,7 @@ # Notify PMC members of changes to extension-related files /superset-core/ @michael-s-molina @villebro -/superset-cli/ @michael-s-molina @villebro +/superset-extensions-cli/ @michael-s-molina @villebro /superset/core/ @michael-s-molina @villebro /superset/extensions/ @michael-s-molina @villebro /superset-frontend/src/packages/superset-core/ @michael-s-molina @villebro diff --git a/.github/actions/change-detector/action.yml b/.github/actions/change-detector/action.yml index 8ff54ca614..da19bea6a4 100644 --- a/.github/actions/change-detector/action.yml +++ b/.github/actions/change-detector/action.yml @@ -17,9 +17,9 @@ outputs: docs: description: Whether docs-related files were changed value: ${{ steps.change-detector.outputs.docs }} - superset-cli: - description: Whether superset-cli package-related files were changed - value: ${{ steps.change-detector.outputs.superset-cli }} + superset-extensions-cli: + description: Whether superset-extensions-cli package-related files were changed + value: ${{ steps.change-detector.outputs.superset-extensions-cli }} runs: using: composite steps: diff --git a/.github/workflows/superset-cli.yml b/.github/workflows/superset-extensions-cli.yml similarity index 68% rename from .github/workflows/superset-cli.yml rename to .github/workflows/superset-extensions-cli.yml index b1833f1f15..7b79246765 100644 --- a/.github/workflows/superset-cli.yml +++ b/.github/workflows/superset-extensions-cli.yml @@ -1,4 +1,4 @@ -name: Superset CLI Package Tests +name: Superset Extensions CLI Package Tests on: push: @@ -14,14 +14,14 @@ concurrency: cancel-in-progress: true jobs: - test-superset-cli-package: + test-superset-extensions-cli-package: runs-on: ubuntu-24.04 strategy: matrix: python-version: ["previous", "current", "next"] defaults: run: - working-directory: superset-cli + working-directory: superset-extensions-cli steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" uses: actions/checkout@v4 @@ -36,29 +36,29 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Python - if: steps.check.outputs.superset-cli + if: steps.check.outputs.superset-extensions-cli uses: ./.github/actions/setup-backend/ with: python-version: ${{ matrix.python-version }} requirements-type: dev - name: Run pytest with coverage - if: steps.check.outputs.superset-cli + if: steps.check.outputs.superset-extensions-cli run: | - pytest --cov=superset_cli --cov-report=xml --cov-report=term-missing --cov-report=html -v --tb=short + pytest --cov=superset_extensions_cli --cov-report=xml --cov-report=term-missing --cov-report=html -v --tb=short - name: Upload coverage reports to Codecov - if: steps.check.outputs.superset-cli + if: steps.check.outputs.superset-extensions-cli uses: codecov/codecov-action@v3 with: file: ./coverage.xml - flags: superset-cli - name: superset-cli-coverage + flags: superset-extensions-cli + name: superset-extensions-cli-coverage fail_ci_if_error: false - name: Upload HTML coverage report - if: steps.check.outputs.superset-cli + if: steps.check.outputs.superset-extensions-cli uses: actions/upload-artifact@v4 with: - name: superset-cli-coverage-html + name: superset-extensions-cli-coverage-html path: htmlcov/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d0e8d6f76..0db099d56c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: - id: mypy name: mypy (main) args: [--check-untyped-defs] - exclude: ^superset-cli/ + exclude: ^superset-extensions-cli/ additional_dependencies: [ types-simplejson, types-python-dateutil, @@ -41,9 +41,9 @@ repos: types-Markdown, ] - id: mypy - name: mypy (superset-cli) + name: mypy (superset-extensions-cli) args: [--check-untyped-defs] - files: ^superset-cli/ + files: ^superset-extensions-cli/ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: diff --git a/Dockerfile b/Dockerfile index 91424188ea..90400fce43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -248,7 +248,7 @@ COPY requirements/*.txt requirements/ # Copy local packages needed for editable installs in development.txt COPY superset-core superset-core -COPY superset-cli superset-cli +COPY superset-extensions-cli superset-extensions-cli # Install Python dependencies using docker/pip-install.sh RUN --mount=type=cache,target=${SUPERSET_HOME}/.cache/uv \ diff --git a/pyproject.toml b/pyproject.toml index e51acc69e6..9acb0f5d2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,8 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "apache-superset-core>=0.0.1rc1, <0.2", + # no bounds for apache-superset-core until a stable version + "apache-superset-core", "backoff>=1.8.0", "celery>=5.3.6, <6.0.0", "click>=8.0.3", @@ -186,7 +187,8 @@ doris = ["pydoris>=1.0.0, <2.0.0"] oceanbase = ["oceanbase_py>=0.0.1"] ydb = ["ydb-sqlalchemy>=0.1.2"] development = [ - "apache-superset-cli>=0.0.1, <0.2", + # no bounds for apache-superset-extensions-cli until a stable version + "apache-superset-extensions-cli", "docker", "flask-testing", "freezegun", @@ -216,7 +218,7 @@ documentation = "https://superset.apache.org/docs/intro" combine_as_imports = true include_trailing_comma = true line_length = 88 -known_first_party = "superset, apache-superset-core, apache-superset-cli" +known_first_party = "superset, apache-superset-core, apache-superset-extensions-cli" known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyl [...] multi_line_output = 3 order_by_type = false @@ -398,4 +400,4 @@ pyxlsb = "1" # GPL [tool.uv.sources] apache-superset-core = { path = "./superset-core", editable = true } -apache-superset-cli = { path = "./superset-cli", editable = true } +apache-superset-extensions-cli = { path = "./superset-extensions-cli", editable = true } diff --git a/requirements/development.in b/requirements/development.in index 41257ec272..347cd545aa 100644 --- a/requirements/development.in +++ b/requirements/development.in @@ -17,4 +17,4 @@ # under the License. # -e .[development,bigquery,cors,druid,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails] --e ./superset-cli[test] +-e ./superset-extensions-cli[test] diff --git a/requirements/development.txt b/requirements/development.txt index 66dc6c234e..59311d5785 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -2,14 +2,14 @@ # uv pip compile requirements/development.in -c requirements/base-constraint.txt -o requirements/development.txt -e . # via -r requirements/development.in --e ./superset-cli +-e ./superset-core # via - # -r requirements/development.in # apache-superset --e ./superset-core + # apache-superset-extensions-cli +-e ./superset-extensions-cli # via + # -r requirements/development.in # apache-superset - # apache-superset-cli alembic==1.14.0 # via # -c requirements/base-constraint.txt @@ -103,7 +103,7 @@ click==8.1.7 # via # -c requirements/base-constraint.txt # apache-superset - # apache-superset-cli + # apache-superset-extensions-cli # celery # click-didyoumean # click-option-group @@ -386,7 +386,7 @@ itsdangerous==2.2.0 jinja2==3.1.4 # via # -c requirements/base-constraint.txt - # apache-superset-cli + # apache-superset-extensions-cli # flask # flask-babel jsonpath-ng==1.7.0 @@ -662,17 +662,17 @@ pysocks==1.7.1 pytest==7.4.4 # via # apache-superset - # apache-superset-cli + # apache-superset-extensions-cli # pytest-cov # pytest-mock pytest-cov==6.0.0 # via # apache-superset - # apache-superset-cli + # apache-superset-extensions-cli pytest-mock==3.10.0 # via # apache-superset - # apache-superset-cli + # apache-superset-extensions-cli python-dateutil==2.9.0.post0 # via # -c requirements/base-constraint.txt @@ -756,7 +756,7 @@ selenium==4.27.1 # -c requirements/base-constraint.txt # apache-superset semver==3.0.4 - # via apache-superset-cli + # via apache-superset-extensions-cli setuptools==75.6.0 # via # nodeenv @@ -836,7 +836,7 @@ tabulate==0.8.10 # apache-superset tomli==2.2.1 # via - # apache-superset-cli + # apache-superset-extensions-cli # coverage # pytest tqdm==4.67.1 @@ -897,7 +897,7 @@ watchdog==6.0.0 # via # -c requirements/base-constraint.txt # apache-superset - # apache-superset-cli + # apache-superset-extensions-cli wcwidth==0.2.13 # via # -c requirements/base-constraint.txt diff --git a/scripts/change_detector.py b/scripts/change_detector.py index 4565afe208..90f1979e17 100755 --- a/scripts/change_detector.py +++ b/scripts/change_detector.py @@ -45,9 +45,9 @@ PATTERNS = { "docs": [ r"^docs/", ], - "superset-cli": [ - r"^\.github/workflows/superset-cli\.yml", - r"^superset-cli/", + "superset-extensions-cli": [ + r"^\.github/workflows/superset-extensions-cli\.yml", + r"^superset-extensions-cli/", r"^superset-core/", ], } diff --git a/superset-cli/CHANGELOG.md b/superset-extensions-cli/CHANGELOG.md similarity index 100% rename from superset-cli/CHANGELOG.md rename to superset-extensions-cli/CHANGELOG.md diff --git a/superset-cli/LICENSE.txt b/superset-extensions-cli/LICENSE.txt similarity index 100% rename from superset-cli/LICENSE.txt rename to superset-extensions-cli/LICENSE.txt diff --git a/superset-cli/README.md b/superset-extensions-cli/README.md similarity index 95% rename from superset-cli/README.md rename to superset-extensions-cli/README.md index 637dce8680..642bce25f3 100644 --- a/superset-cli/README.md +++ b/superset-extensions-cli/README.md @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -# apache-superset-cli +# apache-superset-extensions-cli -[](https://badge.fury.io/py/apache-superset-cli) +[](https://badge.fury.io/py/apache-superset-extensions-cli) [](https://opensource.org/licenses/Apache-2.0) [](https://www.python.org/downloads/) @@ -35,7 +35,7 @@ Official command-line interface for building, bundling, and managing Apache Supe ## 📦 Installation ```bash -pip install apache-superset-cli +pip install apache-superset-extensions-cli ``` ## 🛠️ Quick Start diff --git a/superset-cli/pyproject.toml b/superset-extensions-cli/pyproject.toml similarity index 93% rename from superset-cli/pyproject.toml rename to superset-extensions-cli/pyproject.toml index 32b74ee356..5b94220361 100644 --- a/superset-cli/pyproject.toml +++ b/superset-extensions-cli/pyproject.toml @@ -16,7 +16,7 @@ # under the License. [project] -name = "apache-superset-cli" +name = "apache-superset-extensions-cli" version = "0.0.1rc1" description = "Official command-line interface for building, bundling, and managing Apache Superset extensions" readme = "README.md" @@ -70,11 +70,11 @@ requires = ["setuptools>=76.0.0", "wheel"] build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["superset_cli"] +packages = ["superset_extensions_cli"] package-dir = { "" = "src" } [project.scripts] -superset-extensions = "superset_cli.cli:app" +superset-extensions = "superset_extensions_cli.cli:app" [tool.pytest.ini_options] testpaths = ["tests"] @@ -85,7 +85,7 @@ addopts = [ "--strict-markers", "--strict-config", "--verbose", - "--cov=superset_cli", + "--cov=superset_extensions_cli", "--cov-report=term-missing", "--cov-report=html:htmlcov" ] @@ -97,7 +97,7 @@ markers = [ ] [tool.coverage.run] -source = ["src/superset_cli"] +source = ["src/superset_extensions_cli"] omit = ["*/tests/*", "*/test_*"] [tool.coverage.report] @@ -115,4 +115,4 @@ exclude_lines = [ ] [tool.ruff.lint.per-file-ignores] -"src/superset_cli/*" = ["TID251"] +"src/superset_extensions_cli/*" = ["TID251"] diff --git a/superset-cli/src/superset_cli/__init__.py b/superset-extensions-cli/src/superset_extensions_cli/__init__.py similarity index 100% rename from superset-cli/src/superset_cli/__init__.py rename to superset-extensions-cli/src/superset_extensions_cli/__init__.py diff --git a/superset-cli/src/superset_cli/cli.py b/superset-extensions-cli/src/superset_extensions_cli/cli.py similarity index 99% rename from superset-cli/src/superset_cli/cli.py rename to superset-extensions-cli/src/superset_extensions_cli/cli.py index 626002d877..06ca4508f1 100644 --- a/superset-cli/src/superset_cli/cli.py +++ b/superset-extensions-cli/src/superset_extensions_cli/cli.py @@ -32,8 +32,8 @@ from superset_core.extensions.types import Manifest, Metadata from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer -from superset_cli.constants import MIN_NPM_VERSION -from superset_cli.utils import read_json, read_toml +from superset_extensions_cli.constants import MIN_NPM_VERSION +from superset_extensions_cli.utils import read_json, read_toml REMOTE_ENTRY_REGEX = re.compile(r"^remoteEntry\..+\.js$") FRONTEND_DIST_REGEX = re.compile(r"/frontend/dist") diff --git a/superset-cli/src/superset_cli/constants.py b/superset-extensions-cli/src/superset_extensions_cli/constants.py similarity index 100% rename from superset-cli/src/superset_cli/constants.py rename to superset-extensions-cli/src/superset_extensions_cli/constants.py diff --git a/superset-cli/src/superset_cli/templates/backend/pyproject.toml.j2 b/superset-extensions-cli/src/superset_extensions_cli/templates/backend/pyproject.toml.j2 similarity index 100% rename from superset-cli/src/superset_cli/templates/backend/pyproject.toml.j2 rename to superset-extensions-cli/src/superset_extensions_cli/templates/backend/pyproject.toml.j2 diff --git a/superset-cli/src/superset_cli/templates/extension.json.j2 b/superset-extensions-cli/src/superset_extensions_cli/templates/extension.json.j2 similarity index 100% rename from superset-cli/src/superset_cli/templates/extension.json.j2 rename to superset-extensions-cli/src/superset_extensions_cli/templates/extension.json.j2 diff --git a/superset-cli/src/superset_cli/templates/frontend/package.json.j2 b/superset-extensions-cli/src/superset_extensions_cli/templates/frontend/package.json.j2 similarity index 100% rename from superset-cli/src/superset_cli/templates/frontend/package.json.j2 rename to superset-extensions-cli/src/superset_extensions_cli/templates/frontend/package.json.j2 diff --git a/superset-cli/src/superset_cli/utils.py b/superset-extensions-cli/src/superset_extensions_cli/utils.py similarity index 100% rename from superset-cli/src/superset_cli/utils.py rename to superset-extensions-cli/src/superset_extensions_cli/utils.py diff --git a/superset-cli/tests/README.md b/superset-extensions-cli/tests/README.md similarity index 96% rename from superset-cli/tests/README.md rename to superset-extensions-cli/tests/README.md index dbbe5544d8..735e0299f9 100644 --- a/superset-cli/tests/README.md +++ b/superset-extensions-cli/tests/README.md @@ -51,7 +51,7 @@ under the License. # Superset CLI Tests -This directory contains tests for the superset-cli package, focusing on the `init` command and other CLI functionality. +This directory contains tests for the superset-extensions-cli package, focusing on the `init` command and other CLI functionality. ## Test Structure @@ -164,7 +164,7 @@ pytest -m cli # CLI tests only ### With coverage ```bash -pytest --cov=superset_cli --cov-report=html +pytest --cov=superset_extensions_cli --cov-report=html ``` ### Specific test files diff --git a/superset-cli/tests/__init__.py b/superset-extensions-cli/tests/__init__.py similarity index 100% rename from superset-cli/tests/__init__.py rename to superset-extensions-cli/tests/__init__.py diff --git a/superset-cli/tests/conftest.py b/superset-extensions-cli/tests/conftest.py similarity index 100% rename from superset-cli/tests/conftest.py rename to superset-extensions-cli/tests/conftest.py diff --git a/superset-cli/tests/test_cli_build.py b/superset-extensions-cli/tests/test_cli_build.py similarity index 94% rename from superset-cli/tests/test_cli_build.py rename to superset-extensions-cli/tests/test_cli_build.py index 37a4d6821b..9f4e70f8b1 100644 --- a/superset-cli/tests/test_cli_build.py +++ b/superset-extensions-cli/tests/test_cli_build.py @@ -21,7 +21,7 @@ import json from unittest.mock import Mock, patch import pytest -from superset_cli.cli import ( +from superset_extensions_cli.cli import ( app, build_manifest, clean_dist, @@ -79,11 +79,11 @@ def extension_with_build_structure(): # Build Command Tests @pytest.mark.cli -@patch("superset_cli.cli.validate_npm") -@patch("superset_cli.cli.init_frontend_deps") -@patch("superset_cli.cli.rebuild_frontend") -@patch("superset_cli.cli.rebuild_backend") -@patch("superset_cli.cli.read_toml") +@patch("superset_extensions_cli.cli.validate_npm") +@patch("superset_extensions_cli.cli.init_frontend_deps") +@patch("superset_extensions_cli.cli.rebuild_frontend") +@patch("superset_extensions_cli.cli.rebuild_backend") +@patch("superset_extensions_cli.cli.read_toml") def test_build_command_success_flow( mock_read_toml, mock_rebuild_backend, @@ -115,9 +115,9 @@ def test_build_command_success_flow( @pytest.mark.cli -@patch("superset_cli.cli.validate_npm") -@patch("superset_cli.cli.init_frontend_deps") -@patch("superset_cli.cli.rebuild_frontend") +@patch("superset_extensions_cli.cli.validate_npm") +@patch("superset_extensions_cli.cli.init_frontend_deps") +@patch("superset_extensions_cli.cli.rebuild_frontend") def test_build_command_handles_frontend_build_failure( mock_rebuild_frontend, mock_init_frontend_deps, @@ -187,7 +187,7 @@ def test_init_frontend_deps_skips_when_node_modules_exists( @pytest.mark.unit @patch("subprocess.run") -@patch("superset_cli.cli.validate_npm") +@patch("superset_extensions_cli.cli.validate_npm") def test_init_frontend_deps_runs_npm_i_when_missing( mock_validate_npm, mock_run, isolated_filesystem ): @@ -207,7 +207,7 @@ def test_init_frontend_deps_runs_npm_i_when_missing( @pytest.mark.unit @patch("subprocess.run") -@patch("superset_cli.cli.validate_npm") +@patch("superset_extensions_cli.cli.validate_npm") def test_init_frontend_deps_exits_on_npm_ci_failure( mock_validate_npm, mock_run, isolated_filesystem ): @@ -303,7 +303,7 @@ def test_build_manifest_exits_when_extension_json_missing(isolated_filesystem): @pytest.mark.unit def test_clean_dist_frontend_removes_frontend_dist(isolated_filesystem): """Test clean_dist_frontend removes frontend/dist directory specifically.""" - from superset_cli.cli import clean_dist_frontend + from superset_extensions_cli.cli import clean_dist_frontend # Create dist/frontend structure dist_dir = isolated_filesystem / "dist" @@ -322,7 +322,7 @@ def test_clean_dist_frontend_removes_frontend_dist(isolated_filesystem): @pytest.mark.unit def test_clean_dist_frontend_handles_nonexistent_directory(isolated_filesystem): """Test clean_dist_frontend handles case where frontend dist doesn't exist.""" - from superset_cli.cli import clean_dist_frontend + from superset_extensions_cli.cli import clean_dist_frontend # No dist directory exists clean_dist_frontend(isolated_filesystem) @@ -333,7 +333,7 @@ def test_clean_dist_frontend_handles_nonexistent_directory(isolated_filesystem): @pytest.mark.unit def test_run_frontend_build_with_output_messages(isolated_filesystem): """Test run_frontend_build produces expected output messages.""" - from superset_cli.cli import run_frontend_build + from superset_extensions_cli.cli import run_frontend_build frontend_dir = isolated_filesystem / "frontend" frontend_dir.mkdir() @@ -362,7 +362,7 @@ def test_rebuild_frontend_handles_build_results( isolated_filesystem, return_code, expected_result ): """Test rebuild_frontend handles different build results.""" - from superset_cli.cli import rebuild_frontend + from superset_extensions_cli.cli import rebuild_frontend # Create frontend structure frontend_dir = isolated_filesystem / "frontend" @@ -378,7 +378,7 @@ def test_rebuild_frontend_handles_build_results( dist_dir = isolated_filesystem / "dist" dist_dir.mkdir() - with patch("superset_cli.cli.run_frontend_build") as mock_build: + with patch("superset_extensions_cli.cli.run_frontend_build") as mock_build: mock_build.return_value = Mock(returncode=return_code) result = rebuild_frontend(isolated_filesystem, frontend_dir) @@ -390,7 +390,7 @@ def test_rebuild_frontend_handles_build_results( @pytest.mark.unit def test_rebuild_backend_calls_copy_and_shows_message(isolated_filesystem): """Test rebuild_backend calls copy_backend_files and shows success message.""" - from superset_cli.cli import rebuild_backend + from superset_extensions_cli.cli import rebuild_backend # Create extension.json extension_json = { @@ -401,7 +401,7 @@ def test_rebuild_backend_calls_copy_and_shows_message(isolated_filesystem): } (isolated_filesystem / "extension.json").write_text(json.dumps(extension_json)) - with patch("superset_cli.cli.copy_backend_files") as mock_copy: + with patch("superset_extensions_cli.cli.copy_backend_files") as mock_copy: rebuild_backend(isolated_filesystem) mock_copy.assert_called_once_with(isolated_filesystem) diff --git a/superset-cli/tests/test_cli_bundle.py b/superset-extensions-cli/tests/test_cli_bundle.py similarity index 95% rename from superset-cli/tests/test_cli_bundle.py rename to superset-extensions-cli/tests/test_cli_bundle.py index 339356ecf5..eaa006c19b 100644 --- a/superset-cli/tests/test_cli_bundle.py +++ b/superset-extensions-cli/tests/test_cli_bundle.py @@ -22,14 +22,14 @@ import zipfile from unittest.mock import patch import pytest -from superset_cli.cli import app +from superset_extensions_cli.cli import app from tests.utils import assert_file_exists # Bundle Command Tests @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_creates_zip_with_default_name( mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling ): @@ -59,7 +59,7 @@ def test_bundle_command_creates_zip_with_default_name( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_with_custom_output_filename( mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling ): @@ -81,7 +81,7 @@ def test_bundle_command_with_custom_output_filename( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_with_output_directory( mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling ): @@ -106,7 +106,7 @@ def test_bundle_command_with_output_directory( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_fails_without_manifest( mock_build, cli_runner, isolated_filesystem ): @@ -124,7 +124,7 @@ def test_bundle_command_fails_without_manifest( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_handles_zip_creation_error( mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling ): @@ -145,7 +145,7 @@ def test_bundle_command_handles_zip_creation_error( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_includes_all_files_recursively( mock_build, cli_runner, isolated_filesystem ): @@ -214,7 +214,7 @@ def test_bundle_includes_all_files_recursively( @pytest.mark.cli -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_short_option( mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling ): @@ -233,7 +233,7 @@ def test_bundle_command_short_option( @pytest.mark.cli @pytest.mark.parametrize("output_option", ["--output", "-o"]) -@patch("superset_cli.cli.build") +@patch("superset_extensions_cli.cli.build") def test_bundle_command_output_options( mock_build, output_option, diff --git a/superset-cli/tests/test_cli_dev.py b/superset-extensions-cli/tests/test_cli_dev.py similarity index 86% rename from superset-cli/tests/test_cli_dev.py rename to superset-extensions-cli/tests/test_cli_dev.py index 2d65468a63..1c0d21cfeb 100644 --- a/superset-cli/tests/test_cli_dev.py +++ b/superset-extensions-cli/tests/test_cli_dev.py @@ -23,17 +23,17 @@ import time from unittest.mock import Mock, patch import pytest -from superset_cli.cli import app, FrontendChangeHandler +from superset_extensions_cli.cli import app, FrontendChangeHandler # Dev Command Tests @pytest.mark.cli -@patch("superset_cli.cli.Observer") -@patch("superset_cli.cli.init_frontend_deps") -@patch("superset_cli.cli.rebuild_frontend") -@patch("superset_cli.cli.rebuild_backend") -@patch("superset_cli.cli.build_manifest") -@patch("superset_cli.cli.write_manifest") +@patch("superset_extensions_cli.cli.Observer") +@patch("superset_extensions_cli.cli.init_frontend_deps") +@patch("superset_extensions_cli.cli.rebuild_frontend") +@patch("superset_extensions_cli.cli.rebuild_backend") +@patch("superset_extensions_cli.cli.build_manifest") +@patch("superset_extensions_cli.cli.write_manifest") def test_dev_command_starts_watchers( mock_write_manifest, mock_build_manifest, @@ -82,11 +82,11 @@ def test_dev_command_starts_watchers( @pytest.mark.cli -@patch("superset_cli.cli.init_frontend_deps") -@patch("superset_cli.cli.rebuild_frontend") -@patch("superset_cli.cli.rebuild_backend") -@patch("superset_cli.cli.build_manifest") -@patch("superset_cli.cli.write_manifest") +@patch("superset_extensions_cli.cli.init_frontend_deps") +@patch("superset_extensions_cli.cli.rebuild_frontend") +@patch("superset_extensions_cli.cli.rebuild_backend") +@patch("superset_extensions_cli.cli.build_manifest") +@patch("superset_extensions_cli.cli.write_manifest") def test_dev_command_initial_build( mock_write_manifest, mock_build_manifest, @@ -104,7 +104,7 @@ def test_dev_command_initial_build( extension_setup_for_dev(isolated_filesystem) - with patch("superset_cli.cli.Observer") as mock_observer_class: + with patch("superset_extensions_cli.cli.Observer") as mock_observer_class: mock_observer = Mock() mock_observer_class.return_value = mock_observer @@ -188,9 +188,9 @@ def test_frontend_watcher_function_coverage(isolated_filesystem): dist_dir = isolated_filesystem / "dist" dist_dir.mkdir() - with patch("superset_cli.cli.rebuild_frontend") as mock_rebuild: - with patch("superset_cli.cli.build_manifest") as mock_build: - with patch("superset_cli.cli.write_manifest") as mock_write: + with patch("superset_extensions_cli.cli.rebuild_frontend") as mock_rebuild: + with patch("superset_extensions_cli.cli.build_manifest") as mock_build: + with patch("superset_extensions_cli.cli.write_manifest") as mock_write: mock_rebuild.return_value = "remoteEntry.abc123.js" mock_build.return_value = {"name": "test", "version": "1.0.0"} @@ -224,8 +224,8 @@ def test_backend_watcher_function_coverage(isolated_filesystem): manifest_data = {"name": "test", "version": "1.0.0"} (dist_dir / "manifest.json").write_text(json.dumps(manifest_data)) - with patch("superset_cli.cli.rebuild_backend") as mock_rebuild: - with patch("superset_cli.cli.write_manifest") as mock_write: + with patch("superset_extensions_cli.cli.rebuild_backend") as mock_rebuild: + with patch("superset_extensions_cli.cli.write_manifest") as mock_write: # Simulate backend watcher function mock_rebuild(isolated_filesystem) diff --git a/superset-cli/tests/test_cli_init.py b/superset-extensions-cli/tests/test_cli_init.py similarity index 99% rename from superset-cli/tests/test_cli_init.py rename to superset-extensions-cli/tests/test_cli_init.py index 5a39250f9d..c01f4f2318 100644 --- a/superset-cli/tests/test_cli_init.py +++ b/superset-extensions-cli/tests/test_cli_init.py @@ -20,7 +20,7 @@ from __future__ import annotations from pathlib import Path import pytest -from superset_cli.cli import app +from superset_extensions_cli.cli import app from tests.utils import ( assert_directory_exists, diff --git a/superset-cli/tests/test_cli_validate.py b/superset-extensions-cli/tests/test_cli_validate.py similarity index 96% rename from superset-cli/tests/test_cli_validate.py rename to superset-extensions-cli/tests/test_cli_validate.py index b4ae5d3c69..d38e936f5a 100644 --- a/superset-cli/tests/test_cli_validate.py +++ b/superset-extensions-cli/tests/test_cli_validate.py @@ -20,14 +20,14 @@ from __future__ import annotations from unittest.mock import Mock, patch import pytest -from superset_cli.cli import app, validate_npm +from superset_extensions_cli.cli import app, validate_npm # Validate Command Tests @pytest.mark.cli def test_validate_command_success(cli_runner): """Test validate command succeeds when npm is available and valid.""" - with patch("superset_cli.cli.validate_npm") as mock_validate: + with patch("superset_extensions_cli.cli.validate_npm") as mock_validate: result = cli_runner.invoke(app, ["validate"]) assert result.exit_code == 0 @@ -38,7 +38,7 @@ def test_validate_command_success(cli_runner): @pytest.mark.cli def test_validate_command_calls_npm_validation(cli_runner): """Test that validate command calls the npm validation function.""" - with patch("superset_cli.cli.validate_npm") as mock_validate: + with patch("superset_extensions_cli.cli.validate_npm") as mock_validate: cli_runner.invoke(app, ["validate"]) mock_validate.assert_called_once() diff --git a/superset-cli/tests/test_templates.py b/superset-extensions-cli/tests/test_templates.py similarity index 99% rename from superset-cli/tests/test_templates.py rename to superset-extensions-cli/tests/test_templates.py index 4290329f9b..decc10bf7b 100644 --- a/superset-cli/tests/test_templates.py +++ b/superset-extensions-cli/tests/test_templates.py @@ -27,7 +27,9 @@ from jinja2 import Environment, FileSystemLoader @pytest.fixture def templates_dir(): """Get the templates directory path.""" - return Path(__file__).parent.parent / "src" / "superset_cli" / "templates" + return ( + Path(__file__).parent.parent / "src" / "superset_extensions_cli" / "templates" + ) @pytest.fixture diff --git a/superset-cli/tests/test_utils.py b/superset-extensions-cli/tests/test_utils.py similarity index 99% rename from superset-cli/tests/test_utils.py rename to superset-extensions-cli/tests/test_utils.py index 492ec35113..1df07c72a6 100644 --- a/superset-cli/tests/test_utils.py +++ b/superset-extensions-cli/tests/test_utils.py @@ -20,7 +20,7 @@ from __future__ import annotations import json import pytest -from superset_cli.utils import read_json, read_toml +from superset_extensions_cli.utils import read_json, read_toml # Read JSON Tests diff --git a/superset-cli/tests/utils.py b/superset-extensions-cli/tests/utils.py similarity index 100% rename from superset-cli/tests/utils.py rename to superset-extensions-cli/tests/utils.py