Skip to content

[GOOD FIRST ISSUE] Add public API exports to link_predictor __init__.py #127

@raphael-intugle

Description

@raphael-intugle

name: Good First Issue
about: A beginner-friendly task perfect for first-time contributors
title: '[GOOD FIRST ISSUE] Add public API exports to link_predictor init.py'
labels: 'good first issue, documentation, python'
assignees: ''

Welcome! 👋

This is a beginner-friendly issue perfect for first-time contributors to the Intugle project. We've designed this task to help you get familiar with our codebase while making a meaningful contribution.

Task Description

The link_predictor module's __init__.py file is currently empty, which means users can't easily import the main classes. We need to add proper exports to make the module's public API clear and accessible.

Why This Matters

When a Python module's __init__.py is empty, users must write verbose imports like:

from intugle.link_predictor.predictor import LinkPredictor
from intugle.link_predictor.models import PredictedLink, LinkPredictionResult

By exposing the public API in __init__.py, we enable cleaner imports:

from intugle.link_predictor import LinkPredictor, PredictedLink, LinkPredictionResult

This improves developer experience and makes the module more Pythonic.

What You'll Learn

  • Python module structure and __init__.py purpose
  • Public API design principles
  • How to make code more user-friendly
  • Contributing to an open-source project

Step-by-Step Guide

Prerequisites

  • Python 3.10+ installed
  • Git basics (clone, commit, push, pull request)
  • Read our CONTRIBUTING.md guide

Setup Instructions

  1. Fork and clone the repository

    git clone https://github.com/YOUR_USERNAME/data-tools.git
    cd data-tools
  2. Create a virtual environment

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

    pip install -e ".[dev]"
  4. Create a new branch

    git checkout -b fix/issue-8-link-predictor-init

Implementation Steps

  1. Open the target file

    • Navigate to src/intugle/link_predictor/__init__.py
    • Currently, this file is empty (just blank lines)
  2. Review the module contents

    • Look at src/intugle/link_predictor/predictor.py to see what classes should be exported
    • Look at src/intugle/link_predictor/models.py to see what models should be exported
  3. Add the exports
    Add the following content to __init__.py:

    """
    Link Predictor Module
    
    This module provides functionality for predicting relationships between datasets
    based on column profiling, data type analysis, and LLM-based inference.
    """
    
    from intugle.link_predictor.models import (
        LinkPredictionResult,
        PredictedLink,
    )
    from intugle.link_predictor.predictor import (
        LinkPredictor,
        LinkPredictionSaver,
        NoLinksFoundError,
    )
    
    __all__ = [
        "LinkPredictor",
        "LinkPredictionSaver",
        "PredictedLink",
        "LinkPredictionResult",
        "NoLinksFoundError",
    ]
  4. Verify the imports work
    Test that users can now import cleanly:

    # Create a test file: test_imports.py
    from intugle.link_predictor import LinkPredictor, PredictedLink
    
    print("✅ Imports working correctly!")

Files to Modify

  • File: src/intugle/link_predictor/__init__.py
    • Change: Add public API exports
    • Line(s): Currently empty (lines 1-3)

Testing Your Changes

# Run existing tests to ensure nothing broke
pytest tests/

# Test the imports manually
python -c "from intugle.link_predictor import LinkPredictor; print('✅ Success')"

Submitting Your Work

  1. Commit your changes

    git add src/intugle/link_predictor/__init__.py
    git commit -m "Add public API exports to link_predictor module
    
    - Export LinkPredictor, LinkPredictionSaver, and NoLinksFoundError from predictor
    - Export PredictedLink and LinkPredictionResult from models
    - Add module docstring
    - Define __all__ for explicit public API
    
    Fixes #8"
  2. Push to your fork

    git push origin fix/issue-8-link-predictor-init
  3. Create a Pull Request

    • Go to the original repository
    • Click "Pull Requests" → "New Pull Request"
    • Select your branch
    • Fill out the PR template

Example Code

Before

# Verbose imports required
from intugle.link_predictor.predictor import LinkPredictor
from intugle.link_predictor.models import PredictedLink

After

# Clean, simple imports
from intugle.link_predictor import LinkPredictor, PredictedLink

Expected Outcome

After this change:

  1. Users can import main classes directly from the module
  2. The module has a clear public API defined in __all__
  3. IDE autocomplete works better
  4. The module follows Python best practices

Definition of Done

  • Code changes implemented in __init__.py
  • Module docstring added
  • __all__ list defined
  • Manual import test passes
  • Existing tests still pass
  • Code follows project style guidelines (PEP 8)
  • Pull request submitted with proper reference to this issue

Resources

Need Help?

Don't hesitate to ask questions! We're here to help you succeed.

  • Comment below with your questions
  • Join our Discord for real-time support
  • Tag maintainers: @raphael-intugle for guidance

Skills You'll Use

  • Python basics (imports, modules)
  • Git and GitHub (fork, commit, PR)
  • Code documentation
  • Following coding standards

Estimated Time

This task should take approximately: 15-30 minutes


Thank you for contributing to Intugle!

Tips for Success:

  • Read through the existing code in predictor.py and models.py first
  • Test your changes locally before submitting
  • Make sure your commit message is clear and descriptive
  • Have fun! 🎉

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions