name: Good First Issue
about: A beginner-friendly task perfect for first-time contributors
title: '[GOOD FIRST ISSUE] Refactor AdapterFactory: Move plugin namespace check to a helper function'
labels: 'good first issue'
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
Refactor the AdapterFactory class in src/intugle/adapters/factory.py to move the plugin namespace check logic into a dedicated helper function.
Currently, the __init__ method of AdapterFactory contains an inline check to ensure that plugin names start with "intugle.adapters.types.". For better readability and maintainability, this logic should be extracted into a separate function (e.g., is_safe_plugin_name(plugin_name: str) -> bool).
Why This Matters
- Improves code readability and maintainability
- Makes the plugin safety check reusable and easier to test
- Encourages clean code practices for future contributors
What You'll Learn
- How to refactor Python code for clarity
- How to write and use helper functions
- How to improve code maintainability in a real-world codebase
Step-by-Step Guide
Prerequisites
Setup Instructions
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/data-tools.git
cd data-tools
-
Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
-
Create a new branch
git checkout -b fix/issue-XX-adapterfactory-plugin-helper
Implementation Steps
- In
src/intugle/adapters/factory.py, define a new helper function (e.g., is_safe_plugin_name(plugin_name: str) -> bool) near the top of the file.
- Move the logic that checks if a plugin name starts with
"intugle.adapters.types." into this function.
- Replace the inline check in the
AdapterFactory.__init__ method with a call to this helper function.
- (Optional) Add a simple test for this helper function in the appropriate test file (if tests exist for this module).
- Ensure all existing tests pass.
Files to Modify
- File:
src/intugle/adapters/factory.py
- Change: Extract plugin namespace check into a helper function and use it in
AdapterFactory.__init__
- Line(s): Around the
__init__ method, and top-level for the new function
Testing Your Changes
# Run tests
pytest tests/
# Or run specific test
pytest tests/adapters/test_factory.py
Submitting Your Work
-
Commit your changes
git add .
git commit -m "Refactor: move plugin namespace check to helper function in AdapterFactory"
-
Push to your fork
git push origin fix/issue-XX-adapterfactory-plugin-helper
-
Create a Pull Request
- Go to the original repository
- Click "Pull Requests" → "New Pull Request"
- Select your branch
- Fill out the PR template
- Reference this issue with "Fixes #XX"
Example Code
# Before
for _plugin in plugins:
# Security check: Ensure the plugin is in the correct namespace
if not _plugin.startswith("intugle.adapters.types."):
print(f"Warning: Skipping potentially unsafe plugin '{_plugin}'.")
continue
# After
def is_safe_plugin_name(plugin_name: str) -> bool:
return plugin_name.startswith("intugle.adapters.types.")
for _plugin in plugins:
if not is_safe_plugin_name(_plugin):
print(f"Warning: Skipping potentially unsafe plugin '{_plugin}'.")
continue
Expected Outcome
- The plugin namespace check is now in a helper function.
- The
AdapterFactory code is cleaner and easier to understand.
- All tests pass.
Definition of Done
Resources
Need Help?
Don't hesitate to ask questions! We're here to help you succeed.
Skills You'll Use
Thank you for contributing to Intugle!
Tips for Success:
- Take your time and read through everything carefully
- Don't be afraid to ask questions
- Test your changes before submitting
- Have fun! 🎉
name: Good First Issue
about: A beginner-friendly task perfect for first-time contributors
title: '[GOOD FIRST ISSUE] Refactor AdapterFactory: Move plugin namespace check to a helper function'
labels: 'good first issue'
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
Refactor the
AdapterFactoryclass insrc/intugle/adapters/factory.pyto move the plugin namespace check logic into a dedicated helper function.Currently, the
__init__method ofAdapterFactorycontains an inline check to ensure that plugin names start with"intugle.adapters.types.". For better readability and maintainability, this logic should be extracted into a separate function (e.g.,is_safe_plugin_name(plugin_name: str) -> bool).Why This Matters
What You'll Learn
Step-by-Step Guide
Prerequisites
Setup Instructions
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/data-tools.git cd data-toolsCreate a virtual environment
Install dependencies
pip install -e ".[dev]"Create a new branch
Implementation Steps
src/intugle/adapters/factory.py, define a new helper function (e.g.,is_safe_plugin_name(plugin_name: str) -> bool) near the top of the file."intugle.adapters.types."into this function.AdapterFactory.__init__method with a call to this helper function.Files to Modify
src/intugle/adapters/factory.pyAdapterFactory.__init____init__method, and top-level for the new functionTesting Your Changes
Submitting Your Work
Commit your changes
Push to your fork
Create a Pull Request
Example Code
Expected Outcome
AdapterFactorycode is cleaner and easier to understand.Definition of Done
Resources
Need Help?
Don't hesitate to ask questions! We're here to help you succeed.
Skills You'll Use
Thank you for contributing to Intugle!
Tips for Success: