From a1a3433a9dfbeda389f2a8e8883db8182bd27039 Mon Sep 17 00:00:00 2001 From: Joao Andre Date: Mon, 5 Aug 2024 20:14:43 -0300 Subject: [PATCH] chore: update pyproject.toml in packing action --- .github/workflows/packaging.yml | 19 ++++++++++++++++++- tools/release/setup_project.py | 20 +++++++++++--------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 7042afd080..2556c61ed6 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -31,11 +31,28 @@ jobs: with: python-version: ${{ matrix.python-versions }} + - name: Install Dependencies + run: | + pip install toml + - name: Build frontends run: | python tools/frontend/bundle_build.py - - name: Install Taipy without dependencies + - name: Update pyproject.toml + run: | + python tools/release/setup_project.py taipy/config + python tools/release/setup_project.py taipy/core + python tools/release/setup_project.py taipy/gui + python tools/release/setup_project.py taipy/rest + python tools/release/setup_project.py taipy/templates + python tools/release/setup_project.py . + + - name: Install Taipy Subpackages + run: | + pip install taipy/config taipy/core taipy/gui taipy/rest taipy/templates + + - name: Install Taipy run: | pip install . diff --git a/tools/release/setup_project.py b/tools/release/setup_project.py index 3522d4db26..02e45dfe3f 100644 --- a/tools/release/setup_project.py +++ b/tools/release/setup_project.py @@ -20,7 +20,7 @@ import toml # type: ignore -def get_requirements(pkg: str): +def get_requirements(pkg: str, env: str = "dev") -> list: # get requirements from the different setups in tools/packages (removing taipy packages) reqs = set() pkg_name = pkg if pkg == "taipy" else f"taipy-{pkg}" @@ -29,7 +29,9 @@ def get_requirements(pkg: str): requirements_file = os.path.join(package_path, "setup.requirements.txt") if os.path.exists(requirements_file): reqs.update(Path(requirements_file).read_text("UTF-8").splitlines()) - return [r for r in reqs if r and not r.startswith("taipy")] + if env == "dev": + return [r for r in reqs if r and not r.startswith("taipy")] + return list(reqs) def update_pyproject(version_path: str, pyproject_path: str): @@ -44,7 +46,7 @@ def update_pyproject(version_path: str, pyproject_path: str): pyproject_data["project"]["urls"]["Release notes"] = f"https://docs.taipy.io/en/release-{version_string}/relnotes/" pyproject_data["project"]["dependencies"] = get_requirements(get_pkg_name(pyproject_path)) - with open(pyproject_path, "w") as pyproject_file: + with open(pyproject_path, "w", encoding="utf-8") as pyproject_file: toml.dump(pyproject_data, pyproject_file) @@ -57,7 +59,7 @@ def _build_webapp(webapp_path: str): def get_pkg_name(path: str) -> str: # The regex pattern - pattern = r"([^/]+)/pyproject\.toml$" + pattern = r"([^/\\]+)[/\\]pyproject\.toml$" # Search for the pattern match = re.search(pattern, os.path.abspath(path)) @@ -67,15 +69,15 @@ def get_pkg_name(path: str) -> str: if __name__ == "__main__": - _pyproject_path = f"{sys.argv[1]}/pyproject.toml" + _pyproject_path = os.path.join(sys.argv[1], "pyproject.toml") pkg = get_pkg_name(_pyproject_path) if pkg == "taipy": - _version_path = f"{sys.argv[1]}/taipy/version.json" - _webapp_path = f"{sys.argv[1]}/taipy/gui/webapp/index.html" + _version_path = os.path.join(sys.argv[1], "taipy", "version.json") + _webapp_path = os.path.join(sys.argv[1], "taipy", "gui", "webapp", "index.html") else: - _version_path = f"{sys.argv[1]}/version.json" - _webapp_path = f"{sys.argv[1]}/webapp/index.html" + _version_path = os.path.join(sys.argv[1], "version.json") + _webapp_path = os.path.join(sys.argv[1], "webapp", "index.html") update_pyproject(_version_path, _pyproject_path)