setup.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 os
  14. from pathlib import Path
  15. from setuptools import find_namespace_packages, find_packages, setup
  16. from setuptools.command.build_py import build_py
  17. with open("README.md", "rb") as readme_file:
  18. readme = readme_file.read().decode("UTF-8")
  19. with open(f"src{os.sep}taipy{os.sep}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. requirements = [
  25. "backports.zoneinfo>=0.2.1,<0.3;python_version<'3.9'",
  26. "cookiecutter>=2.1.1,<2.2",
  27. "taipy-gui@git+https://git@github.com/Avaiga/taipy-gui.git@develop",
  28. "taipy-rest@git+https://git@github.com/Avaiga/taipy-rest.git@develop",
  29. "taipy-templates@git+https://git@github.com/Avaiga/taipy-templates.git@develop",
  30. ]
  31. test_requirements = ["pytest>=3.8"]
  32. extras_require = {
  33. "ngrok": ["pyngrok>=5.1,<6.0"],
  34. "image": [
  35. "python-magic>=0.4.24,<0.5;platform_system!='Windows'",
  36. "python-magic-bin>=0.4.14,<0.5;platform_system=='Windows'",
  37. ],
  38. "rdp": ["rdp>=0.8"],
  39. "arrow": ["pyarrow>=10.0.1,<11.0"],
  40. "mssql": ["pyodbc>=4"],
  41. }
  42. def _build_webapp():
  43. already_exists = Path("./src/taipy/gui_core/lib/taipy-gui-core.js").exists()
  44. if not already_exists:
  45. os.system("cd gui && npm ci && npm run build")
  46. class NPMInstall(build_py):
  47. def run(self):
  48. _build_webapp()
  49. build_py.run(self)
  50. setup(
  51. author="Avaiga",
  52. author_email="dev@taipy.io",
  53. python_requires=">=3.8",
  54. classifiers=[
  55. "Intended Audience :: Developers",
  56. "License :: OSI Approved :: Apache Software License",
  57. "Natural Language :: English",
  58. "Programming Language :: Python :: 3",
  59. "Programming Language :: Python :: 3.8",
  60. "Programming Language :: Python :: 3.9",
  61. "Programming Language :: Python :: 3.10",
  62. "Programming Language :: Python :: 3.11",
  63. ],
  64. description="A 360° open-source platform from Python pilots to production-ready web apps.",
  65. install_requires=requirements,
  66. entry_points={
  67. "console_scripts": [
  68. "taipy = taipy._entrypoint:_entrypoint",
  69. ]
  70. },
  71. license="Apache License 2.0",
  72. long_description=readme,
  73. long_description_content_type="text/markdown",
  74. keywords="taipy",
  75. name="taipy",
  76. package_dir={"": "src"},
  77. packages=find_namespace_packages(where="src") + find_packages(include=["taipy"]),
  78. include_package_data=True,
  79. test_suite="tests",
  80. url="https://github.com/avaiga/taipy",
  81. version=version_string,
  82. zip_safe=False,
  83. extras_require=extras_require,
  84. cmdclass={"build_py": NPMInstall},
  85. )