From 90f28a397d4fd5cf463f2aa57f885ff968024ee5 Mon Sep 17 00:00:00 2001 From: Joao Andre Date: Thu, 15 Aug 2024 22:14:54 -0300 Subject: [PATCH] feat: add back setup.py to enable custom package builds --- .../build-and-release-single-package.yml | 12 +--- .github/workflows/build-and-release.yml | 20 +++--- .github/workflows/packaging.yml | 29 +------- pyproject.toml | 32 ++------- setup.py | 63 ++++++++++++++++ taipy/config/pyproject.toml | 38 +++------- taipy/config/setup.py | 45 ++++++++++++ taipy/core/pyproject.toml | 55 +++++--------- taipy/core/setup.py | 59 +++++++++++++++ taipy/gui/pyproject.toml | 51 +++++-------- taipy/gui/setup.py | 71 +++++++++++++++++++ taipy/rest/pyproject.toml | 33 +++------ taipy/rest/setup.py | 46 ++++++++++++ taipy/templates/pyproject.toml | 34 ++------- taipy/templates/setup.py | 34 +++++++++ tools/packages/taipy-config/setup.py | 43 +---------- tools/packages/taipy-core/setup.py | 41 +---------- tools/packages/taipy-gui/setup.py | 43 +---------- tools/packages/taipy-rest/setup.py | 37 +--------- tools/packages/taipy-templates/setup.py | 39 +--------- tools/packages/taipy/setup.py | 68 +++--------------- 21 files changed, 419 insertions(+), 474 deletions(-) create mode 100644 setup.py create mode 100644 taipy/config/setup.py create mode 100644 taipy/core/setup.py create mode 100644 taipy/gui/setup.py create mode 100644 taipy/rest/setup.py create mode 100644 taipy/templates/setup.py diff --git a/.github/workflows/build-and-release-single-package.yml b/.github/workflows/build-and-release-single-package.yml index 29afd317ff..6ca621ff92 100644 --- a/.github/workflows/build-and-release-single-package.yml +++ b/.github/workflows/build-and-release-single-package.yml @@ -51,6 +51,8 @@ jobs: ${{ github.event.inputs.target_package }} >> $GITHUB_OUTPUT build-and-release-package: + permissions: + contents: write needs: [fetch-versions] timeout-minutes: 20 runs-on: ubuntu-latest @@ -153,18 +155,10 @@ jobs: run: | cp -r taipy/_cli/. ${{ steps.set-variables.outputs.package_dir }}/taipy/_cli - - name: Update pyproject.toml - working-directory: ${{ steps.set-variables.outputs.package_dir }} - run: | - python tools/release/setup_project.py . prod - - name: Build package working-directory: ${{ steps.set-variables.outputs.package_dir }} run: | python -m build - - - name: Rename files - run: | for file in ./dist/*; do mv "$file" "${file//_/-}"; done - name: Create tag and release @@ -181,7 +175,7 @@ jobs: - name: Ensure Taipy release is marked as latest run: | - gh release edit ${{needs.fetch-versions.outputs.taipy_VERSION}} --latest + gh release edit ${{needs.fetch-versions.outputs.taipy_VERSION}} --latest shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 3d8526a74f..93f3a6e5ac 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -44,6 +44,12 @@ jobs: run: | python tools/release/setup_version.py ALL ${{ github.event.inputs.release_type }} ${{ github.event.inputs.target_version }} ${{ steps.extract_branch.outputs.branch }} >> $GITHUB_OUTPUT + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Update version to ${{ steps.version-setup.outputs.NEW_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-and-release-taipy-packages: needs: [fetch-versions] timeout-minutes: 20 @@ -151,11 +157,6 @@ jobs: run: | cp -r taipy/_cli/. ${{ steps.set-variables.outputs.package_dir }}/taipy/_cli - - name: Update pyproject.toml - working-directory: ${{ steps.set-variables.outputs.package_dir }} - run: | - python tools/release/setup_project.py . prod - - name: Build package working-directory: ${{ steps.set-variables.outputs.package_dir }} run: | @@ -209,14 +210,13 @@ jobs: python -m pip install --upgrade pip pip install build wheel - - name: Copy files from tools + - name: Backup setup.py run: | - cp -r tools/packages/taipy/. . + mv setup.py setup.old.py - - name: Update pyproject.toml - working-directory: ${{ steps.set-variables.outputs.package_dir }} + - name: Copy files from tools run: | - python tools/release/setup_project.py . prod + cp -r tools/packages/taipy/. . - name: Build Taipy package run: | diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 2556c61ed6..e3226f04f2 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -12,15 +12,12 @@ on: required: false default: "" -env: - NODE_OPTIONS: --max-old-space-size=4096 - jobs: standard-packages: timeout-minutes: 30 strategy: matrix: - python-versions: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-versions: [ '3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-13, windows-latest] runs-on: ${{ matrix.os }} @@ -31,34 +28,14 @@ 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: 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 + - name: Install Taipy without dependencies run: | pip install . - - - name: Remove local folder - run: rm -r taipy - + rm -r taipy - name: Check Taipy Installation run: | python tools/validate_taipy_install.py diff --git a/pyproject.toml b/pyproject.toml index e45eb1081f..c8522494a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,14 +4,13 @@ build-backend = "setuptools.build_meta" [project] name = "taipy" -version = "0.0.0" # will be dynamically set description = "A 360° open-source platform from Python pilots to production-ready web apps." readme = "package_desc.md" requires-python = ">=3.8" license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] keywords = ["taipy"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -21,26 +20,22 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", ] -dependencies = [] # will be dynamically set +dynamic = ["version", "dependencies"] [project.optional-dependencies] -test = ["pytest>=3.8"] ngrok = ["pyngrok>=5.1,<6.0"] image = [ - "python-magic>=0.4.24,<0.5; platform_system!='Windows'", - "python-magic-bin>=0.4.14,<0.5; platform_system=='Windows'" + "python-magic>=0.4.24,<0.5", + "python-magic-bin>=0.4.14,<0.5", ] rdp = ["rdp>=0.8"] arrow = ["pyarrow>=14.0.2,<15.0"] mssql = ["pyodbc>=4"] +[project.scripts] +taipy = "taipy._entrypoint:_entrypoint" + [project.urls] Homepage = "https://www.taipy.io" Documentation = "https://docs.taipy.io" @@ -48,19 +43,6 @@ Source = "https://github.com/Avaiga/taipy" Download = "https://pypi.org/project/taipy/#files" Tracker = "https://github.com/Avaiga/taipy/issues" Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-0.0.0/relnotes/" # version will be dynamically set - -[tool.setuptools.packages.find] -include = ["taipy", "taipy.*"] - -[tool.setuptools.package-data] -"taipy" = ["version.json"] - -[tool.setuptools] -zip-safe = false - -[project.scripts] -taipy = "taipy._entrypoint:_entrypoint" [tool.ruff] exclude = [ diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..2d7d087c5b --- /dev/null +++ b/setup.py @@ -0,0 +1,63 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +import os +import json +import platform +import subprocess +from pathlib import Path +from setuptools import setup, find_packages +from setuptools.command.build_py import build_py + +root_folder = Path(__file__).parent + +# get current version +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}" + +def get_requirements(): + reqs = set() + for pkg in (root_folder / "tools" / "packages").iterdir(): + requirements_file = pkg / "setup.requirements.txt" + if requirements_file.exists(): + reqs.update(requirements_file.read_text("UTF-8").splitlines()) + + return [r for r in reqs if r and not r.startswith("taipy")] + +class NPMInstall(build_py): + def run(self): + subprocess.run( + ["python", "bundle_build.py"], + cwd=root_folder / "tools" / "frontend", + check=True, + shell=platform.system() == "Windows", + ) + build_py.run(self) + +setup( + version=version_string, + install_requires=get_requirements(), + packages=find_packages(include=["taipy", "taipy.*"]), + extras_require={ + "ngrok": ["pyngrok>=5.1,<6.0"], + "image": [ + "python-magic>=0.4.24,<0.5;platform_system!='Windows'", + "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'", + ], + "rdp": ["rdp>=0.8"], + "arrow": ["pyarrow>=14.0.2,<15.0"], + "mssql": ["pyodbc>=4"], + }, + cmdclass={"build_py": NPMInstall}, +) diff --git a/taipy/config/pyproject.toml b/taipy/config/pyproject.toml index a2ef5d8ee8..d086192682 100644 --- a/taipy/config/pyproject.toml +++ b/taipy/config/pyproject.toml @@ -4,14 +4,13 @@ build-backend = "setuptools.build_meta" [project] name = "taipy-config" -version = "0.0.0" # will be dynamically set description = "A Taipy package dedicated to easily configure a Taipy application." readme = "package_desc.md" requires-python = ">=3.8" license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] keywords = ["taipy-config"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -21,38 +20,17 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", -] - -dependencies = [ - "toml>=0.10,<0.11", - "deepdiff>=6.7,<6.8" ] +dynamic = ["version", "dependencies"] [project.optional-dependencies] -test = [ - "pytest>=3.8" -] - -[project.urls] -Homepage = "https://www.taipy.io" -Documentation = "https://docs.taipy.io" -Source = "https://github.com/Avaiga/taipy" -Download = "https://pypi.org/project/taipy/#files" -Tracker = "https://github.com/Avaiga/taipy/issues" -Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-0.0.0/relnotes/" # version will be dynamically set +testing = ["pytest>=3.8"] [tool.setuptools.packages] -find = {where = ["."], include = ["taipy", "taipy.config", "taipy.config.*", "taipy.logger", "taipy.logger.*"]} +find = {include = ["taipy", "taipy.config", "taipy.config.*", "taipy.logger", "taipy.logger.*"]} -[tool.setuptools.package-data] -"version" = ["version.json"] +[project.urls] +homepage = "https://github.com/avaiga/taipy" -[tool.setuptools] -zip-safe = false +[tool.setuptools.data-files] +"version" = ["version.json"] diff --git a/taipy/config/setup.py b/taipy/config/setup.py new file mode 100644 index 0000000000..ae7ff4cc46 --- /dev/null +++ b/taipy/config/setup.py @@ -0,0 +1,45 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +"""The setup script.""" +import json +import os +from setuptools import find_namespace_packages, find_packages, setup + +with open("README.md") as readme_file: + readme = readme_file.read() + +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"): + version_string = f"{version_string}.{vext}" + +requirements = ["toml>=0.10,<0.11", "deepdiff>=6.2,<6.3"] + +test_requirements = ["pytest>=3.8"] + +setup( + version=version_string, + install_requires=requirements, + packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.config", "taipy.config.*", "taipy.logger", "taipy.logger.*"]), + include_package_data=True, + data_files=[('version', ['version.json'])], + tests_require=test_requirements, +) diff --git a/taipy/core/pyproject.toml b/taipy/core/pyproject.toml index c4beab78d8..8bc6d398a9 100644 --- a/taipy/core/pyproject.toml +++ b/taipy/core/pyproject.toml @@ -1,16 +1,16 @@ [build-system] -requires = ["setuptools>=42", "wheel", ] +requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] name = "taipy-core" -version = "0.0.0" # will be dynamically set description = "A Python library to build powerful and customized data-driven back-end applications." readme = "package_desc.md" requires-python = ">=3.8" -keywords = ["taipy-core", ] +license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] +keywords = ["taipy-core"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -20,43 +20,22 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", ] - -dependencies = [] # will be dynamically set - -[project.license] -text = "Apache License 2.0" +dynamic = ["version", "dependencies"] [project.optional-dependencies] -test = ["pytest>=3.8", ] -mssql = ["pyodbc>=4,<4.1", ] -mysql = ["pymysql>1,<1.1", ] -postgresql = ["psycopg2>2.9,<2.10", ] -parquet = ["fastparquet==2022.11.0", "pyarrow>=14.0.2,<15.0", ] -s3 = ["boto3==1.29.1", ] -mongo = ["pymongo[srv]>=4.2.0,<5.0", ] +mssql = ["pyodbc>=4,<4.1"] +mysql = ["pymysql>1,<1.1"] +postgresql = ["psycopg2>2.9,<2.10"] +parquet = ["fastparquet==2022.11.0", "pyarrow>=14.0.2,<15.0"] +s3 = ["boto3==1.29.1"] +mongo = ["pymongo[srv]>=4.2.0,<5.0"] -[project.urls] -Homepage = "https://www.taipy.io" -Documentation = "https://docs.taipy.io" -Source = "https://github.com/Avaiga/taipy" -Download = "https://pypi.org/project/taipy/#files" -Tracker = "https://github.com/Avaiga/taipy/issues" -Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-4.0.0.dev0/relnotes/" +[tool.setuptools.packages] +find = {include = ["taipy", "taipy.core", "taipy.core.*"]} -[tool.setuptools] -zip-safe = false - -[tool.setuptools.package-data] -taipy = ["version.json", ] +[project.urls] +homepage = "https://github.com/avaiga/taipy" -[tool.setuptools.packages.find] -where = [".", ] -include = ["taipy", "taipy.core", "taipy.core.*", ] +[tool.setuptools.data-files] +"version" = ["version.json"] diff --git a/taipy/core/setup.py b/taipy/core/setup.py new file mode 100644 index 0000000000..9cb6213227 --- /dev/null +++ b/taipy/core/setup.py @@ -0,0 +1,59 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +import json +import os +from pathlib import Path +from setuptools import find_namespace_packages, find_packages, setup + +root_folder = Path(__file__).parent + +with open("README.md") as readme_file: + readme = readme_file.read() + +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"): + version_string = f"{version_string}.{vext}" + +def get_requirements(): + reqs = set() + for pkg in (root_folder / "tools" / "packages").iterdir(): + if "taipy-core" not in str(pkg): + continue + requirements_file = pkg / "setup.requirements.txt" + if requirements_file.exists(): + reqs.update(requirements_file.read_text("UTF-8").splitlines()) + + return [r for r in reqs if r and not r.startswith("taipy")] + +test_requirements = ["pytest>=3.8"] + +extras_require = { + "mssql": ["pyodbc>=4,<4.1"], + "mysql": ["pymysql>1,<1.1"], + "postgresql": ["psycopg2>2.9,<2.10"], + "parquet": ["fastparquet==2022.11.0", "pyarrow>=14.0.2,<15.0"], + "s3": ["boto3==1.29.1"], + "mongo": ["pymongo[srv]>=4.2.0,<5.0"], +} + +setup( + version=version_string, + install_requires=get_requirements(), + packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.core", "taipy.core.*"]), + include_package_data=True, + data_files=[('version', ['version.json'])], + tests_require=test_requirements, + extras_require=extras_require, +) diff --git a/taipy/gui/pyproject.toml b/taipy/gui/pyproject.toml index 48557267ab..690fdbddde 100644 --- a/taipy/gui/pyproject.toml +++ b/taipy/gui/pyproject.toml @@ -1,16 +1,16 @@ [build-system] -requires = [ "setuptools>=42", "wheel", "setuptools_scm",] +requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] name = "taipy-gui" -version = "0.0.0" # will be set dynamically description = "Low-code library to create graphical user interfaces on the Web for your Python applications." readme = "package_desc.md" requires-python = ">=3.8" -keywords = [ "taipy-gui",] +license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] +keywords = ["taipy-gui"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -20,39 +20,22 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", ] -dependencies = [] # will be set dynamically - -[project.license] -text = "Apache License 2.0" +dynamic = ["version", "dependencies"] [project.optional-dependencies] -test = [ "pytest>=3.8",] -ngrok = [ "pyngrok>=5.1,<6.0",] -image = [ "python-magic>=0.4.24,<0.5; platform_system!='Windows'", "python-magic-bin>=0.4.14,<0.5; platform_system=='Windows'",] -arrow = [ "pyarrow>=14.0.2,<15.0",] - -[project.urls] -Homepage = "https://www.taipy.io" -Documentation = "https://docs.taipy.io" -Source = "https://github.com/Avaiga/taipy" -Download = "https://pypi.org/project/taipy/#files" -Tracker = "https://github.com/Avaiga/taipy/issues" -Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-0.0.0/relnotes/" # will be set dynamically +ngrok = ["pyngrok>=5.1,<6.0"] +image = [ + "python-magic>=0.4.24,<0.5;platform_system!='Windows'", + "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'", +] +arrow = ["pyarrow>=14.0.2,<15.0"] -[tool.setuptools] -zip-safe = false +[tool.setuptools.packages] +find = {include = ["taipy", "taipy.gui", "taipy.gui.*"]} -[tool.setuptools.package-data] -taipy = [ "version.json",] +[project.urls] +homepage = "https://github.com/avaiga/taipy" -[tool.setuptools.packages.find] -where = [ ".",] -include = [ "taipy", "taipy.gui", "taipy.gui.*",] +[tool.setuptools.data-files] +"version" = ["version.json"] diff --git a/taipy/gui/setup.py b/taipy/gui/setup.py new file mode 100644 index 0000000000..396531af1b --- /dev/null +++ b/taipy/gui/setup.py @@ -0,0 +1,71 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +import json +import os +from pathlib import Path +from setuptools import find_namespace_packages, find_packages, setup +from setuptools.command.build_py import build_py + +root_folder = Path(__file__).parent + +readme = Path("README.md").read_text() + +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"): + version_string = f"{version_string}.{vext}" + +def get_requirements(): + reqs = set() + for pkg in (root_folder / "tools" / "packages").iterdir(): + if "taipy-gui" not in str(pkg): + continue + requirements_file = pkg / "setup.requirements.txt" + if requirements_file.exists(): + reqs.update(requirements_file.read_text("UTF-8").splitlines()) + + return [r for r in reqs if r and not r.startswith("taipy")] + +test_requirements = ["pytest>=3.8"] + +extras_require = { + "ngrok": ["pyngrok>=5.1,<6.0"], + "image": [ + "python-magic>=0.4.24,<0.5;platform_system!='Windows'", + "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'", + ], + "arrow": ["pyarrow>=14.0.2,<15.0"], +} + +def _build_webapp(): + already_exists = Path("./taipy/gui/webapp/index.html").exists() + if not already_exists: + os.system("cd ../../frontend/taipy-gui/dom && npm ci") + os.system("cd ../../frontend/taipy-gui && npm ci --omit=optional && npm run build") + +class NPMInstall(build_py): + def run(self): + _build_webapp() + build_py.run(self) + +setup( + version=version_string, + install_requires=get_requirements(), + packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.gui", "taipy.gui.*"]), + include_package_data=True, + data_files=[("version", ["version.json"])], + tests_require=test_requirements, + extras_require=extras_require, + cmdclass={"build_py": NPMInstall}, +) diff --git a/taipy/rest/pyproject.toml b/taipy/rest/pyproject.toml index 50ca160b0f..d85462ebfd 100644 --- a/taipy/rest/pyproject.toml +++ b/taipy/rest/pyproject.toml @@ -4,14 +4,13 @@ build-backend = "setuptools.build_meta" [project] name = "taipy-rest" -version = "0.0.0" # will be dynamically set description = "Library to expose taipy-core REST APIs." readme = "package_desc.md" requires-python = ">=3.8" license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] keywords = ["taipy-rest"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -21,30 +20,14 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", ] -dependencies = [] # will be dynamically set +dynamic = ["version", "dependencies"] -[project.urls] -Homepage = "https://www.taipy.io" -Documentation = "https://docs.taipy.io" -Source = "https://github.com/Avaiga/taipy" -Download = "https://pypi.org/project/taipy/#files" -Tracker = "https://github.com/Avaiga/taipy/issues" -Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-0.0.0/relnotes/" # version will be dynamically set - -[tool.setuptools.packages.find] -where = ["."] -include = ["taipy", "taipy.rest"] +[tool.setuptools.packages] +find = {include = ["taipy", "taipy.rest"]} -[tool.setuptools.package-data] -"taipy" = ["version.json"] +[project.urls] +homepage = "https://github.com/avaiga/taipy" -[tool.setuptools] -zip-safe = false +[tool.setuptools.data-files] +"version" = ["version.json"] diff --git a/taipy/rest/setup.py b/taipy/rest/setup.py new file mode 100644 index 0000000000..348cdd8344 --- /dev/null +++ b/taipy/rest/setup.py @@ -0,0 +1,46 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +import json +import os +from pathlib import Path +from setuptools import find_namespace_packages, find_packages, setup + +root_folder = Path(__file__).parent + +with open("README.md") as readme_file: + readme = readme_file.read() + +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"): + version_string = f"{version_string}.{vext}" + +def get_requirements(): + reqs = set() + for pkg in (root_folder / "tools" / "packages").iterdir(): + if "taipy-rest" not in str(pkg): + continue + requirements_file = pkg / "setup.requirements.txt" + if requirements_file.exists(): + reqs.update(requirements_file.read_text("UTF-8").splitlines()) + + return [r for r in reqs if r and not r.startswith("taipy")] + +setup( + version=version_string, + packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.rest"]), + include_package_data=True, + data_files=[('version', ['version.json'])], + install_requires=get_requirements(), +) diff --git a/taipy/templates/pyproject.toml b/taipy/templates/pyproject.toml index b1bf428bd0..26f895291b 100644 --- a/taipy/templates/pyproject.toml +++ b/taipy/templates/pyproject.toml @@ -4,14 +4,13 @@ build-backend = "setuptools.build_meta" [project] name = "taipy-templates" -version = "0.0.0" # will be dynamically set description = "An open-source package holding Taipy application templates." readme = "package_desc.md" requires-python = ">=3.8" license = {text = "Apache License 2.0"} +authors = [{name = "Avaiga", email = "dev@taipy.io"}] keywords = ["taipy-templates"] classifiers = [ - "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", @@ -21,33 +20,14 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", ] -dependencies = [] # version will be dynamically set +dynamic = ["version", "dependencies"] -[project.optional-dependencies] -test = ["pytest>=3.8"] +[tool.setuptools.packages] +find = {include = ["taipy"]} [project.urls] -Homepage = "https://www.taipy.io" -Documentation = "https://docs.taipy.io" -Source = "https://github.com/Avaiga/taipy" -Download = "https://pypi.org/project/taipy/#files" -Tracker = "https://github.com/Avaiga/taipy/issues" -Security = "https://github.com/Avaiga/taipy?tab=security-ov-file#readme" -"Release notes" = "https://docs.taipy.io/en/release-0.0.0/relnotes/" # version will be dynamically set +homepage = "https://github.com/avaiga/taipy" -[tool.setuptools.packages.find] -where = ["."] -include = ["taipy"] - -[tool.setuptools.package-data] -"taipy" = ["version.json"] - -[tool.setuptools] -zip-safe = false +[tool.setuptools.data-files] +"version" = ["version.json"] diff --git a/taipy/templates/setup.py b/taipy/templates/setup.py new file mode 100644 index 0000000000..d29e9922b9 --- /dev/null +++ b/taipy/templates/setup.py @@ -0,0 +1,34 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +import json +import os +from setuptools import find_namespace_packages, find_packages, setup + +with open("README.md", "rb") as readme_file: + readme = readme_file.read().decode("UTF-8") + +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"): + version_string = f"{version_string}.{vext}" + +test_requirements = ["pytest>=3.8"] + +setup( + packages=find_namespace_packages(where=".") + find_packages(include=["taipy"]), + include_package_data=True, + data_files=[('version', ['version.json'])], + test_suite="tests", + version=version_string, +) diff --git a/tools/packages/taipy-config/setup.py b/tools/packages/taipy-config/setup.py index b638032ef9..7a5f663715 100644 --- a/tools/packages/taipy-config/setup.py +++ b/tools/packages/taipy-config/setup.py @@ -35,51 +35,14 @@ test_requirements = ["pytest>=3.8"] setup( - author="Avaiga", - author_email="dev@taipy.io", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], - description="A Taipy package dedicated to easily configure a Taipy application.", + version=version_string, install_requires=requirements, - long_description=package_desc, - long_description_content_type="text/markdown", - include_package_data=True, - license="Apache License 2.0", - keywords="taipy-config", - name="taipy-config", packages=find_packages( where=root_folder, include=[ "taipy", "taipy.config", "taipy.config.*", "taipy.logger", "taipy.logger.*", "taipy._cli", "taipy._cli.*" ] ), - test_suite="tests", + include_package_data=True, + data_files=[('version', ['version.json'])], tests_require=test_requirements, - version=version_string, - zip_safe=False, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, ) diff --git a/tools/packages/taipy-core/setup.py b/tools/packages/taipy-core/setup.py index 16a9f60b62..0aebe216a7 100644 --- a/tools/packages/taipy-core/setup.py +++ b/tools/packages/taipy-core/setup.py @@ -42,48 +42,11 @@ } setup( - author="Avaiga", - author_email="dev@taipy.io", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], - description="A Python library to build powerful and customized data-driven back-end applications.", + version=version_string, install_requires=requirements, - long_description=package_desc, - long_description_content_type="text/markdown", - license="Apache License 2.0", - keywords="taipy-core", - name="taipy-core", packages=find_packages(where=root_folder, include=["taipy", "taipy.core", "taipy.core.*"]), include_package_data=True, - test_suite="tests", + data_files=[('version', ['version.json'])], tests_require=test_requirements, - version=version_string, - zip_safe=False, extras_require=extras_require, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, ) diff --git a/tools/packages/taipy-gui/setup.py b/tools/packages/taipy-gui/setup.py index 39a7649f9b..cf62ba4880 100644 --- a/tools/packages/taipy-gui/setup.py +++ b/tools/packages/taipy-gui/setup.py @@ -72,49 +72,12 @@ def run(self): setup( - author="Avaiga", - author_email="dev@taipy.io", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], - description="Low-code library to create graphical user interfaces on the Web for your Python applications.", - long_description=package_desc, - long_description_content_type="text/markdown", + version=version_string, install_requires=requirements, - license="Apache License 2.0", - include_package_data=True, - keywords="taipy-gui", - name="taipy-gui", packages=find_packages(where=root_folder, include=["taipy", "taipy.gui", "taipy.gui.*"]), - test_suite="tests", + include_package_data=True, + data_files=[("version", ["version.json"])], tests_require=test_requirements, - version=version_string, - zip_safe=False, extras_require=extras_require, cmdclass={"build_py": NPMInstall}, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, ) diff --git a/tools/packages/taipy-rest/setup.py b/tools/packages/taipy-rest/setup.py index f48fb5d63f..393f39c531 100644 --- a/tools/packages/taipy-rest/setup.py +++ b/tools/packages/taipy-rest/setup.py @@ -33,44 +33,9 @@ requirements = [r for r in (setup_requirements).read_text("UTF-8").splitlines() if r] setup( - author="Avaiga", - name="taipy-rest", - keywords="taipy-rest", - python_requires=">=3.8", version=version_string, - author_email="dev@taipy.io", packages=find_packages(where=root_folder, include=["taipy", "taipy.rest", "taipy.rest.*"]), include_package_data=True, - long_description=package_desc, - long_description_content_type="text/markdown", - description="Library to expose taipy-core REST APIs.", - license="Apache License 2.0", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], + data_files=[('version', ['version.json'])], install_requires=requirements, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, ) diff --git a/tools/packages/taipy-templates/setup.py b/tools/packages/taipy-templates/setup.py index 75f72d447f..39201b02e4 100644 --- a/tools/packages/taipy-templates/setup.py +++ b/tools/packages/taipy-templates/setup.py @@ -35,46 +35,9 @@ test_requirements = ["pytest>=3.8"] setup( - author="Avaiga", - author_email="dev@taipy.io", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], - description="An open-source package holding Taipy application templates.", - license="Apache License 2.0", - long_description=package_desc, - long_description_content_type="text/markdown", - keywords="taipy-templates", - name="taipy-templates", - install_requires=requirements, packages=find_packages(where=root_folder, include=["taipy"]), include_package_data=True, + data_files=[('version', ['version.json'])], test_suite="tests", version=version_string, - zip_safe=False, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, ) diff --git a/tools/packages/taipy/setup.py b/tools/packages/taipy/setup.py index e160b57535..12e0461bfd 100644 --- a/tools/packages/taipy/setup.py +++ b/tools/packages/taipy/setup.py @@ -33,17 +33,6 @@ test_requirements = ["pytest>=3.8"] -extras_require = { - "ngrok": ["pyngrok>=5.1,<6.0"], - "image": [ - "python-magic>=0.4.24,<0.5;platform_system!='Windows'", - "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'", - ], - "rdp": ["rdp>=0.8"], - "arrow": ["pyarrow>=14.0.2,<15.0"], - "mssql": ["pyodbc>=4"], -} - class NPMInstall(build_py): def run(self): @@ -57,53 +46,18 @@ def run(self): setup( - author="Avaiga", - author_email="dev@taipy.io", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - ], - description="A 360° open-source platform from Python pilots to production-ready web apps.", + version=version_string, install_requires=requirements, - entry_points={ - "console_scripts": [ - "taipy = taipy._entrypoint:_entrypoint", - ] + packages=find_packages(include=["taipy", "taipy.*"]), + extras_require={ + "ngrok": ["pyngrok>=5.1,<6.0"], + "image": [ + "python-magic>=0.4.24,<0.5;platform_system!='Windows'", + "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'", + ], + "rdp": ["rdp>=0.8"], + "arrow": ["pyarrow>=14.0.2,<15.0"], + "mssql": ["pyodbc>=4"], }, - license="Apache License 2.0", - long_description=package_desc, - long_description_content_type="text/markdown", - keywords="taipy", - name="taipy", - packages=find_packages(include=["taipy", "taipy._cli", "taipy._cli.*", "taipy.gui_core"]), - include_package_data=True, - test_suite="tests", - version=version_string, - zip_safe=False, - extras_require=extras_require, cmdclass={"build_py": NPMInstall}, - project_urls={ - "Homepage": "https://www.taipy.io", - "Documentation": "https://docs.taipy.io", - "Source": "https://github.com/Avaiga/taipy", - "Download": "https://pypi.org/project/taipy/#files", - "Tracker": "https://github.com/Avaiga/taipy/issues", - "Security": "https://github.com/Avaiga/taipy?tab=security-ov-file#readme", - f"Release notes": "https://docs.taipy.io/en/release-{version_string}/relnotes/", - }, )