name: Good First Issue
about: A beginner-friendly task perfect for first-time contributors
title: '[GOOD FIRST ISSUE] Refactor: Dynamically Register Adapter Configurations'
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
The DataSetData type in src/intugle/adapters/models.py is currently a hardcoded Union of all supported data configurations (e.g., pd.DataFrame | DuckdbConfig | SnowflakeConfig | DatabricksConfig). This makes the system less extensible, as new adapter configurations need to be manually added to this Union.
This task involves refactoring the AdapterFactory to dynamically register adapter configuration types. Instead of a hardcoded Union, the DataSetData type should be constructed dynamically based on the configurations registered by each adapter. This will make the system more pluggable and easier to extend with new data sources.
Why This Matters
Dynamically registering adapter configurations improves the modularity and extensibility of the Intugle library. It reduces the need for manual updates when new adapters are added and promotes a more robust, plug-and-play architecture. This is crucial for maintaining a scalable and adaptable codebase.
What You'll Learn
- Understanding Python's
typing module and Union types.
- Working with Intugle's
AdapterFactory and adapter registration mechanism.
- Implementing dynamic type construction.
- Improving code extensibility and maintainability.
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 refactor/dynamic-adapter-configs
Implementation Steps
-
Modify AdapterFactory to store config types:
- In
src/intugle/adapters/factory.py, modify the AdapterFactory.register method to also accept and store the DatabricksConfig, DuckdbConfig, SnowflakeConfig (and pd.DataFrame for PandasAdapter) classes themselves, not just the checker and creator functions. You might need a new dictionary to store these config types.
-
Dynamically build DataSetData:
- In
src/intugle/adapters/models.py, remove the hardcoded DataSetData Union.
- Instead, create a function or a mechanism within
AdapterFactory (or a new utility module) that can dynamically construct this Union type by gathering all registered config types.
- This might involve using
typing.Union and types.new_class or similar approaches to create the type dynamically at runtime.
-
Update AdapterFactory.create method:
- Ensure the
create method can still correctly identify the appropriate adapter based on the input data type, now that DataSetData is dynamic.
-
Adjust existing adapters:
- Modify the
register functions in src/intugle/adapters/types/databricks/databricks.py, src/intugle/adapters/types/duckdb/duckdb.py, src/intugle/adapters/types/pandas/pandas.py, and src/intugle/adapters/types/snowflake/snowflake.py to pass their respective configuration classes (e.g., DatabricksConfig, DuckdbConfig, SnowflakeConfig, pd.DataFrame) to the AdapterFactory.register method.
-
Ensure backward compatibility:
- The goal is to make the system more dynamic without breaking existing functionality. All current tests should still pass.
Files to Modify
- File:
src/intugle/adapters/factory.py
- Change: Modify
register method to store config types; add logic to dynamically build DataSetData.
- File:
src/intugle/adapters/models.py
- Change: Remove hardcoded
DataSetData Union; potentially import a dynamic type builder.
- File:
src/intugle/adapters/types/databricks/databricks.py
- Change: Update
register function to pass DatabricksConfig.
- File:
src/intugle/adapters/types/duckdb/duckdb.py
- Change: Update
register function to pass DuckdbConfig.
- File:
src/intugle/adapters/types/pandas/pandas.py
- Change: Update
register function to pass pd.DataFrame (or a wrapper if needed).
- File:
src/intugle/adapters/types/snowflake/snowflake.py
- Change: Update
register function to pass SnowflakeConfig.
Testing Your Changes
-
Run existing unit tests:
Ensure all tests, especially those related to DataSet initialization and adapter creation, still pass.
-
Add a new test case:
- Create a dummy adapter (similar to the SQLite adapter issue) and verify that its configuration type is correctly registered and included in the dynamically built
DataSetData.
Submitting Your Work
-
Commit your changes
git add .
git commit -m "refactor: Dynamically register adapter configurations"
-
Push to your fork
git push origin refactor/dynamic-adapter-configs
-
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 #ISSUE_NUMBER"
Expected Outcome
- The
DataSetData type is dynamically generated based on registered adapters.
- New adapters can be added without manually updating the
DataSetData Union.
- All existing functionality and tests remain intact.
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: Dynamically Register Adapter Configurations'
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
The
DataSetDatatype insrc/intugle/adapters/models.pyis currently a hardcodedUnionof all supported data configurations (e.g.,pd.DataFrame | DuckdbConfig | SnowflakeConfig | DatabricksConfig). This makes the system less extensible, as new adapter configurations need to be manually added to thisUnion.This task involves refactoring the
AdapterFactoryto dynamically register adapter configuration types. Instead of a hardcodedUnion, theDataSetDatatype should be constructed dynamically based on the configurations registered by each adapter. This will make the system more pluggable and easier to extend with new data sources.Why This Matters
Dynamically registering adapter configurations improves the modularity and extensibility of the Intugle library. It reduces the need for manual updates when new adapters are added and promotes a more robust, plug-and-play architecture. This is crucial for maintaining a scalable and adaptable codebase.
What You'll Learn
typingmodule andUniontypes.AdapterFactoryand adapter registration mechanism.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
Modify
AdapterFactoryto store config types:src/intugle/adapters/factory.py, modify theAdapterFactory.registermethod to also accept and store theDatabricksConfig,DuckdbConfig,SnowflakeConfig(andpd.DataFramefor PandasAdapter) classes themselves, not just the checker and creator functions. You might need a new dictionary to store these config types.Dynamically build
DataSetData:src/intugle/adapters/models.py, remove the hardcodedDataSetDataUnion.AdapterFactory(or a new utility module) that can dynamically construct thisUniontype by gathering all registered config types.typing.Unionandtypes.new_classor similar approaches to create the type dynamically at runtime.Update
AdapterFactory.createmethod:createmethod can still correctly identify the appropriate adapter based on the inputdatatype, now thatDataSetDatais dynamic.Adjust existing adapters:
registerfunctions insrc/intugle/adapters/types/databricks/databricks.py,src/intugle/adapters/types/duckdb/duckdb.py,src/intugle/adapters/types/pandas/pandas.py, andsrc/intugle/adapters/types/snowflake/snowflake.pyto pass their respective configuration classes (e.g.,DatabricksConfig,DuckdbConfig,SnowflakeConfig,pd.DataFrame) to theAdapterFactory.registermethod.Ensure backward compatibility:
Files to Modify
src/intugle/adapters/factory.pyregistermethod to store config types; add logic to dynamically buildDataSetData.src/intugle/adapters/models.pyDataSetDataUnion; potentially import a dynamic type builder.src/intugle/adapters/types/databricks/databricks.pyregisterfunction to passDatabricksConfig.src/intugle/adapters/types/duckdb/duckdb.pyregisterfunction to passDuckdbConfig.src/intugle/adapters/types/pandas/pandas.pyregisterfunction to passpd.DataFrame(or a wrapper if needed).src/intugle/adapters/types/snowflake/snowflake.pyregisterfunction to passSnowflakeConfig.Testing Your Changes
Run existing unit tests:
Ensure all tests, especially those related to
DataSetinitialization and adapter creation, still pass.Add a new test case:
DataSetData.Submitting Your Work
Commit your changes
Push to your fork
Create a Pull Request
Expected Outcome
DataSetDatatype is dynamically generated based on registered adapters.DataSetDataUnion.Definition of Done
AdapterFactorymodified to store and dynamically buildDataSetData.DataSetDatainsrc/intugle/adapters/models.pyis no longer hardcoded.registerfunctions updated.Resources
typingmodule documentationNeed Help?
Don't hesitate to ask questions! We're here to help you succeed.
Skills You'll Use
typingThank you for contributing to Intugle!
Tips for Success: