setup.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 2023 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. """The setup script."""
  12. import json
  13. import subprocess
  14. from pathlib import Path
  15. from setuptools import find_packages, setup
  16. from setuptools.command.build_py import build_py
  17. root_folder = Path(__file__).parent
  18. readme = (root_folder / "README.md").read_text("UTF-8")
  19. with open(root_folder / "taipy" / "version.json") as version_file:
  20. version = json.load(version_file)
  21. version_string = f'{version.get("major", 0)}.{version.get("minor", 0)}.{version.get("patch", 0)}'
  22. if vext := version.get("ext"):
  23. version_string = f"{version_string}.{vext}"
  24. def get_requirements():
  25. # get requirements from the different setups in tools/packages (removing taipy packages)
  26. reqs = set()
  27. for pkg in (root_folder / "tools" / "packages").iterdir():
  28. reqs.update((pkg / "setup.requirements.txt").read_text("UTF-8").splitlines())
  29. return [r for r in reqs if r and not r.startswith("taipy")]
  30. test_requirements = ["pytest>=3.8"]
  31. extras_require = {
  32. "ngrok": ["pyngrok>=5.1,<6.0"],
  33. "image": [
  34. "python-magic>=0.4.24,<0.5;platform_system!='Windows'",
  35. "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'",
  36. ],
  37. "rdp": ["rdp>=0.8"],
  38. "arrow": ["pyarrow>=10.0.1,<11.0"],
  39. "mssql": ["pyodbc>=4"],
  40. }
  41. class NPMInstall(build_py):
  42. def run(self):
  43. subprocess.run(["python", "bundle_build.py"], cwd=root_folder / "tools" / "frontend", check=True, shell=True)
  44. build_py.run(self)
  45. setup(
  46. author="Avaiga",
  47. author_email="dev@taipy.io",
  48. python_requires=">=3.8",
  49. classifiers=[
  50. "Intended Audience :: Developers",
  51. "License :: OSI Approved :: Apache Software License",
  52. "Natural Language :: English",
  53. "Programming Language :: Python :: 3",
  54. "Programming Language :: Python :: 3.8",
  55. "Programming Language :: Python :: 3.9",
  56. "Programming Language :: Python :: 3.10",
  57. "Programming Language :: Python :: 3.11",
  58. ],
  59. description="A 360° open-source platform from Python pilots to production-ready web apps.",
  60. install_requires=get_requirements(),
  61. entry_points={
  62. "console_scripts": [
  63. "taipy = taipy._entrypoint:_entrypoint",
  64. ]
  65. },
  66. license="Apache License 2.0",
  67. long_description=readme,
  68. long_description_content_type="text/markdown",
  69. keywords="taipy",
  70. name="taipy",
  71. packages=find_packages(include=["taipy", "taipy.*"]),
  72. include_package_data=True,
  73. test_suite="tests",
  74. url="https://github.com/avaiga/taipy",
  75. version=version_string,
  76. zip_safe=False,
  77. extras_require=extras_require,
  78. cmdclass={"build_py": NPMInstall},
  79. )