Summary
Change import argilla to import extralit and import argilla-server to import extralit-server across the entire codebase to make the Python SDK namespace coherent with the Extralit brand.
Motivation
Make the Python SDK more coherent by aligning all import statements and package references with the Extralit brand identity. This will:
- Remove confusion between the original Argilla project and Extralit
- Create a consistent developer experience across all components
- Establish clear separation from the upstream Argilla project
- Improve brand recognition and consistency
Proposed Refactor
This is a comprehensive codebase-wide refactor that needs to be executed systematically across multiple components:
1. Package Structure Changes
Current Structure:
extralit/src/argilla/ → Should become extralit/src/extralit/
argilla-server/src/argilla_server/ → Should become extralit-server/src/extralit_server/
Steps:
- Rename the source directory structure:
# In extralit/
mv src/argilla src/extralit
# In argilla-server/
mv src/argilla_server src/extralit_server
2. Python Import Statement Updates
Scope Analysis:
- ~500+ import statements need to be updated across the codebase
- Main patterns to replace:
import argilla → import extralit
from argilla → from extralit
import argilla_server → import extralit_server
from argilla_server → from extralit_server
- Internal relative imports within modules
Files requiring updates:
- All Python files in
extralit/src/
- All Python files in
argilla-server/src/
- All Python files in
argilla-v1/src/
- Test files in both packages
- Example files in
examples/
- Configuration and setup files
3. Configuration File Updates
pyproject.toml files:
extralit/pyproject.toml: Update package name, scripts, and version paths
argilla-server/pyproject.toml: Update package name and CLI scripts
- Update PDM script references and module paths
Docker and Infrastructure:
- Docker compose files in
.devcontainer/
- Dockerfile references
- Database connection strings and environment variables
- GitHub Actions workflows
4. Documentation and Metadata Updates
Files to update:
.github/copilot-instructions.md: Update all references
- README files across all packages
- Issue templates in
.github/ISSUE_TEMPLATE/
- Development container configurations
- Code documentation and docstrings
Recommended Tools and Approach
Phase 1: Automated Search & Replace
Use these tools for bulk replacements:
- ripgrep + sed for Python files:
# Replace import statements
rg -l "import argilla" --type py | xargs sed -i 's/import argilla/import extralit/g'
rg -l "from argilla" --type py | xargs sed -i 's/from argilla/from extralit/g'
rg -l "import argilla_server" --type py | xargs sed -i 's/import argilla_server/import extralit_server/g'
rg -l "from argilla_server" --type py | xargs sed -i 's/from argilla_server/from extralit_server/g'
-
VS Code Global Search & Replace:
- Use regex mode for pattern matching
- Target file types:
*.py,*.toml,*.yaml,*.yml,*.json,*.md
- Patterns:
import argilla([^_]) → import extralit$1
from argilla([^_]) → from extralit$1
argilla_server → extralit_server
-
Python AST-based refactoring tools:
libcst or refactor for more sophisticated Python code transformations
- Can handle complex import scenarios and maintain proper formatting
Phase 2: Manual Verification & Edge Cases
-
String literals and configuration:
- Database URLs:
ARGILLA_DATABASE_URL → EXTRALIT_DATABASE_URL
- Logger names:
logging.getLogger("argilla") → logging.getLogger("extralit")
- Package references in setup scripts
-
Complex import scenarios:
- Conditional imports
- Dynamic imports using
importlib
- String-based module references
Phase 3: Directory Structure Migration
# Create new directory structure
mkdir -p extralit-server/src/extralit_server
mkdir -p extralit/src/extralit
# Move source code (after import updates)
rsync -av argilla-server/src/argilla_server/ extralit-server/src/extralit_server/
rsync -av extralit/src/argilla/ extralit/src/extralit/
# Clean up old directories
rm -rf argilla-server/src/argilla_server
rm -rf extralit/src/argilla
Acceptance Criteria
Functional Requirements:
Quality Assurance:
Development Workflow:
Risk Assessment & Mitigation
High Risk Items:
- Breaking changes for existing users - needs major version bump
- Database migration paths may break if module names are hardcoded
- Third-party integrations expecting
argilla import
- Complex import dependencies between packages
Mitigation Strategies:
- Comprehensive test coverage before and after changes
- Staged rollout: Complete backend first, then frontend, then examples
- Import compatibility layer temporarily during transition
- Detailed migration documentation for users
Implementation Plan
- Week 1: Automated search & replace for Python imports
- Week 1: Update configuration files and build systems
- Week 2: Directory structure migration and path updates
- Week 2: Manual verification and edge case fixes
- Week 3: Testing, documentation, and final validation
- Week 3: Integration testing and deployment verification
Additional Context
This refactor touches the core identity of the codebase. All argilla-specific code was originally forked from argilla-io/argilla repo, though many functions have been heavily overwritten and upgraded. The refactoring will establish Extralit as a distinct project while maintaining all existing functionality.
Related Files:
- Core package configs:
extralit/pyproject.toml, argilla-server/pyproject.toml
- Version files:
extralit/src/argilla/_version.py, argilla-server/src/argilla_server/_version.py
- Main application entry points:
argilla-server/src/argilla_server/_app.py
- Development environment:
.devcontainer/, docker-compose.yaml
Summary
Change
import argillatoimport extralitandimport argilla-servertoimport extralit-serveracross the entire codebase to make the Python SDK namespace coherent with the Extralit brand.Motivation
Make the Python SDK more coherent by aligning all import statements and package references with the Extralit brand identity. This will:
Proposed Refactor
This is a comprehensive codebase-wide refactor that needs to be executed systematically across multiple components:
1. Package Structure Changes
Current Structure:
extralit/src/argilla/→ Should becomeextralit/src/extralit/argilla-server/src/argilla_server/→ Should becomeextralit-server/src/extralit_server/Steps:
2. Python Import Statement Updates
Scope Analysis:
import argilla→import extralitfrom argilla→from extralitimport argilla_server→import extralit_serverfrom argilla_server→from extralit_serverFiles requiring updates:
extralit/src/argilla-server/src/argilla-v1/src/examples/3. Configuration File Updates
pyproject.toml files:
extralit/pyproject.toml: Update package name, scripts, and version pathsargilla-server/pyproject.toml: Update package name and CLI scriptsDocker and Infrastructure:
.devcontainer/4. Documentation and Metadata Updates
Files to update:
.github/copilot-instructions.md: Update all references.github/ISSUE_TEMPLATE/Recommended Tools and Approach
Phase 1: Automated Search & Replace
Use these tools for bulk replacements:
VS Code Global Search & Replace:
*.py,*.toml,*.yaml,*.yml,*.json,*.mdimport argilla([^_])→import extralit$1from argilla([^_])→from extralit$1argilla_server→extralit_serverPython AST-based refactoring tools:
libcstorrefactorfor more sophisticated Python code transformationsPhase 2: Manual Verification & Edge Cases
String literals and configuration:
ARGILLA_DATABASE_URL→EXTRALIT_DATABASE_URLlogging.getLogger("argilla")→logging.getLogger("extralit")Complex import scenarios:
importlibPhase 3: Directory Structure Migration
Acceptance Criteria
Functional Requirements:
extralit/extralit_servernamespacesQuality Assurance:
pdm run test tests/unit/services/test_schemas.py -vDevelopment Workflow:
Risk Assessment & Mitigation
High Risk Items:
argillaimportMitigation Strategies:
Implementation Plan
Additional Context
This refactor touches the core identity of the codebase. All argilla-specific code was originally forked from argilla-io/argilla repo, though many functions have been heavily overwritten and upgraded. The refactoring will establish Extralit as a distinct project while maintaining all existing functionality.
Related Files:
extralit/pyproject.toml,argilla-server/pyproject.tomlextralit/src/argilla/_version.py,argilla-server/src/argilla_server/_version.pyargilla-server/src/argilla_server/_app.py.devcontainer/,docker-compose.yaml