setup.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. "cookiecutter>=2.1.1,<2.2",
  26. "taipy-gui>=2.4,<2.5",
  27. "taipy-rest>=2.4,<2.5",
  28. "taipy-templates>=2.4,<2.5",
  29. ]
  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. def _build_webapp():
  42. already_exists = Path("./src/taipy/gui_core/lib/taipy-gui-core.js").exists()
  43. if not already_exists:
  44. os.system("cd gui && npm ci && npm run build")
  45. class NPMInstall(build_py):
  46. def run(self):
  47. _build_webapp()
  48. build_py.run(self)
  49. setup(
  50. author="Avaiga",
  51. author_email="dev@taipy.io",
  52. python_requires=">=3.8",
  53. classifiers=[
  54. "Intended Audience :: Developers",
  55. "License :: OSI Approved :: Apache Software License",
  56. "Natural Language :: English",
  57. "Programming Language :: Python :: 3",
  58. "Programming Language :: Python :: 3.8",
  59. "Programming Language :: Python :: 3.9",
  60. "Programming Language :: Python :: 3.10",
  61. "Programming Language :: Python :: 3.11",
  62. ],
  63. description="A 360° open-source platform from Python pilots to production-ready web apps.",
  64. install_requires=requirements,
  65. entry_points={
  66. "console_scripts": [
  67. "taipy = taipy._entrypoint:_entrypoint",
  68. ]
  69. },
  70. license="Apache License 2.0",
  71. long_description=readme,
  72. long_description_content_type="text/markdown",
  73. keywords="taipy",
  74. name="taipy",
  75. package_dir={"": "src"},
  76. packages=find_namespace_packages(where="src") + find_packages(include=["taipy"]),
  77. include_package_data=True,
  78. test_suite="tests",
  79. url="https://github.com/avaiga/taipy",
  80. version=version_string,
  81. zip_safe=False,
  82. extras_require=extras_require,
  83. cmdclass={"build_py": NPMInstall},
  84. )