Created
June 7, 2025 00:01
-
-
Save SWORDIntel/ff2d0bf845ef6e91ac101407bb4e6d0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to set up an all-purpose C and Python development environment on Debian-based systems (e.g., Ubuntu). | |
# This script installs essential compilers, build tools, debuggers, and libraries for both languages. | |
echo "π Starting all-purpose C and Python development environment setup..." | |
# ------------------------------------------------------------------------------ | |
# SECTION 1: SYSTEM UPDATE | |
# ------------------------------------------------------------------------------ | |
echo "Updating package lists..." | |
sudo apt-get update | |
if [ $? -ne 0 ]; then | |
echo "β Failed to update package lists. Please check your network connection and APT sources." | |
exit 1 | |
fi | |
# ------------------------------------------------------------------------------ | |
# SECTION 2: CORE & C DEVELOPMENT TOOLS | |
# ------------------------------------------------------------------------------ | |
echo "π οΈ Installing core build tools and C development environment..." | |
# build-essential: Includes gcc, g++, make for C/C++ compilation. | |
# gdb & valgrind: Essential for debugging and memory analysis in C. | |
# manpages-dev: Provides offline documentation for C library functions. | |
sudo apt-get install -y build-essential cmake meson git pkg-config gdb valgrind clang manpages-dev | |
if [ $? -ne 0 ]; then | |
echo "β Failed to install essential C development tools. Please check your system and try again." | |
exit 1 | |
fi | |
# ------------------------------------------------------------------------------ | |
# SECTION 3: PYTHON DEVELOPMENT ENVIRONMENT | |
# ------------------------------------------------------------------------------ | |
echo "π Installing Python core, venv, and required build libraries..." | |
# python3-venv: Crucial for creating isolated project environments. | |
# Other libraries (libssl-dev, etc.): Needed by pip to build Python packages with C extensions. | |
sudo apt-get install -y python3 python3-pip python3-venv libssl-dev zlib1g-dev \ | |
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \ | |
xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ | |
libatlas-base-dev gfortran | |
if [ $? -ne 0 ]; then | |
echo "β Failed to install Python dependencies. Some Python packages may fail to install via pip." | |
exit 1 | |
fi | |
# ------------------------------------------------------------------------------ | |
# SECTION 4: PROJECT SETUP GUIDES (PYTHON FOCUS) | |
# ------------------------------------------------------------------------------ | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install textual rich numpy pandas matplotlib scikit-learn jupyterlab tensorflow torch black flake8 pytest ipython | |
pip install -r requirements.txt | |
deactivate | |
echo "---------------------------------------------------------------------" | |
echo "β Core environment setup is complete." | |
echo "π The following are instructions and best practices for starting a new Python project." | |
echo "---------------------------------------------------------------------" | |
: <<'COMMENT' | |
### HOW TO IMPORT/MERGE ANOTHER GIT REPOSITORY ### | |
To merge features, code, or history from another repository ("feature-repo") into your main project. | |
1. Add the other repository as a "remote": | |
git remote add feature-repo https://github.com/example/feature-repo.git | |
2. Fetch the data from the new remote: | |
git fetch feature-repo | |
3. Merge the desired branch, allowing for unrelated histories if necessary: | |
git merge feature-repo/main --allow-unrelated-histories | |
4. Resolve any merge conflicts, then add and commit the changes to finalize. | |
git add . | |
git commit -m "feat: Merge feature-repo into the main project" | |
COMMENT | |
# ------------------------------------------------------------------------------ | |
# FINAL VERIFICATION | |
# ------------------------------------------------------------------------------ | |
echo "Please verify the versions of key tools to ensure they were installed correctly:" | |
echo " GCC: Run 'gcc --version'" | |
echo " GDB: Run 'gdb --version'" | |
echo " Python: Run 'python3 --version'" | |
echo " pip: Run 'pip3 --version'" | |
echo " Git: Run 'git --version'" | |
echo "---------------------------------------------------------------------" | |
echo "π All-purpose development environment setup script finished successfully!" | |
echo "You are now ready for both C and Python development." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment