Installation Guide For Developers - panuozzo77/StreamingCommunity GitHub Wiki

Developer Installation Guide

This guide details how to set up the StreamingCommunity project for development purposes. While the primary focus is on using PyCharm IDE, the core steps involving Git and Python's virtual environments are applicable to most development setups.

Prerequisites

Before you begin, ensure you have the following installed on your system:

  1. Git: Required for cloning the repository.
  • Verify Installation: Open your terminal or command prompt and run git --version.

  • Installation: Download from git-scm.com.

  1. Python: The project requires Python 3.7 or newer (Python 3.8+ recommended).
  • Verify Installation: Run python --version or python3 --version.

  • Installation: Download from python.org. Make sure to check the option "Add Python to PATH" during installation on Windows.

  1. pip: Python's package installer, usually included with Python.
  • Verify Installation: Run pip --version or python -m pip --version.

1. Getting the Code

First, you need to clone the project repository from GitHub.

  1. Navigate: Open your terminal or command prompt and navigate to the directory where you want to store the project. Let's call this development_workspace.
# Example using Linux/macOS/Git Bash:

mkdir ~/development_workspace

cd ~/development_workspace

  

# Example using Windows Command Prompt:

mkdir %USERPROFILE%\development_workspace

cd %USERPROFILE%\development_workspace
  1. Clone: Clone the repository using either HTTPS (recommended for simplicity) or SSH (if you have SSH keys configured with GitHub).
  • Using HTTPS:
git clone https://github.com/Arrowar/StreamingCommunity.git
  • Using SSH:
git clone [email protected]:Arrowar/StreamingCommunity.git
  1. Enter Project Directory: Move into the newly cloned project folder.
cd StreamingCommunity

All subsequent commands should be run from this StreamingCommunity root directory unless otherwise specified.

2. Setting Up the Virtual Environment

Using a virtual environment is crucial for isolating project dependencies and avoiding conflicts with other Python projects or your global Python installation.

Method A: Using Command Line (Recommended for cross-IDE compatibility)

  1. Create: In the StreamingCommunity root directory, create a virtual environment (commonly named venv).
# Linux/macOS
python3 -m venv venv

# Windows
python -m venv venv

This will create a venv folder within your project directory. This folder should not be committed to Git (ensure .venv or venv/ is in your .gitignore file).

  1. Activate: Activate the virtual environment. The activation command differs between operating systems.
  • Linux/macOS (bash/zsh):
source venv/bin/activate

Your terminal prompt should now be prefixed with (venv).

  • Windows (Command Prompt):
.\venv\Scripts\activate.bat

Your terminal prompt should now be prefixed with (venv).

  • Windows (PowerShell):
.\venv\Scripts\Activate.ps1

(Note: You might need to adjust your PowerShell execution policy: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process)

Your terminal prompt should now be prefixed with (venv).

Important: You need to activate the virtual environment every time you open a new terminal session to work on this project.

Method B: Using PyCharm

PyCharm typically helps manage virtual environments.

  1. Open Project: Open PyCharm and select File > Open..., then navigate to and select the cloned StreamingCommunity folder.

  2. Configure Interpreter:

  • PyCharm might automatically detect the project and suggest creating a virtual environment or configuring an interpreter.

  • If not, go to File > Settings (or PyCharm > Preferences on macOS).

  • Navigate to Project: StreamingCommunity > Python Interpreter.

  • Click the gear icon ⚙️ and select Add....

  • Choose Virtualenv Environment from the left pane.

  • Select New environment (usually the default). Ensure the Location points to a venv folder inside your project directory (e.g., ...\StreamingCommunity\venv).

  • Ensure the Base interpreter points to your installed Python 3.7+ executable.

  • Click OK. PyCharm will create the virtual environment.

  • The PyCharm Terminal (View > Tool Windows > Terminal) should automatically use the activated virtual environment.

3. Installing Dependencies

Once your virtual environment is created and activated, install the required packages.

  1. Install: Run the following command in your terminal (ensure (venv) is visible in your prompt if using the command line method):
pip install -r requirements.txt

This command reads the requirements.txt file and installs all the listed Python packages into your isolated virtual environment.

  1. PyCharm Integration: If you configured the interpreter correctly in PyCharm (Step 2B), PyCharm should detect the requirements.txt file and might offer to install the dependencies for you, or highlight missing imports. Using the pip install -r requirements.txt command in the PyCharm Terminal is the most reliable method.

4. Running the Program

For easier execution during development, you can create a simple script in the project's root directory (StreamingCommunity/) that directly calls the main function using the virtual environment's Python interpreter.

  1. Create the File: In the main StreamingCommunity directory (the same level as your venv folder and the StreamingCommunity package folder), create a new file named run (or run.py if you prefer).

  2. Add Content: Paste the following code into the run file:

# (replace with your actual path): #!/path/to/your/project/StreamingCommunity/venv/bin/python

"""
Development run script for StreamingCommunity.
Ensures the application is run using the project's virtual environment
and executes the main entry point.
"""
from StreamingCommunity.main import main 
main() # Add arguments here if needed, e.g., main(sys.argv[1:])
⚠️ **GitHub.com Fallback** ⚠️