Huong commited on
Commit ·
6374b15
1
Parent(s): 45d1690
private dependencies install script
Browse files- install_dependencies.py +42 -0
install_dependencies.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Install private dependencies using environment variables.
|
| 4 |
+
This script should be run before the main application starts.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import subprocess
|
| 9 |
+
import sys
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def install_private_repos():
|
| 13 |
+
"""Install private repositories using environment variables."""
|
| 14 |
+
|
| 15 |
+
# Get GitHub token from environment variable
|
| 16 |
+
github_token = os.getenv("GITHUB_TOKEN")
|
| 17 |
+
|
| 18 |
+
if not github_token:
|
| 19 |
+
print("Warning: GITHUB_TOKEN environment variable not found.")
|
| 20 |
+
print("Private repository 'olmoasr' will not be installed.")
|
| 21 |
+
print(
|
| 22 |
+
"Please set GITHUB_TOKEN in your environment or HuggingFace Spaces secrets."
|
| 23 |
+
)
|
| 24 |
+
return False
|
| 25 |
+
|
| 26 |
+
# Install olmoasr from private repository
|
| 27 |
+
repo_url = f"git+https://{github_token}@github.com/huongngo-8/olmoasr.git"
|
| 28 |
+
|
| 29 |
+
try:
|
| 30 |
+
print("Installing olmoasr from private repository...")
|
| 31 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", repo_url])
|
| 32 |
+
print("Successfully installed olmoasr!")
|
| 33 |
+
return True
|
| 34 |
+
|
| 35 |
+
except subprocess.CalledProcessError as e:
|
| 36 |
+
print(f"Error installing olmoasr: {e}")
|
| 37 |
+
print("Please check your GITHUB_TOKEN and repository access.")
|
| 38 |
+
return False
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
install_private_repos()
|