From 78c71ab8b4b7078503fec159005a591b1afe76f2 Mon Sep 17 00:00:00 2001 From: Niels Geens Date: Tue, 1 Apr 2025 15:26:50 +0000 Subject: [PATCH] Improved install experience --- pyproject.toml | 31 ++++++++++++++++++++++++++++++ scripts/add_to_environment.sh | 29 +++++++++++++--------------- scripts/install.sh | 6 +++--- setup.py | 36 ----------------------------------- 4 files changed, 47 insertions(+), 55 deletions(-) create mode 100644 pyproject.toml mode change 100644 => 100755 scripts/add_to_environment.sh delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d83c899 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools>=78", "wheel>=0.45.0", "packaging>=24.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "sia" +version = "0.1.0" +requires-python = ">=3.10" +dependencies = [ + "accelerate>=0.26.0", + "aiohttp>=3.8.0", + "bitsandbytes>=0.41.0", + "dotenv-python>=0.0.1", + "flash-attn>=2.0.0", + "huggingface_hub>=0.16.0", + "lxml>=4.9.0", + "mistral-common>=1.0.0", + "mistralai>=0.0.7", + "openai>=1.0.0", + "psutil>=5.9.0", + "python-dotenv>=1.0.0", + "tiktoken>=0.4.0", + "torch>=2.0.0", + "transformers>=4.30.0" +] + +[project.scripts] +sia = "sia.__main__:main" + +[tool.setuptools] +packages = ["sia"] \ No newline at end of file diff --git a/scripts/add_to_environment.sh b/scripts/add_to_environment.sh old mode 100644 new mode 100755 index 81bd81a..0d928b1 --- a/scripts/add_to_environment.sh +++ b/scripts/add_to_environment.sh @@ -1,18 +1,15 @@ #!/bin/bash - -add_to_environment() { - local path="$1" - # Check if the path is already in the environment file - if ! grep -q "$path" /etc/environment; then - # Get current PATH from environment file - current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2) - - if [ -z "$current_path" ]; then - # If PATH doesn't exist in the file, create it - echo "PATH=\"\$PATH:$path\"" >> /etc/environment - else - # Replace existing PATH line with updated one - sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment - fi +local path="$1" +# Check if the path is already in the environment file +if ! grep -q "$path" /etc/environment; then + # Get current PATH from environment file + current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2) + + if [ -z "$current_path" ]; then + # If PATH doesn't exist in the file, create it + echo "PATH=\"\$PATH:$path\"" >> /etc/environment + else + # Replace existing PATH line with updated one + sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment fi -} \ No newline at end of file +fi \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 53630a6..5b1e628 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3,15 +3,15 @@ echo "Installing ITB tool..." python3 -m venv "/root/venvs/itb" /root/venvs/itb/bin/pip install -e /root/sia/tools/itb/ -/root/sia/scripts/add_to_environment "/root/venvs/itb/bin" +/root/sia/scripts/add_to_environment.sh "/root/venvs/itb/bin" echo "Installing Train tool..." python3 -m venv "/root/venvs/train" /root/venvs/train/bin/pip install -e /root/sia/tools/train/ /root/venvs/train/bin/ipython kernel install --name=train -/root/sia/scripts/add_to_environment "/root/venvs/train/bin" +/root/sia/scripts/add_to_environment.sh "/root/venvs/train/bin" echo "Installing SIA core..." python3 -m venv "/root/venvs/sia" /root/venvs/sia/bin/pip install -e /root/sia/ -/root/sia/scripts/add_to_environment "/root/venvs/sia/bin" \ No newline at end of file +/root/sia/scripts/add_to_environment.sh "/root/venvs/sia/bin" \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 0efb7d7..0000000 --- a/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name="sia", - version="0.1.0", - packages=find_packages(), - install_requires=[ - 'accelerate>=0.26.0', - 'aiohttp>=3.8.0', - 'bitsandbytes>=0.41.0', - 'dotenv-python>=0.0.1', - 'flash-attn>=2.0.0', - 'huggingface_hub>=0.16.0', - 'lxml>=4.9.0', - 'mistral-common>=1.0.0', - 'mistralai>=0.0.7', - 'openai>=1.0.0', - 'psutil>=5.9.0', - 'python-dotenv>=1.0.0', - 'tiktoken>=0.4.0', - 'torch>=2.0.0', - 'transformers>=4.30.0' - ], - entry_points={ - 'console_scripts': [ - 'sia=sia.__main__:main', - ], - }, - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', - ], - python_requires='>=3.10', -) \ No newline at end of file