-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.py
More file actions
executable file
·44 lines (36 loc) · 1.28 KB
/
publish.py
File metadata and controls
executable file
·44 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
"""
Publishing helper script for garde-fou Python package
"""
import subprocess
import sys
import os
from pathlib import Path
def run_command(cmd, check=True):
"""Run a command and return the result"""
print(f"Running: {cmd}")
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if check and result.returncode != 0:
print(f"Error: {result.stderr}")
sys.exit(1)
return result
def main():
# Ensure we're in the python directory
os.chdir(Path(__file__).parent)
print("🔧 Installing build tools...")
run_command("pip install --upgrade build twine")
print("\n🧹 Cleaning previous builds...")
run_command("rm -rf dist/ build/ *.egg-info/", check=False)
print("\n🔨 Building package...")
run_command("python -m build")
print("\n📦 Package built successfully!")
print("Files created:")
for file in Path("dist").glob("*"):
print(f" - {file}")
print("\n🚀 Ready to publish!")
print("\nNext steps:")
print("1. Test upload: python -m twine upload --repository testpypi dist/*")
print("2. Production upload: python -m twine upload dist/*")
print("\nMake sure you have your PyPI API tokens set up!")
if __name__ == "__main__":
main()