setup.py 3.0 KB

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