diff --git a/.changie.yaml b/.changie.yaml index c97869ac..62d2c982 100644 --- a/.changie.yaml +++ b/.changie.yaml @@ -43,12 +43,6 @@ post: - key: AuthorLink value: "https://github.com/{{.Custom.Author}}" replacements: - - path: pyproject.toml - find: 'version=".*"' - replace: 'version="{{.VersionNoPrefix}}"' - path: src/fabric_cli/__init__.py find: '__version__ = ".*"' replace: '__version__ = "{{.VersionNoPrefix}}"' - - path: src/fabric_cli/core/fab_constant.py - find: 'FAB_VERSION = ".*"' - replace: 'FAB_VERSION = "{{.VersionNoPrefix}}"' diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 61dc03f4..026a334d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -29,14 +29,14 @@ jobs: else TARGET_INFO="- **Target Commit:** Latest commit on current branch (HEAD)" fi - + cat >> $GITHUB_STEP_SUMMARY << EOF # 🚀 Create Release Workflow - + ## â„šī¸ Workflow Information - **Version:** ${{ github.event.inputs.version }} $TARGET_INFO - + EOF - name: Validate commit SHA (if provided) @@ -46,14 +46,14 @@ jobs: if ! git rev-parse --verify "$COMMIT_SHA^{commit}" >/dev/null 2>&1; then cat >> $GITHUB_STEP_SUMMARY << EOF ## ❌ Error: Invalid Commit SHA - + The provided commit SHA \`$COMMIT_SHA\` is not valid or does not exist in this repository. - + ### 📝 Troubleshooting - Verify the commit SHA exists in the repository - Ensure you are using the full commit SHA (or at least 7 characters) - Check that the commit is in the current branch history - + EOF echo "Error: Invalid commit SHA: $COMMIT_SHA" exit 1 @@ -92,23 +92,23 @@ jobs: if [ ! -f "$CHANGELOG_FILE" ]; then cat >> $GITHUB_STEP_SUMMARY << EOF ## ❌ Error: Release Notes File Not Found - + The release notes file was not found at the expected location: - + \`\`\` $CHANGELOG_FILE \`\`\` - + ### 📝 What to do: 1. Ensure you have created the changelog file for version \`${{ steps.set_vars.outputs.tag_name }}\` 2. The file should be located at: \`.changes/${{ steps.set_vars.outputs.tag_name }}.md\` 3. You can use \`changie batch \` to generate the changelog file - + ### 📂 Available changelog files: \`\`\` $(ls -1 .changes/*.md 2>/dev/null || echo "No changelog files found") \`\`\` - + EOF echo "Error: Release notes file not found at $CHANGELOG_FILE" exit 1 @@ -121,14 +121,14 @@ jobs: run: | cat >> $GITHUB_STEP_SUMMARY << EOF ## đŸ—ī¸ Creating Release - + Creating release with the following details: - **Tag:** \`${{ steps.set_vars.outputs.tag_name }}\` - **Target Commit:** \`${{ steps.set_vars.outputs.actual_sha }}\` - **Notes File:** \`${{ steps.set_vars.outputs.changelog_file_path }}\` - + EOF - + # Create the release with the target commit if gh release create ${{ steps.set_vars.outputs.tag_name }} \ --title "${{ steps.set_vars.outputs.tag_name }}" \ @@ -137,32 +137,32 @@ jobs: cat >> $GITHUB_STEP_SUMMARY << EOF ## ✅ Release Created Successfully! - + 🎉 **Release \`${{ steps.set_vars.outputs.tag_name }}\` has been created!** - + ### 📋 Release Details: - **Tag:** \`${{ steps.set_vars.outputs.tag_name }}\` - **Commit:** \`${{ steps.set_vars.outputs.actual_sha }}\` - **Release URL:** [View Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.set_vars.outputs.tag_name }}) - + EOF else cat >> $GITHUB_STEP_SUMMARY << EOF ## ❌ Error: Failed to Create Release - + The GitHub CLI failed to create the release. This could be due to: - + ### 🔍 Common Issues: - A release with tag \`${{ steps.set_vars.outputs.tag_name }}\` already exists - Insufficient permissions to create releases - Network connectivity issues - Invalid release notes format - + ### 📝 Next Steps: 1. Check if the tag already exists: \`git tag -l '${{ steps.set_vars.outputs.tag_name }}'\` 2. Verify you have the necessary permissions to create releases 3. Review the workflow run logs for detailed error messages - + EOF echo "Error: Failed to create release" exit 1 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b00e3d21..50ced841 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -20,7 +20,7 @@ jobs: with: python-version: "3.10" - name: Install Requirements - run: pip install mkdocs-material mkdocs-section-index + run: pip install -e .[docs] - name: Deploy run: | git config user.name "github-actions" diff --git a/.github/workflows/fab-build.yml b/.github/workflows/fab-build.yml index 9f2fbcbb..432d7706 100644 --- a/.github/workflows/fab-build.yml +++ b/.github/workflows/fab-build.yml @@ -127,13 +127,10 @@ jobs: with: python-version: "3.12" - - name: Create and activate Virtual Environment + - name: Install build dependencies run: | - python -m venv venv - source venv/bin/activate - pip install -r requirements.txt + python -m pip install --upgrade pip + pip install build - name: Build package - run: | - source venv/bin/activate - python -m build + run: python -m build diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 759ef37a..00000000 --- a/mypy.ini +++ /dev/null @@ -1,14 +0,0 @@ -[mypy-pytest.*] -ignore_missing_imports = True - -[mypy-msal.*] -ignore_missing_imports = True - -[mypy-msal_extensions] -ignore_missing_imports = True - -[mypy-fabric_cli.utils.fab_mem_store] -ignore_errors = True - -[mypy-pyspark.*] -ignore_missing_imports = True \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1994d431..f2c2f3c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,26 +1,20 @@ -[build-system] -requires = ["setuptools>=65.5.1"] -build-backend = "setuptools.build_meta" - [project] -name="ms-fabric-cli" -authors = [ - { name = "Microsoft Corporation" }, -] -version="1.3.1" -description="Command-line tool for Microsoft Fabric" -readme="README.md" -requires-python=">=3.10,<3.14" -license="MIT" +name = "ms-fabric-cli" +authors = [{ name = "Microsoft Corporation" }] +description = "Command-line tool for Microsoft Fabric" +readme = "README.md" +dynamic = ["version"] +license = "MIT" +requires-python = ">=3.10,<3.14" classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Development Status :: 5 - Production/Stable", "Operating System :: OS Independent", ] - dependencies = [ "msal[broker]>=1.34,<2 ; platform_system != 'Linux'", "msal>=1.34,<2", @@ -31,21 +25,61 @@ dependencies = [ "jmespath", "pyyaml==6.0.2", "argcomplete>=3.6.2", - "psutil==7.0.0" + "psutil==7.0.0", + "requests", + "cryptography", ] [project.scripts] fab = "fabric_cli.main:main" -[tool.setuptools.packages.find] -where = ["src"] +[project.urls] +Repository = "https://github.com/microsoft/fabric-cli.git" + +[dependency-groups] +dev = ["pytest>=8.2.1", "tox>=4.20.0", "build", "pytest-cov", "vcrpy"] +docs = ["mkdocs-material", "mkdocs-section-index"] + +[build-system] +requires = ["setuptools>=65.5.1"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages.find.where = ["src"] +dynamic.version = { attr = "fabric_cli.__init__.__version__" } +package-data = { "fabric_cli.core.fab_config" = [ + "command_support.yaml", +], "fabric_cli.commands.fs" = [ + "payloads/*", +] } + +[tool.mypy] + +# Module-specific overrides +[[tool.mypy.overrides]] +module = "pytest.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "msal.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "msal_extensions" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "fabric_cli.utils.fab_mem_store" +ignore_errors = true -[tool.setuptools.package-data] -"fabric_cli.core.fab_config" = ["command_support.yaml"] -"fabric_cli.commands.fs" = ["payloads/*"] -"*" = ["NOTICE.txt", "LICENSE"] +[[tool.mypy.overrides]] +module = "pyspark.*" +ignore_missing_imports = true -[project.optional-dependencies] -test = [ - "pytest>=8.2.1", +[tool.pytest.ini_options] +pythonpath = ["src"] +# Uncomment to enable live recording mode +# addopts = ["--record"] +markers = [ + "token_claims(arg): override the 'upn' or 'ctid' claim returned by get_token_claims", ] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index c25ecdaa..00000000 --- a/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -pythonpath = src -; uncomment the "addopts = --record" configuration will run tests in live mode and will create recoring files -; addopts = --record -markers = - token_claims(arg): override the "upn" or "ctid" claim returned by get_token_claims \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7ef5d5e4..00000000 --- a/requirements.txt +++ /dev/null @@ -1,20 +0,0 @@ -setuptools>=65.5.1 -pip>=9.0.1 -tox>=4.20.0 -build -prompt_toolkit -requests -cryptography -questionary -msal>=1.34,<2 -msal[broker]>=1.34,<2 ; platform_system != "Linux" -msal_extensions -PyYAML -jmespath -argcomplete>=3.6.2 -psutil==7.0.0 - -# Tests -pytest -pytest-cov -vcrpy \ No newline at end of file diff --git a/scripts/install_dev_container_dependencies.sh b/scripts/install_dev_container_dependencies.sh index 24e059d0..28779fbe 100644 --- a/scripts/install_dev_container_dependencies.sh +++ b/scripts/install_dev_container_dependencies.sh @@ -4,6 +4,6 @@ apt-get update && apt-get install -y \ pkg-config \ python3-dev \ -pip3 install --user -r requirements.txt +pip3 install --user -e .[dev] npm install -g changie \ No newline at end of file diff --git a/src/fabric_cli/core/fab_constant.py b/src/fabric_cli/core/fab_constant.py index d979b241..b61c1343 100644 --- a/src/fabric_cli/core/fab_constant.py +++ b/src/fabric_cli/core/fab_constant.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +from fabric_cli import __version__ from fabric_cli.utils.fab_hostname_validator import validate_and_get_env_variable # Initialize API endpoints with validation @@ -27,7 +28,7 @@ WEB_URI = "https://app.powerbi.com/groups" # Versioning -FAB_VERSION = "1.3.1" # change pyproject.toml version too, this must be aligned +FAB_VERSION = __version__ # Scopes SCOPE_FABRIC_DEFAULT = ["https://analysis.windows.net/powerbi/api/.default"] diff --git a/tox.toml b/tox.toml index 8475d8f4..16b8a87d 100644 --- a/tox.toml +++ b/tox.toml @@ -52,6 +52,7 @@ deps = [ "types-requests", "types-cachetools", "types-psutil", + "pytest-mypy-plugins", "vcrpy", ] commands = [