Development Guide

This guide provides information for developers working on the Google SecOps SDK for Python.

Development Environment Setup

Prerequisites

  • Python 3.7 or higher

  • pip (Python package installer)

  • Git

Setting Up Your Environment

  1. Clone the repository:

    git clone https://github.com/google/secops-wrapper.git
    cd secops-wrapper
    
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install development dependencies:

    pip install -e ".[dev]"
    

Testing

Running Tests

We use pytest for testing. To run the tests:

pytest

To run tests with coverage:

pytest --cov=secops

Writing Tests

  • Place tests in the tests/ directory

  • Name test files with the prefix test_

  • Use descriptive test names that explain what is being tested

Code Style

We follow the Google Python Style Guide. To check your code style:

# Run linting
flake8 src/ tests/

# Run type checking
mypy src/

Documentation

Building Documentation

To build the documentation locally:

cd docs
pip install -r requirements.txt
make html

The built documentation will be available in docs/_build/html/.

To serve the documentation locally:

cd docs
make serve

Then open your browser to http://localhost:8000.

Writing Documentation

  • Use Markdown for documentation files

  • Follow the existing documentation structure

  • Include examples where appropriate

  • Document all public APIs with docstrings

Release Process

  1. Update version in pyproject.toml

  2. Update CHANGELOG.md with the new version and changes

  3. Create a new Git tag for the version

  4. Build the distribution packages:

    python -m build
    
  5. Upload to PyPI:

    python -m twine upload dist/*
    

Continuous Integration

We use GitHub Actions for continuous integration. The CI pipeline runs:

  • Linting

  • Type checking

  • Tests on multiple Python versions

  • Documentation building

All pull requests must pass CI checks before they can be merged.