Browse Source

chore: Add build and release action for all packages

Joao Andre 1 năm trước cách đây
mục cha
commit
0287ac9c82

+ 156 - 0
.github/workflows/build-and-release-dev.yml

@@ -0,0 +1,156 @@
+name: Build a dev version for all packages and release them
+
+on:
+  pull_request_review:
+    types: [submitted]
+  push:
+    branches: [ develop, dev/*, release/*, feature/* ]
+
+jobs:
+  fetch-versions:
+    runs-on: ubuntu-latest
+    outputs:
+        config_VERSION: ${{ steps.version-setup.outputs.config_VERSION }}
+        core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
+        gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
+        rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
+        templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
+        VERSION: ${{ steps.version-setup.outputs.VERSION }}
+        NEW_VERSION: ${{ steps.version-setup.outputs.NEW_VERSION }}
+    steps:
+      - uses: actions/checkout@v4
+      - name: Setup Dev Version
+        id: version-setup
+        run: |
+          python tools/release/setup_version.py ALL dev >> $GITHUB_OUTPUT
+
+  build-and-release-taipy-dev-packages:
+    needs: [fetch-versions]
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        package: [config, core, gui, rest, templates]
+      max-parallel: 1
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ssh-key: ${{secrets.DEPLOY_KEY}}
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.9
+      - uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+
+      - name: Extract commit hash
+        shell: bash
+        run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
+        id: extract_hash
+
+      - name: Set Build Variables
+        id: set-variables
+        run: |
+          if [ "${{ matrix.package }}" == "config" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.config_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/config" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.config_VERSION}}-config" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-config-${{needs.fetch-versions.outputs.config_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "core" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "gui" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "rest" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "templates" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          fi
+        shell: bash
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install build wheel
+
+      - name: Build package
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: python setup.py build_py && python -m build
+
+      - name: Create tag and release
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: |
+          gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Install Package
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: |
+          pip install ${{ steps.set-variables.outputs.tar_path }}
+
+  build-and-release-taipy-dev:
+    runs-on: ubuntu-latest
+    needs: [ build-and-release-taipy-dev-packages, fetch-versions ]
+    timeout-minutes: 20
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ssh-key: ${{secrets.DEPLOY_KEY}}
+      - name: Set Build Variables
+        id: set-variables
+        run: |
+          echo "package_version=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
+          echo "release_name=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
+          echo "tar_path=./dist/${{ github.event.repository.name }}-${{needs.fetch-versions.outputs.VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+
+      - name: Build Taipy package
+        run: python setup.py build_py && python -m build
+
+      - name: Create tag and release Taipy
+        run: |
+          gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Install Taipy
+        run: |
+          pip install ${{ steps.set-variables.outputs.tar_path }}
+
+      - name: Check Taipy Installation
+        run: |
+          python tools/validate_taipy_install.py
+
+      - name: Download packages
+        run: |
+          gh release download ${{ needs.fetch-versions.outputs.config_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.core_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.gui_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.rest_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.templates_VERSION }} --dir dist
+
+      - name: Bundle all packages in main release tag
+        run: |
+          find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.VERSION }} --clobber
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Reset changes
+        run: |
+          git reset --hard HEAD
+          git clean -fdx
+
+      - uses: stefanzweifel/git-auto-commit-action@v4
+        with:
+          commit_message: Update version to ${{ needs.fetch-versions.outputs.NEW_VERSION }}

+ 156 - 0
.github/workflows/build-and-release-prod.yml

@@ -0,0 +1,156 @@
+name: Build a dev version for all packages and release them
+
+on:
+  workflow_dispatch:
+    inputs:
+      version:
+        description: "The release/package version to create (ex: 1.0.0)"
+        required: true
+jobs:
+  fetch-versions:
+    runs-on: ubuntu-latest
+    outputs:
+        config_VERSION: ${{ steps.version-setup.outputs.config_VERSION }}
+        core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
+        gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
+        rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
+        templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
+        VERSION: ${{ steps.version-setup.outputs.VERSION }}
+        NEW_VERSION: ${{ steps.version-setup.outputs.NEW_VERSION }}
+    steps:
+      - name: Extract branch name
+        shell: bash
+        run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
+        id: extract_branch
+
+      - name: Setup Dev Version
+        id: version-setup
+        run: |
+          python tools/release/setup_version.py ALL prod ${{ github.event.inputs.version }} ${{ steps.extract_branch.outputs.branch }} >> $GITHUB_OUTPUT
+
+  build-and-release-taipy-packages:
+    needs: [fetch-versions]
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        package: [config, core, gui, rest, templates]
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ssh-key: ${{secrets.DEPLOY_KEY}}
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.9
+      - uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+
+      - name: Extract commit hash
+        shell: bash
+        run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
+        id: extract_hash
+
+      - name: Set Build Variables
+        id: set-variables
+        run: |
+          if [ "${{ matrix.package }}" == "config" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.config_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/config" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.config_VERSION}}-config" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-config-${{needs.fetch-versions.outputs.config_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "core" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "gui" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "rest" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          elif [ "${{ matrix.package }}" == "templates" ]; then
+            echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT
+            echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT
+            echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT
+            echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+          fi
+        shell: bash
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install build wheel
+
+      - name: Build package
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: python setup.py build_py && python -m build
+
+      - name: Create tag and release
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: |
+          gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Install Package
+        working-directory: ${{ steps.set-variables.outputs.package_dir }}
+        run: |
+          pip install ${{ steps.set-variables.outputs.tar_path }}
+
+  build-and-release-taipy:
+    runs-on: ubuntu-latest
+    needs: [ build-and-release-taipy-dev-packages, fetch-versions ]
+    timeout-minutes: 20
+    steps:
+      - name: Set Build Variables
+        id: set-variables
+        run: |
+          echo "package_version=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
+          echo "release_name=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
+          echo "tar_path=./dist/${{ github.event.repository.name }}-${{needs.fetch-versions.outputs.VERSION}}.tar.gz" >> $GITHUB_OUTPUT
+
+      - name: Build Taipy package
+        run: python setup.py build_py && python -m build
+
+      - name: Create tag and release Taipy
+        run: |
+          gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Install Taipy
+        run: |
+          pip install ${{ steps.set-variables.outputs.tar_path }}
+
+      - name: Check Taipy Installation
+        run: |
+          python tools/validate_taipy_install.py
+
+      - name: Download packages
+        run: |
+          gh release download ${{ needs.fetch-versions.outputs.config_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.core_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.gui_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.rest_VERSION }} --dir dist
+          gh release download ${{ needs.fetch-versions.outputs.templates_VERSION }} --dir dist
+
+      - name: Bundle all packages in main release tag
+        run: |
+          find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.VERSION }} --clobber
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Reset changes
+        run: |
+          git reset --hard HEAD
+          git clean -fdx
+
+      - uses: stefanzweifel/git-auto-commit-action@v4
+        with:
+          commit_message: Update version to ${{ needs.fetch-versions.outputs.NEW_VERSION }}

+ 108 - 1
.github/workflows/overall-tests.yml

@@ -51,9 +51,116 @@ jobs:
           title: Taipy Overall Coverage Report
 
       - name: Notify user if failed
-        if: failure() && github.event_name == 'workflow_dispatch'
+        if: failure()
         run: |
           if [[ -n "${{ github.event.inputs.user-to-notify }}" ]]; then
             curl "${{ secrets.notify_endpoint }}" -d '{"username": "${{ github.event.inputs.user-to-notify }}", "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' -H "Content-Type: application/json"
           fi
         shell: bash
+
+  submit_tests:
+    needs: linter
+    timeout-minutes: 20
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: [ '3.8', '3.9', '3.10', '3.11' ]
+        os: [ ubuntu-latest, windows-latest, macos-latest ]
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: actions/setup-python@v5
+        with:
+          python-version: ${{matrix.python-version}}
+
+      - name: Install pipenv
+        run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
+
+      - name: Install Dependencies
+        run: pipenv install --dev --python=${{ matrix.python-version }}
+
+      - name: Setup LibMagic (MacOS)
+        if: matrix.os == 'macos-latest'
+        run: brew install libmagic
+
+      - name: Pytest Core orchestrator_dispatcher
+        run: pipenv run pytest -m "orchestrator_dispatcher" tests
+
+  standalone_tests:
+    needs: linter
+    timeout-minutes: 20
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: [ '3.8', '3.9', '3.10', '3.11' ]
+        os: [ ubuntu-latest, windows-latest, macos-latest ]
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: dorny/paths-filter@v2
+        id: changes
+        with:
+          filters: |
+            core:
+              - 'taipy/core/**'
+
+      - uses: actions/setup-python@v5
+        with:
+          python-version: ${{matrix.python-version}}
+
+      - name: Install pipenv
+        if: steps.changes.outputs.core == 'true'
+        run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
+
+      - name: Install Dependencies
+        if: steps.changes.outputs.core == 'true'
+        run: pipenv install --dev --python=${{ matrix.python-version }}
+
+      - name: Setup LibMagic (MacOS)
+        if: matrix.os == 'macos-latest' && steps.changes.outputs.core == 'true'
+        run: brew install libmagic
+
+      - name: Pytest Core standalone
+        if: steps.changes.outputs.core == 'true'
+        run: pipenv run pytest -m "standalone" tests/core
+
+  modin_tests:
+    needs: linter
+    timeout-minutes: 20
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: [ '3.8', '3.9', '3.10', '3.11' ]
+        os: [ ubuntu-latest, windows-latest, macos-latest ]
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: dorny/paths-filter@v2
+        id: changes
+        with:
+          filters: |
+            core:
+              - 'taipy/core/**'
+
+      - uses: actions/setup-python@v5
+        with:
+          python-version: ${{matrix.python-version}}
+
+      - name: Install pipenv
+        if: steps.changes.outputs.core == 'true'
+        run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
+
+      - name: Install Dependencies
+        if: steps.changes.outputs.core == 'true'
+        run: pipenv install --dev --python=${{ matrix.python-version }}
+
+      - name: Setup LibMagic (MacOS)
+        if: matrix.os == 'macos-latest' && steps.changes.outputs.core == 'true'
+        run: brew install libmagic
+
+      - name: Pytest Core modin
+        if: steps.changes.outputs.core == 'true'
+        run: pipenv run pytest -m "modin" tests/core

+ 3 - 13
.github/workflows/packaging.yml

@@ -36,19 +36,9 @@ jobs:
         run: |
           pip install .
           rm -rf taipy
-
-          python -c "import taipy as tp; tp.Scenario"
-          python -c "import taipy as tp; tp.gui"
-          python -c "import taipy as tp; tp.rest"
-
-          echo """
-          import taipy
-          from pathlib import Path
-          taipy_gui_core_path = Path(taipy.__file__).absolute().parent / 'gui_core' / 'lib' / 'taipy-gui-core.js'
-          if not taipy_gui_core_path.exists():
-              raise FileNotFoundError(f'taipy-gui-core.js not found in {taipy_gui_core_path}')
-          """ > ${{ runner.temp }}/verify_gui_core.py
-          python ${{ runner.temp }}/verify_gui_core.py
+      - name: Check Taipy Installation
+        run: |
+          python tools/validate_taipy_install.py
 
       - name: Notify user if failed
         if: failure()

+ 0 - 10
.github/workflows/partial-tests.yml

@@ -11,16 +11,6 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
-
-      - uses: ricardochaves/python-lint@v1.4.0
-        with:
-          use-black: false
-          use-flake8: false
-          use-isort: false
-          use-pycodestyle: false
-          use-pylint: false
-          extra-mypy-options: "--ignore-missing-imports --implicit-optional --no-namespace-packages --exclude (taipy/templates/|generate_pyi.py|tools) --follow-imports skip"
-
       - uses: chartboost/ruff-action@v1
   tests:
     needs: linter

+ 2 - 21
.github/workflows/publish.yml

@@ -21,34 +21,15 @@ jobs:
         id: vars
         run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
 
-      - name: Ensure package version is properly set
-        run: |
-          echo """
-          import json, sys, os
-          with open(f\"taipy{os.sep}version.json\") as version_file:
-            version_o = json.load(version_file)
-          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
-          if vext := version_o.get(\"ext\"):
-            version = f'{version}.{vext}'
-          if version != sys.argv[1]:
-            raise ValueError(f\"Invalid version {version} / {sys.argv[1]}\")
-          if sys.argv[1] != sys.argv[2]:
-            raise ValueError(f\"Invalid tag version {sys.argv[2]} with package version {sys.argv[1]}\")
-          """ > ${{ runner.temp }}/check.py
-          python ${{ runner.temp }}/check.py "${{ github.event.inputs.version }}" "${{ steps.vars.outputs.tag }}"
-
       - name: Download assets from github release tag
         run: |
           gh release download ${{ github.event.inputs.version }} --dir dist
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
-      - name: Verify there is a release asset
+      - name: Verify if all releases exist
         run: |
-          if [ ! -f dist/${{ github.event.repository.name }}-${{ github.event.inputs.version }}.tar.gz ]; then
-            echo "No release asset found"
-            exit 1
-          fi
+          python tools/release/check_releases.py
 
   publish-to-pypi:
     needs: [test-package]

+ 173 - 0
.github/workflows/release-dev-old.yml

@@ -0,0 +1,173 @@
+name: Create Github Dev Release
+
+on:
+  workflow_dispatch:
+    inputs:
+      taipy-gui-version:
+        description: "The taipy-gui version to use (ex: 2.3.0.dev0)"
+        required: true
+      taipy-rest-version:
+        description: "The taipy-rest version to use (ex: 2.3.0.dev0)"
+      taipy-templates-version:
+        description: "The taipy-templates version to use (ex: 2.3.0.dev0)"
+
+jobs:
+  release-dev-package:
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ssh-key: ${{secrets.DEPLOY_KEY}}
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.11
+      - uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+
+      - name: Ensure package version has 'dev' suffix
+        run: |
+          echo """
+          import json, sys, os
+          SUFFIX = 'dev'
+          with open(f\"taipy{os.sep}version.json\") as version_file:
+              version_o = json.load(version_file)
+          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
+          if vext := version_o.get(\"ext\"):
+              version = f'{version}.{vext}'
+          if SUFFIX not in version:
+              raise ValueError(f\"version {version} does not contain suffix {SUFFIX}\")
+          """ > ${{ runner.temp }}/check1.py
+          python ${{ runner.temp }}/check1.py
+
+      - name: Extract package version
+        id: current-version
+        run: |
+          echo """
+          import json, os
+          with open(f\"taipy{os.sep}version.json\") as version_file:
+              version_o = json.load(version_file)
+          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
+          if vext := version_o.get(\"ext\"):
+              version = f'{version}.{vext}'
+          print(f'VERSION={version}')
+          """ > ${{ runner.temp }}/check2.py
+          python ${{ runner.temp }}/check2.py >> $GITHUB_OUTPUT
+
+      - name: Check taipy-gui dependencies
+        run: |
+          curl https://pypi.org/simple/taipy-gui/ | grep -o ">taipy-gui-${{ github.event.inputs.taipy-gui-version }}\.tar\.gz<"
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install build wheel
+          pip install "taipy-gui==${{ github.event.inputs.taipy-gui-version }}"
+
+      - name: Check dependencies are available
+        if: github.event.inputs.taipy-rest-version != '' && github.event.inputs.taipy-templates-version != ''
+        run: |
+          curl https://pypi.org/simple/taipy-rest/ | grep -o ">taipy-rest-${{ github.event.inputs.taipy-rest-version }}\.tar\.gz<"
+          curl https://pypi.org/simple/taipy-templates/ | grep -o ">taipy-templates-${{ github.event.inputs.taipy-templates-version }}\.tar\.gz<"
+
+      - name: Update setup.py locally
+        if: github.event.inputs.taipy-gui-version != '' && github.event.inputs.taipy-rest-version != '' && github.event.inputs.taipy-templates-version != ''
+        run: |
+          mv setup.py setup.taipy.py
+          echo """
+          import sys
+          with open('setup.taipy.py', mode='r') as setup_r, open('setup.py', mode='w') as setup_w:
+              in_requirements = False
+              looking = True
+              for line in setup_r:
+                  if looking:
+                      if line.lstrip().startswith('requirements') and line.rstrip().endswith('['):
+                          in_requirements = True
+                      elif in_requirements:
+                          if line.strip() == ']':
+                              looking = False
+                          else:
+                              if line.lstrip().startswith('\"taipy-gui@git+https'):
+                                  start = line.find('\"taipy-gui')
+                                  end = line.rstrip().find(',')
+                                  line = f'{line[:start]}\"taipy-gui=={sys.argv[1]}\"{line[end:]}'
+                              elif line.lstrip().startswith('\"taipy-rest@git+https'):
+                                  start = line.find('\"taipy-rest')
+                                  end = line.rstrip().find(',')
+                                  line = f'{line[:start]}\"taipy-rest=={sys.argv[2]}\"{line[end:]}'
+                              elif line.lstrip().startswith('\"taipy-templates@git+https'):
+                                  start = line.find('\"taipy-templates')
+                                  end = line.rstrip().find(',')
+                                  line = f'{line[:start]}\"taipy-templates=={sys.argv[3]}\"{line[end:]}'
+                  setup_w.write(line)
+          """ > ${{ runner.temp }}/write_setup_taipy.py
+          python ${{ runner.temp }}/write_setup_taipy.py "${{ github.event.inputs.taipy-gui-version }}" "${{ github.event.inputs.taipy-rest-version }}" "${{ github.event.inputs.taipy-templates-version }}"
+
+      - name: Build package
+        run: python setup.py build_py && python -m build
+
+      - name: Install the package and test it
+        run: |
+          # Install package
+          echo "Installing package..."
+          pip install ./dist/${{ github.event.repository.name }}-${{ steps.current-version.outputs.VERSION }}.tar.gz
+
+          # Run tests
+          python -c "import taipy as tp; tp.Scenario"
+          python -c "import taipy as tp; tp.gui"
+          python -c "import taipy as tp; tp.rest"
+
+          echo """
+          import taipy
+          from pathlib import Path
+          taipy_gui_core_path = Path(taipy.__file__).absolute().parent / 'gui_core' / 'lib' / 'taipy-gui-core.js'
+          if not taipy_gui_core_path.exists():
+              raise FileNotFoundError(f'taipy-gui-core.js not found in {taipy_gui_core_path}')
+          """ > ${{ runner.temp }}/verify_gui_core.py
+          python ${{ runner.temp }}/verify_gui_core.py
+
+      - name: Extract commit hash
+        shell: bash
+        run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
+        id: extract_hash
+
+      - name: Create/update release and tag
+        run: |
+          echo "Creating release ${{ steps.current-version.outputs.VERSION }}"
+          gh release create ${{ steps.current-version.outputs.VERSION }} ./dist/${{ github.event.repository.name }}-${{ steps.current-version.outputs.VERSION }}.tar.gz --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.current-version.outputs.VERSION }} --notes "Release Draft ${{ steps.current-version.outputs.VERSION }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Reset changes
+        run: |
+          git reset --hard HEAD
+          git clean -fdx
+
+      - name: Increase dev version
+        id: new-version
+        run: |
+          echo """
+          import json, os
+          with open(f'taipy{os.sep}version.json') as version_file:
+              version_o = json.load(version_file)
+              if version_o is None or 'dev' not in version_o['ext']:
+                  raise ValueError('Invalid version file. Version must contain dev suffix.')
+              prev_version = version_o['ext']
+              new_version = 'dev' + str(int(version_o['ext'].replace('dev', '')) + 1)
+              with open(f'taipy{os.sep}version.json') as r:
+                  text = r.read().replace(prev_version, new_version)
+              with open(f'taipy{os.sep}version.json', mode='w') as w:
+                  w.write(text)
+              with open(f\"taipy{os.sep}version.json\") as version_file:
+                  version_o = json.load(version_file)
+              version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
+              if vext := version_o.get(\"ext\"):
+                  version = f'{version}.{vext}'
+              print(f'VERSION={version}')
+          """ > ${{ runner.temp }}/increase_dev_version.py
+          python ${{ runner.temp }}/increase_dev_version.py >> $GITHUB_OUTPUT
+
+      - uses: stefanzweifel/git-auto-commit-action@v4
+        with:
+          commit_message: Update version to ${{ steps.new-version.outputs.VERSION }}

+ 19 - 102
.github/workflows/release-dev.yml

@@ -12,11 +12,11 @@ on:
         description: "The taipy-templates version to use (ex: 2.3.0.dev0)"
 
 jobs:
-  release-dev-package:
+  release-dev-package-v2:
     timeout-minutes: 20
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           ssh-key: ${{secrets.DEPLOY_KEY}}
       - uses: actions/setup-python@v4
@@ -26,46 +26,24 @@ jobs:
         with:
           node-version: '20'
 
-      - name: Ensure package version has 'dev' suffix
+      - name: Setup Dev Version
+        id: version-setup
         run: |
-          echo """
-          import json, sys, os
-          SUFFIX = 'dev'
-          with open(f\"taipy{os.sep}version.json\") as version_file:
-              version_o = json.load(version_file)
-          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
-          if vext := version_o.get(\"ext\"):
-              version = f'{version}.{vext}'
-          if SUFFIX not in version:
-              raise ValueError(f\"version {version} does not contain suffix {SUFFIX}\")
-          """ > ${{ runner.temp }}/check1.py
-          python ${{ runner.temp }}/check1.py
+          python tools/release/setup_version.py taipy dev >> $GITHUB_OUTPUT
 
-      - name: Extract package version
-        id: current-version
-        run: |
-          echo """
-          import json, os
-          with open(f\"taipy{os.sep}version.json\") as version_file:
-              version_o = json.load(version_file)
-          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
-          if vext := version_o.get(\"ext\"):
-              version = f'{version}.{vext}'
-          print(f'VERSION={version}')
-          """ > ${{ runner.temp }}/check2.py
-          python ${{ runner.temp }}/check2.py >> $GITHUB_OUTPUT
-
-      - name: Check taipy-gui dependencies
+      - name: Check Taipy Gui version is available
         run: |
           curl https://pypi.org/simple/taipy-gui/ | grep -o ">taipy-gui-${{ github.event.inputs.taipy-gui-version }}\.tar\.gz<"
-
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
           pip install build wheel
+
+      - name: Install Taipy Gui
+        run: |
           pip install "taipy-gui==${{ github.event.inputs.taipy-gui-version }}"
 
-      - name: Check dependencies are available
+      - name: Check Taipy Rest and Taipy Templates are available
         if: github.event.inputs.taipy-rest-version != '' && github.event.inputs.taipy-templates-version != ''
         run: |
           curl https://pypi.org/simple/taipy-rest/ | grep -o ">taipy-rest-${{ github.event.inputs.taipy-rest-version }}\.tar\.gz<"
@@ -75,57 +53,20 @@ jobs:
         if: github.event.inputs.taipy-gui-version != '' && github.event.inputs.taipy-rest-version != '' && github.event.inputs.taipy-templates-version != ''
         run: |
           mv setup.py setup.taipy.py
-          echo """
-          import sys
-          with open('setup.taipy.py', mode='r') as setup_r, open('setup.py', mode='w') as setup_w:
-              in_requirements = False
-              looking = True
-              for line in setup_r:
-                  if looking:
-                      if line.lstrip().startswith('requirements') and line.rstrip().endswith('['):
-                          in_requirements = True
-                      elif in_requirements:
-                          if line.strip() == ']':
-                              looking = False
-                          else:
-                              if line.lstrip().startswith('\"taipy-gui@git+https'):
-                                  start = line.find('\"taipy-gui')
-                                  end = line.rstrip().find(',')
-                                  line = f'{line[:start]}\"taipy-gui=={sys.argv[1]}\"{line[end:]}'
-                              elif line.lstrip().startswith('\"taipy-rest@git+https'):
-                                  start = line.find('\"taipy-rest')
-                                  end = line.rstrip().find(',')
-                                  line = f'{line[:start]}\"taipy-rest=={sys.argv[2]}\"{line[end:]}'
-                              elif line.lstrip().startswith('\"taipy-templates@git+https'):
-                                  start = line.find('\"taipy-templates')
-                                  end = line.rstrip().find(',')
-                                  line = f'{line[:start]}\"taipy-templates=={sys.argv[3]}\"{line[end:]}'
-                  setup_w.write(line)
-          """ > ${{ runner.temp }}/write_setup_taipy.py
-          python ${{ runner.temp }}/write_setup_taipy.py "${{ github.event.inputs.taipy-gui-version }}" "${{ github.event.inputs.taipy-rest-version }}" "${{ github.event.inputs.taipy-templates-version }}"
+          python tools/release/update_setup.py "${{ github.event.inputs.taipy-gui-version }}" "${{ github.event.inputs.taipy-rest-version }}" "${{ github.event.inputs.taipy-templates-version }}"
 
-      - name: Build package
+      - name: Build Taipy package
         run: python setup.py build_py && python -m build
 
-      - name: Install the package and test it
+      - name: Install the Taipy package and test it
         run: |
           # Install package
           echo "Installing package..."
-          pip install ./dist/${{ github.event.repository.name }}-${{ steps.current-version.outputs.VERSION }}.tar.gz
+          pip install ./dist/${{ github.event.repository.name }}-${{ steps.version-setup.outputs.VERSION }}.tar.gz
 
-          # Run tests
-          python -c "import taipy as tp; tp.Scenario"
-          python -c "import taipy as tp; tp.gui"
-          python -c "import taipy as tp; tp.rest"
-
-          echo """
-          import taipy
-          from pathlib import Path
-          taipy_gui_core_path = Path(taipy.__file__).absolute().parent / 'gui_core' / 'lib' / 'taipy-gui-core.js'
-          if not taipy_gui_core_path.exists():
-              raise FileNotFoundError(f'taipy-gui-core.js not found in {taipy_gui_core_path}')
-          """ > ${{ runner.temp }}/verify_gui_core.py
-          python ${{ runner.temp }}/verify_gui_core.py
+      - name: Check Taipy Installation
+        run: |
+          python tools/validate_taipy_install.py
 
       - name: Extract commit hash
         shell: bash
@@ -135,7 +76,7 @@ jobs:
       - name: Create/update release and tag
         run: |
           echo "Creating release ${{ steps.current-version.outputs.VERSION }}"
-          gh release create ${{ steps.current-version.outputs.VERSION }} ./dist/${{ github.event.repository.name }}-${{ steps.current-version.outputs.VERSION }}.tar.gz --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.current-version.outputs.VERSION }} --notes "Release Draft ${{ steps.current-version.outputs.VERSION }}"
+          gh release create ${{ steps.version-setup.outputs.VERSION }} ./dist/${{ github.event.repository.name }}-${{ steps.version-setup.outputs.VERSION }}.tar.gz --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.version-setup.outputs.VERSION }} --notes "Release Draft ${{ steps.version-setup.outputs.VERSION }}"
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
@@ -144,30 +85,6 @@ jobs:
           git reset --hard HEAD
           git clean -fdx
 
-      - name: Increase dev version
-        id: new-version
-        run: |
-          echo """
-          import json, os
-          with open(f'taipy{os.sep}version.json') as version_file:
-              version_o = json.load(version_file)
-              if version_o is None or 'dev' not in version_o['ext']:
-                  raise ValueError('Invalid version file. Version must contain dev suffix.')
-              prev_version = version_o['ext']
-              new_version = 'dev' + str(int(version_o['ext'].replace('dev', '')) + 1)
-              with open(f'taipy{os.sep}version.json') as r:
-                  text = r.read().replace(prev_version, new_version)
-              with open(f'taipy{os.sep}version.json', mode='w') as w:
-                  w.write(text)
-              with open(f\"taipy{os.sep}version.json\") as version_file:
-                  version_o = json.load(version_file)
-              version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
-              if vext := version_o.get(\"ext\"):
-                  version = f'{version}.{vext}'
-              print(f'VERSION={version}')
-          """ > ${{ runner.temp }}/increase_dev_version.py
-          python ${{ runner.temp }}/increase_dev_version.py >> $GITHUB_OUTPUT
-
       - uses: stefanzweifel/git-auto-commit-action@v4
         with:
-          commit_message: Update version to ${{ steps.new-version.outputs.VERSION }}
+          commit_message: Update version to ${{ steps.version-setup.outputs.NEW_VERSION }}

+ 106 - 0
.github/workflows/release-old.yml

@@ -0,0 +1,106 @@
+name: Create Github Release
+
+on:
+  workflow_dispatch:
+    inputs:
+      version:
+        description: "The release/package version to create (ex: 1.0.0)"
+        required: true
+
+jobs:
+  release-package:
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.11
+      - uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+
+      - name: Extract branch name
+        shell: bash
+        run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
+        id: extract_branch
+
+      - name: Ensure package version is properly set
+        run: |
+          echo """
+          import json, sys, os
+          with open(f\"taipy{os.sep}version.json\") as version_file:
+              version_o = json.load(version_file)
+          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
+          if vext := version_o.get(\"ext\"):
+              version = f'{version}.{vext}'
+          if version != sys.argv[1]:
+              raise ValueError(f\"Invalid version {version} / {sys.argv[1]}\")
+          """ > ${{ runner.temp }}/check1.py
+          python ${{ runner.temp }}/check1.py "${{ github.event.inputs.version }}"
+
+      - name: Validate branch name
+        run: |
+          echo """
+          import json, sys, os
+          with open(f\"taipy{os.sep}version.json\") as version_file:
+              version = json.load(version_file)
+          if f'release/{version.get(\"major\")}.{version.get(\"minor\")}' != sys.argv[1]:
+              raise ValueError(f'Branch name mismatch: release/{version.get(\"major\")}.{version.get(\"minor\")} != {sys.argv[1]}')
+          """ > ${{ runner.temp }}/check2.py
+          python ${{ runner.temp }}/check2.py "${{ steps.extract_branch.outputs.branch }}"
+
+      - name: Modify README image file path
+        run: |
+          cp tools/modify_readme.py ${{ runner.temp }}
+          python ${{ runner.temp }}/modify_readme.py "${{ github.event.repository.name }}" "${{ steps.extract_branch.outputs.branch }}"
+
+      - name: Get taipy-gui version from setup.py
+        id: taipy_gui_version
+        run: |
+          echo """
+          with open('setup.py') as f:
+              for line in f:
+                  if 'taipy-gui' in line:
+                      start = line.find('taipy-gui')
+                      end = line.rstrip().find('\",')
+                      print(f'VERSION={line[start:end]}')
+                      break
+          """ > ${{ runner.temp }}/get_gui_version.py
+          python ${{ runner.temp }}/get_gui_version.py >> $GITHUB_OUTPUT
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install build wheel
+          # install taipy-gui from based on setup.py version
+          pip install "${{ steps.taipy_gui_version.outputs.VERSION }}"
+
+      - name: Build and test the package
+        run: |
+          python setup.py build_py && python -m build
+          rm -rf taipy
+          pip install dist/*.tar.gz
+          python -c "import taipy as tp; tp.Scenario"
+          python -c "import taipy as tp; tp.gui"
+          python -c "import taipy as tp; tp.rest"
+
+          echo """
+          import taipy
+          from pathlib import Path
+          taipy_gui_core_path = Path(taipy.__file__).absolute().parent / 'gui_core' / 'lib' / 'taipy-gui-core.js'
+          if not taipy_gui_core_path.exists():
+              raise FileNotFoundError(f'taipy-gui-core.js not found in {taipy_gui_core_path}')
+          """ > ${{ runner.temp }}/verify_gui_core.py
+          python ${{ runner.temp }}/verify_gui_core.py
+
+      - name: Extract commit hash
+        shell: bash
+        run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
+        id: extract_hash
+
+      - name: Create/update release and tag
+        run: |
+            gh release create ${{ github.event.inputs.version }} ./dist/${{ github.event.repository.name }}-${{ github.event.inputs.version }}.tar.gz --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ github.event.inputs.version }}
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 17 - 47
.github/workflows/release.yml

@@ -25,74 +25,44 @@ jobs:
         run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
         id: extract_branch
 
-      - name: Ensure package version is properly set
+      - name: Setup Version
+        id: version-setup
         run: |
-          echo """
-          import json, sys, os
-          with open(f\"taipy{os.sep}version.json\") as version_file:
-              version_o = json.load(version_file)
-          version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
-          if vext := version_o.get(\"ext\"):
-              version = f'{version}.{vext}'
-          if version != sys.argv[1]:
-              raise ValueError(f\"Invalid version {version} / {sys.argv[1]}\")
-          """ > ${{ runner.temp }}/check1.py
-          python ${{ runner.temp }}/check1.py "${{ github.event.inputs.version }}"
-
-      - name: Validate branch name
-        run: |
-          echo """
-          import json, sys, os
-          with open(f\"taipy{os.sep}version.json\") as version_file:
-              version = json.load(version_file)
-          if f'release/{version.get(\"major\")}.{version.get(\"minor\")}' != sys.argv[1]:
-              raise ValueError(f'Branch name mismatch: release/{version.get(\"major\")}.{version.get(\"minor\")} != {sys.argv[1]}')
-          """ > ${{ runner.temp }}/check2.py
-          python ${{ runner.temp }}/check2.py "${{ steps.extract_branch.outputs.branch }}"
+          python tools/release/setup_version.py taipy prod "${{ github.event.inputs.version }}" "${{ steps.extract_branch.outputs.branch }}"
 
       - name: Modify README image file path
         run: |
-          cp tools/modify_readme.py ${{ runner.temp }}
-          python ${{ runner.temp }}/modify_readme.py "${{ github.event.repository.name }}" "${{ steps.extract_branch.outputs.branch }}"
+          python tools/modify_readme.py "${{ github.event.repository.name }}" "${{ steps.extract_branch.outputs.branch }}"
 
       - name: Get taipy-gui version from setup.py
         id: taipy_gui_version
         run: |
-          echo """
-          with open('setup.py') as f:
-              for line in f:
-                  if 'taipy-gui' in line:
-                      start = line.find('taipy-gui')
-                      end = line.rstrip().find('\",')
-                      print(f'VERSION={line[start:end]}')
-                      break
-          """ > ${{ runner.temp }}/get_gui_version.py
-          python ${{ runner.temp }}/get_gui_version.py >> $GITHUB_OUTPUT
+          python tools/release/extract_from_setup.py >> $GITHUB_OUTPUT
 
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
           pip install build wheel
+
+      - name: Install Taipy Gui
+        run: |
           # install taipy-gui from based on setup.py version
           pip install "${{ steps.taipy_gui_version.outputs.VERSION }}"
 
-      - name: Build and test the package
+      - name: Build Taipy package
         run: |
           python setup.py build_py && python -m build
           rm -rf taipy
+
+      - name: Install the Taipy package and test it
+        run: |
+          # Install package
+          echo "Installing package..."
           pip install dist/*.tar.gz
-          python -c "import taipy as tp; tp.Scenario"
-          python -c "import taipy as tp; tp.gui"
-          python -c "import taipy as tp; tp.rest"
 
-          echo """
-          import taipy
-          from pathlib import Path
-          taipy_gui_core_path = Path(taipy.__file__).absolute().parent / 'gui_core' / 'lib' / 'taipy-gui-core.js'
-          if not taipy_gui_core_path.exists():
-              raise FileNotFoundError(f'taipy-gui-core.js not found in {taipy_gui_core_path}')
-          """ > ${{ runner.temp }}/verify_gui_core.py
-          python ${{ runner.temp }}/verify_gui_core.py
+      - name: Check Taipy Installation
+        run: |
+          python tools/validate_taipy_install.py
 
       - name: Extract commit hash
         shell: bash

+ 14 - 0
MANIFEST.in

@@ -0,0 +1,14 @@
+recursive-include tools *
+include taipy/core/*.json
+include taipy/core/config/*.json
+include taipy/*.json
+include taipy/gui_core/*.json
+include taipy/gui_core/lib/*.js
+recursive-include taipy/gui/webapp *
+include taipy/gui/version.json
+include taipy/gui/viselements.json
+include taipy/gui/*.pyi
+include taipy/config/*.pyi
+include taipy/config/*.json
+recursive-include taipy/templates *
+include taipy/rest/*.json

+ 3 - 3
setup.py

@@ -11,7 +11,7 @@
 
 """The setup script."""
 
-
+import os
 import json
 import platform
 import subprocess
@@ -25,14 +25,14 @@ root_folder = Path(__file__).parent
 readme = (root_folder / "README.md").read_text("UTF-8")
 
 # get current version
-with open(root_folder / "taipy" / "version.json") as version_file:
+with open(os.path.join("taipy", "version.json")) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
         version_string = f"{version_string}.{vext}"
 
 # build MANIFEST.in from tools/packages/taipy*/MANIFEST.in
-with open(root_folder / "MANIFEST.in", "w") as man:
+with open(os.path.join(root_folder, "MANIFEST.in"), "a") as man:
     for pman in [
         dir / "MANIFEST.in"
         for dir in (root_folder / "tools" / "packages").iterdir()

+ 2 - 2
taipy/config/MANIFEST.in

@@ -1,2 +1,2 @@
-include taipy/config/*.pyi
-include taipy/config/*.json
+include *.pyi
+include *.json

+ 5 - 4
taipy/config/setup.py

@@ -20,7 +20,9 @@ from setuptools import find_namespace_packages, find_packages, setup
 with open("README.md") as readme_file:
     readme = readme_file.read()
 
-with open(f"src{os.sep}taipy{os.sep}config{os.sep}version.json") as version_file:
+version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.json")
+
+with open(version_path) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
@@ -47,13 +49,12 @@ setup(
     install_requires=requirements,
     long_description=readme,
     long_description_content_type="text/markdown",
-    include_package_data=True,
     license="Apache License 2.0",
     keywords="taipy-config",
     name="taipy-config",
-    package_dir={"": "src"},
-    packages=find_namespace_packages(where="src")
+    packages=find_namespace_packages(where=".")
     + find_packages(include=["taipy", "taipy.config", "taipy.config.*", "taipy.logger", "taipy.logger.*"]),
+    include_package_data=True,
     test_suite="tests",
     tests_require=test_requirements,
     url="https://github.com/avaiga/taipy-config",

+ 2 - 2
taipy/core/MANIFEST.in

@@ -1,2 +1,2 @@
-include taipy/core/*.json
-include taipy/core/config/*.json
+include *.json
+include config/*.json

+ 3 - 3
taipy/core/setup.py

@@ -20,7 +20,8 @@ from setuptools import find_namespace_packages, find_packages, setup
 with open("README.md") as readme_file:
     readme = readme_file.read()
 
-with open(f"src{os.sep}taipy{os.sep}core{os.sep}version.json") as version_file:
+version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.json")
+with open(version_path) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
@@ -67,8 +68,7 @@ setup(
     license="Apache License 2.0",
     keywords="taipy-core",
     name="taipy-core",
-    package_dir={"": "src"},
-    packages=find_namespace_packages(where="src") + find_packages(include=["taipy", "taipy.core", "taipy.core.*"]),
+    packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.core", "taipy.core.*"]),
     include_package_data=True,
     test_suite="tests",
     tests_require=test_requirements,

+ 4 - 4
taipy/gui/MANIFEST.in

@@ -1,4 +1,4 @@
-recursive-include taipy/gui/webapp *
-include taipy/gui/version.json
-include taipy/gui/viselements.json
-include taipy/gui/*.pyi
+recursive-include webapp *
+include version.json
+include viselements.json
+include *.pyi

+ 3 - 3
taipy/gui/setup.py

@@ -22,7 +22,8 @@ from setuptools.command.build_py import build_py
 
 readme = Path("README.md").read_text()
 
-with open(f"src{os.sep}taipy{os.sep}gui{os.sep}version.json") as version_file:
+version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.json")
+with open(version_path) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
@@ -94,8 +95,7 @@ setup(
     include_package_data=True,
     keywords="taipy-gui",
     name="taipy-gui",
-    package_dir={"": "src"},
-    packages=find_namespace_packages(where="src") + find_packages(include=["taipy", "taipy.gui", "taipy.gui.*"]),
+    packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.gui", "taipy.gui.*"]),
     test_suite="tests",
     tests_require=test_requirements,
     url="https://github.com/avaiga/taipy-gui",

+ 1 - 1
taipy/rest/MANIFEST.in

@@ -1 +1 @@
-include src/taipy/rest/*.json
+include *.json

+ 3 - 3
taipy/rest/setup.py

@@ -16,7 +16,8 @@ from setuptools import find_namespace_packages, find_packages, setup
 with open("README.md") as readme_file:
     readme = readme_file.read()
 
-with open(f"src{os.sep}taipy{os.sep}rest{os.sep}version.json") as version_file:
+version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.json")
+with open(version_path) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
@@ -29,8 +30,7 @@ setup(
     python_requires=">=3.8",
     version=version_string,
     author_email="dev@taipy.io",
-    packages=find_namespace_packages(where="src") + find_packages(include=["taipy", "taipy.rest"]),
-    package_dir={"": "src"},
+    packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.rest"]),
     include_package_data=True,
     long_description=readme,
     long_description_content_type="text/markdown",

+ 1 - 0
taipy/templates/MANIFEST.in

@@ -1 +1,2 @@
 recursive-include taipy/templates *
+include *.json

+ 3 - 3
taipy/templates/setup.py

@@ -19,7 +19,8 @@ from setuptools import find_namespace_packages, find_packages, setup
 with open("README.md", "rb") as readme_file:
     readme = readme_file.read().decode("UTF-8")
 
-with open(f"src{os.sep}taipy{os.sep}templates{os.sep}version.json") as version_file:
+version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.json")
+with open(version_path) as version_file:
     version = json.load(version_file)
     version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
     if vext := version.get("ext"):
@@ -47,8 +48,7 @@ setup(
     long_description_content_type="text/markdown",
     keywords="taipy-templates",
     name="taipy-templates",
-    package_dir={"": "src"},
-    packages=find_namespace_packages(where="src") + find_packages(include=["taipy"]),
+    packages=find_namespace_packages(where=".") + find_packages(include=["taipy"]),
     include_package_data=True,
     test_suite="tests",
     url="https://github.com/avaiga/taipy-templates",

+ 21 - 0
tools/release/check_releases.py

@@ -0,0 +1,21 @@
+import sys
+import os
+
+
+if __name__ == "__main__":
+    _path = sys.argv[1]
+    _version = sys.argv[2]
+
+    packages = [
+        f"taipy-{_version}.tar.gz",
+        f"taipy-config-{_version}.tar.gz",
+        f"taipy-core-{_version}.tar.gz",
+        f"taipy-rest-{_version}.tar.gz",
+        f"taipy-gui-{_version}.tar.gz",
+        f"taipy-templates-{_version}.tar.gz",
+    ]
+
+    for package in packages:
+        if not os.path.exists(os.path.join(_path, package)):
+            print(f"Package {package} does not exist")
+            sys.exit(1)

+ 15 - 0
tools/release/extract_from_setup.py

@@ -0,0 +1,15 @@
+import sys
+
+
+def extract_gui_version(base_path: str) -> None:
+    with open("setup.py") as f:
+        for line in f:
+            if "taipy-gui" in line:
+                start = line.find("taipy-gui")
+                end = line.rstrip().find('",')
+                print(f"VERSION={line[start:end]}")
+                break
+
+
+if __name__ == "__main__":
+    extract_gui_version(sys.argv[1])

+ 105 - 0
tools/release/setup_version.py

@@ -0,0 +1,105 @@
+import sys
+import json
+import os
+from dataclasses import dataclass, asdict
+import re
+from typing import Optional
+
+
+@dataclass
+class Version:
+    major: str
+    minor: str
+    patch: str
+    ext: str
+
+    def bump_ext_version(self) -> None:
+        if not self.ext:
+            return
+        reg = re.compile(r"[0-9]+$")
+        num = reg.findall(self.ext)[0]
+
+        self.ext = self.ext.replace(num, str(int(num) + 1))
+
+    def validate_suffix(self, suffix="dev"):
+        if suffix not in self.ext:
+            raise Exception(f"Version does not contain suffix {suffix}")
+
+    def __str__(self) -> str:
+        """returns a string representation of a version"""
+        version_str = f"{self.major}.{self.minor}.{self.patch}"
+        if self.ext:
+            version_str = f"{version_str}.{self.ext}"
+        return version_str
+
+
+def __load_version_from_path(base_path: str) -> Version:
+    """Load version.json file from base path."""
+    with open(os.path.join(base_path, "version.json")) as version_file:
+        data = json.load(version_file)
+        return Version(**data)
+
+
+def __write_version_to_path(base_path: str, version: Version) -> None:
+    with open(os.path.join(base_path, "version.json"), "w") as version_file:
+        json.dump(asdict(version), version_file)
+
+
+def extract_version(base_path: str) -> Version:
+    """
+    Load version.json file from base path and return the version string.
+    """
+    return __load_version_from_path(base_path)
+
+
+def __setup_dev_version(
+    version: Version, _base_path: str, name: Optional[str] = None, bump_dev_version: bool = False
+) -> None:
+    name = f"{name}_VERSION" if name else "VERSION"
+    version.validate_suffix()
+    print(f"{name}={version}")
+    if bump_dev_version:
+        version.bump_ext_version()
+    __write_version_to_path(_base_path, version)
+    print(f"NEW_{name}={version}")
+
+
+def __setup_prod_version(version: Version, target_version: str, branch_name: str) -> None:
+    if str(version) != target_version:
+        raise ValueError(f"Current version={version} does not match target version={target_version}")
+
+    if target_branch_name := f"release/{version.major}.{version.minor}" != branch_name:
+        raise ValueError(
+            f"Branch name mismatch branch={branch_name} does not match target branch name={target_branch_name}"
+        )
+
+
+if __name__ == "__main__":
+    paths = (
+        [sys.argv[1]]
+        if sys.argv[1] != "ALL"
+        else [
+            f"taipy{os.sep}config",
+            f"taipy{os.sep}core",
+            f"taipy{os.sep}rest",
+            f"taipy{os.sep}gui",
+            f"taipy{os.sep}templates",
+            "taipy",
+        ]
+    )
+    _environment = sys.argv[2]
+    should_bump = False
+
+    try:
+        should_bump = True if sys.argv[3] == "bump" else False
+    except IndexError:
+        pass
+
+    for _path in paths:
+        _version = extract_version(_path)
+        if _environment == "dev":
+            _name = None if _path == "taipy" else _path.split(os.sep)[-1]
+            __setup_dev_version(_version, _path, _name, should_bump)
+
+        if _environment == "prod":
+            __setup_prod_version(_version, sys.argv[3], sys.argv[4])

+ 32 - 0
tools/release/update_setup.py

@@ -0,0 +1,32 @@
+import sys
+
+
+def update_setup() -> None:
+    with open("setup.taipy.py", mode="r") as setup_r, open("setup.py", mode="w") as setup_w:
+        in_requirements = False
+        looking = True
+        for line in setup_r:
+            if looking:
+                if line.lstrip().startswith("requirements") and line.rstrip().endswith("["):
+                    in_requirements = True
+                elif in_requirements:
+                    if line.strip() == "]":
+                        looking = False
+                    else:
+                        if line.lstrip().startswith('"taipy-gui@git+https'):
+                            start = line.find('"taipy-gui')
+                            end = line.rstrip().find(",")
+                            line = f'{line[:start]}"taipy-gui=={sys.argv[1]}"{line[end:]}'
+                        elif line.lstrip().startswith('"taipy-rest@git+https'):
+                            start = line.find('"taipy-rest')
+                            end = line.rstrip().find(",")
+                            line = f'{line[:start]}"taipy-rest=={sys.argv[2]}"{line[end:]}'
+                        elif line.lstrip().startswith('"taipy-templates@git+https'):
+                            start = line.find('"taipy-templates')
+                            end = line.rstrip().find(",")
+                            line = f'{line[:start]}"taipy-templates=={sys.argv[3]}"{line[end:]}'
+            setup_w.write(line)
+
+
+if __name__ == "__main__":
+    update_setup()

+ 44 - 0
tools/validate_taipy_install.py

@@ -0,0 +1,44 @@
+import logging
+import sys
+
+
+def test_import_taipy_packages() -> bool:
+    """
+    Import taipy package and call gui, Scenario and rest attributes.
+    """
+    import taipy as tp
+
+    valid_install = True
+    if not hasattr(tp, "gui"):
+        logging.error("Taipy installation has no attribute gui")
+        valid_install = False
+    if not hasattr(tp, "Scenario"):
+        logging.error("Taipy installation has no attribute Scenario")
+        valid_install = False
+    if not hasattr(tp, "rest"):
+        logging.error("Taipy installation has no attribute rest")
+        valid_install = False
+
+    return valid_install
+
+
+def test_taipy_gui_core() -> bool:
+    import taipy
+    from pathlib import Path
+
+    taipy_gui_core_path = Path(taipy.__file__).absolute().parent / "gui_core" / "lib" / "taipy-gui-core.js"
+    if not taipy_gui_core_path.exists():
+        logging.error("File taipy-gui-core.js not found in taipy installation path")
+        return False
+    return True
+
+
+if __name__ == "__main__":
+    logging.basicConfig(level=logging.INFO)
+
+    logging.info("Trying to import taipy and verify it's main attributes")
+    if not test_import_taipy_packages() or not test_taipy_gui_core():
+        sys.exit(1)
+
+    logging.info("Taipy installation Validated")
+    sys.exit(0)