Development Setup - edgeof8/tIRC GitHub Wiki

This guide outlines the steps to set up a local development environment for tIRC, enabling you to contribute to the project, test changes, or run a development version.

Prerequisites

Before you begin, ensure you have the following installed:

  • Python: Version 3.8 or higher. You can download it from python.org.
  • Git: For cloning the repository. You can get Git from git-scm.com.
  • pip: Python package installer, usually included with Python installations.

On Windows, you will also need windows-curses. This is typically handled by installing project dependencies.

Setting Up the Environment

  1. Clone the Repository: First, clone the tIRC repository from GitHub to your local machine:

    git clone https://github.com/edgeof8/tIRC.git
    cd tIRC
    
  2. Create and Activate a Virtual Environment: It's highly recommended to use a virtual environment to manage project dependencies and avoid conflicts with global Python packages.

    Navigate into the cloned `tIRC` directory and run:
    
    ```bash
    python -m venv venv
    ```
    
    This command creates a new directory named `venv` containing the virtual environment.
    
    Next, activate the virtual environment:
    
    - **On Linux/macOS**:
      ```bash
      source venv/bin/activate
      ```
    - **On Windows (Command Prompt/PowerShell)**:
      `bash
    

    venv\Scripts\activate Your command prompt should change to indicate that the virtual environment is active (e.g.,(venv) C:\path\to\tIRC>`).

  3. Install Dependencies: With the virtual environment activated, install the required dependencies, including development tools:

    pip install -r requirements.txt
    

    If a requirements-dev.txt file exists and is mentioned in contribution guidelines (as per the README's "Contributing" section), you might also need to run:

    pip install -r requirements-dev.txt
    

    This will install tIRC's core dependencies and any tools needed for development, such as linters, formatters, or testing frameworks.

  4. Install tIRC in Editable Mode: To make your local changes immediately effective without reinstalling, install tIRC in "editable" mode:

    pip install -e .
    

    The . refers to the current directory (the root of the tIRC project).

Running tIRC from Source

Once set up, you can run your local development version of tIRC from the project's root directory:

python tirc.py

Or, if tirc_core is structured as a runnable module:

python -m tirc_core

Refer to the project's specific instructions if these commands differ.

Code Style and Linting

tIRC follows PEP 8 guidelines. Ensure your contributions adhere to this standard. The project may use linters and formatters (like Flake8, Black, or Pylint). Check for configuration files (e.g., pyproject.toml, .flake8) and contribution guidelines for specific tools and commands to run them.

Example (if Black and Flake8 are used):

# Format code (example)
black .
# Lint code (example)
flake8 .

Running Tests

tIRC uses pytest for testing, as indicated in the "Contributing" section of the README.md. To run tests:

pytest tests/

Ensure all tests pass before submitting contributions. For UI changes, test in both terminal mode and headless mode (--headless flag).

Next Steps

With your development environment set up, you can now:

  • Explore the codebase.
  • Make changes and test them locally.
  • Work on new features or bug fixes.
  • Refer to the Contributing guide for details on submitting your changes.