Skip to content

Commit 1d44b8c

Browse files
authored
[BUILD] Update setup info for pypi (#163)
* [BUILD] Update setup info for pypi * [BUILD] Uninstall triton when buiding flagtree locally
1 parent 3b9bbff commit 1d44b8c

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

python/setup.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ def add_links():
524524
class plugin_install(install):
525525

526526
def run(self):
527+
helper.uninstall_triton()
527528
add_links()
528529
install.run(self)
529530
helper.post_install()
@@ -532,6 +533,7 @@ def run(self):
532533
class plugin_develop(develop):
533534

534535
def run(self):
536+
helper.uninstall_triton()
535537
add_links()
536538
develop.run(self)
537539
helper.post_install()
@@ -624,13 +626,19 @@ def get_install_requires():
624626
packages, package_dir, package_data = helper.configure_cambricon_packages_and_data(
625627
packages, package_dir, package_data)
626628

629+
readme_path = os.path.join(get_base_dir(), "README.md")
630+
with open(readme_path, "r", encoding="utf-8") as fh:
631+
long_description = fh.read()
632+
627633
setup(
628-
name=os.environ.get("TRITON_WHEEL_NAME", "triton"),
629-
version="3.1.0" + os.environ.get("TRITON_WHEEL_VERSION_SUFFIX", ""),
630-
author="Philippe Tillet",
631-
author_email="[email protected]",
632-
description="A language and compiler for custom Deep Learning operations",
633-
long_description="",
634+
name=os.environ.get("FLAGTREE_WHEEL_NAME", "flagtree"),
635+
version="0.3.0" + os.environ.get("FLAGTREE_WHEEL_VERSION_SUFFIX", ""),
636+
author="FlagOS",
637+
author_email="[email protected]",
638+
description=
639+
"A unified compiler supporting multiple AI chip backends for custom Deep Learning operations, which is forked from triton-lang/triton.",
640+
long_description=long_description,
641+
long_description_content_type="text/markdown",
634642
packages=packages,
635643
package_dir=package_dir,
636644
entry_points=get_entry_points(),

python/setup_tools/setup_helper.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,24 @@ def check_env(env_val):
360360
return os.environ.get(env_val, '') != ''
361361

362362

363+
def uninstall_triton():
364+
is_bdist_wheel = any(cmd in sys.argv for cmd in ['bdist_wheel', 'egg_info', 'sdist'])
365+
if is_bdist_wheel:
366+
return
367+
try:
368+
import pkg_resources
369+
import subprocess
370+
try:
371+
pkg_resources.get_distribution('triton')
372+
print("Detected existing 'triton' package. Uninstalling to avoid conflicts...")
373+
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "-y", "triton"])
374+
print("Successfully uninstalled 'triton'.")
375+
except pkg_resources.DistributionNotFound:
376+
print("'triton' package not found, no need to uninstall.")
377+
except Exception as e:
378+
print(f"Warning: Failed to check/uninstall triton: {e}")
379+
380+
363381
offline_handler = utils.OfflineBuildManager()
364382
if offline_handler.is_offline:
365383
print("[INFO] Offline Build: Use offline build for triton origin toolkits")

0 commit comments

Comments
 (0)