-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sh
More file actions
102 lines (84 loc) · 2.86 KB
/
build.sh
File metadata and controls
102 lines (84 loc) · 2.86 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# pysera Build Script
# This script helps build and distribute the pysera library
set -e # Exit on any error
echo "🚀 pysera Build Script"
echo "====================="
# Function to print colored output
print_step() {
echo -e "\n📋 $1"
}
print_success() {
echo -e "✅ $1"
}
print_error() {
echo -e "❌ $1"
}
# Check if we're in the right directory
if [ ! -f "setup.py" ] || [ ! -f "pyproject.toml" ]; then
print_error "Error: setup.py or pyproject.toml not found. Run this from the pysera root directory."
exit 1
fi
# Check Python version
print_step "Checking Python version..."
python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
echo "Python version: $python_version"
if python -c "import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)"; then
print_success "Python version is compatible (3.10+)"
else
print_error "Python 3.10+ required. Current version: $python_version"
exit 1
fi
# Clean previous builds
print_step "Cleaning previous builds..."
rm -rf build/ dist/ *.egg-info/
print_success "Cleaned build directories"
# Install build dependencies
print_step "Installing build dependencies..."
python -m pip install --upgrade pip setuptools wheel build twine
print_success "Build dependencies installed"
# Build source distribution
print_step "Building source distribution..."
python -m build --sdist
print_success "Source distribution built"
# Build wheel distribution
print_step "Building wheel distribution..."
python -m build --wheel
print_success "Wheel distribution built"
# List built files
print_step "Built files:"
ls -la dist/
# Verify the built packages
print_step "Verifying built packages..."
python -m twine check dist/*
print_success "Package verification passed"
# Optional: Install in development mode for testing
if [ "$1" = "--install" ]; then
print_step "Installing in development mode..."
python -m pip install -e .
print_success "Development installation completed"
# Test the installation
print_step "Testing installation..."
python -c "import pysera; print(f'✓ pysera {pysera.__version__} imported successfully')"
print_success "Installation test passed"
fi
echo ""
echo "🎉 Build completed successfully!"
echo ""
echo "📦 Distribution files are in the 'dist/' directory:"
echo " - Source distribution (.tar.gz)"
echo " - Wheel distribution (.whl)"
echo ""
echo "🚀 To install the built package:"
echo " pip install dist/pysera-*.whl"
echo ""
echo "📤 To upload to PyPI (when ready):"
echo " python -m twine upload dist/*"
echo ""
echo "🔍 To install in development mode:"
echo " pip install -e ."
echo ""
echo "📚 Next steps:"
echo " 1. Test the package: python -c 'import pysera; print(pysera.__version__)'"
echo " 2. Run examples: cd examples && python basic_usage.py"
echo " 3. Read documentation: cat README.md"