Airlift is a Python-based command-line tool for uploading and merging CSV or JSON data files with attachments to Airtable databases. The project provides an automated solution for data migration and synchronization with Airtable, including support for file attachments via Dropbox integration.
The project follows a modular architecture with clear separation of concerns:
- CLI Interface (
cli.py,cli_args.py) - Command-line argument parsing and main execution flow - Data Processing (
csv_data.py,json_data.py) - File format handling and data validation - Airtable Integration (
airtable_client.py,airtable_upload.py) - API communication and data upload - Dropbox Integration (
dropbox_client.py) - File storage and sharing for attachments - Utilities (
utils.py,utils_exceptions.py) - Helper functions and custom exceptions - Error Handling (
airtable_error_handling.py) - Centralized error management
- User provides CSV/JSON file and Airtable credentials via CLI
- System validates file format and parses data into standardized format
- Airtable schema validation and column mapping
- Optional Dropbox upload for attachment files
- Concurrent data upload to Airtable with progress tracking
- Error handling and logging throughout the process
- CSV files with UTF-8 encoding
- JSON files with array of objects structure
- Automatic column validation and mapping
- Support for duplicate column handling
- Personal access token authentication
- Base and table ID validation
- Automatic column creation (configurable)
- Support for single/multiple select fields
- Column renaming and copying capabilities
- Dropbox integration for file storage
- Multiple attachment column support
- Column mapping for attachment fields
- Automatic file path resolution
- Multi-threaded upload processing
- Configurable worker thread count
- Progress bar with real-time updates
- Comprehensive logging system
- Each major functionality is separated into its own module
- Clear import hierarchy with minimal circular dependencies
- Consistent naming conventions across modules
- Custom exception classes for different error types
- Centralized error handling in CLI layer
- Graceful degradation for non-critical errors
- Comprehensive logging for debugging
- Command-line argument parsing with argparse
- JSON-based configuration for Dropbox tokens
- Environment-agnostic file path handling
- Follow PEP 8 style guidelines
- Use type hints for function parameters and return values
- Implement proper docstrings for public functions
- Use logging instead of print statements
- Use custom exceptions for domain-specific errors
- Implement proper exception chaining
- Provide meaningful error messages to users
- Log detailed error information for debugging
- Unit tests for individual modules
- Integration tests for end-to-end workflows
- Mock external API calls to avoid network dependencies
- Test error conditions and edge cases
pyairtable3.1.1 - Airtable API client with latest 3.x APIsrequests- HTTP client for API callsdropbox12.0.2 - Dropbox API client with latest APIs and explicit OAuth2 scopestqdm- Progress bar implementationicecream- Debug logging utility
poetry2.1.3 - Dependency management and packaging- Python 3.9+ compatibility (matches GitHub Actions workflow)
setuptools80.9.0 - Package installation utilities
- Poetry-based dependency management
- PyInstaller for binary distribution
- Cross-platform build support (Linux, macOS, Windows)
- Homebrew integration for macOS
- Semantic versioning (MAJOR.MINOR.PATCH)
- Automated GitHub releases
- Binary distribution for all platforms
- Changelog maintenance
The project includes a comprehensive ephemeral build system (scripts/local-test-build.sh) that provides:
- Fully ephemeral build environment in
.build/directory - No system-level installations or modifications
- Uses system Python with virtual environments
- GitHub Actions compatible approach
- Cross-platform support
- Professional logging without emojis
- Flexible dependency management options
- Creates virtual environment using system Python 3.9+
- Installs setuptools 80.9.0 (matches GitHub Actions)
- Installs Poetry 2.1.3 in the virtual environment
- Installs project dependencies via Poetry
- Installs PyInstaller separately (not in pyproject.toml)
- Builds application using PyInstaller
- Outputs binary to
test-build/directory
Airlift/
├── .build/ # Ephemeral build environment (gitignored)
│ ├── python/ # Virtual environment
│ ├── venv/ # Poetry virtual environment
│ └── cache/ # Poetry cache
├── test-build/ # Build output (gitignored)
│ ├── airlift # Final executable binary
│ └── build/ # PyInstaller build artifacts
└── scripts/
├── local-test-build.sh # Build script
└── README.md # Detailed usage documentation
# Basic build
./scripts/local-test-build.sh
# Build with dependency updates
./scripts/local-test-build.sh --update-deps
# Update specific packages
./scripts/local-test-build.sh --update requests pytest
# Clean build environment
./scripts/local-test-build.sh --clean
# Show outdated packages
./scripts/local-test-build.sh --show-outdatedThe build script is designed to work seamlessly with GitHub Actions and uses identical versions:
- Python 3.9+ (matches BUILD_PYTHON_VERSION: 3.9)
- Poetry 2.1.3 (matches BUILD_POETRY_VERSION: 2.1.3)
- Setuptools 80.9.0 (matches setuptools==80.9.0)
- PyInstaller latest version (matches CI workflow)
- poetry-plugin-export for requirements.txt generation
- No PyInstaller in pyproject.toml (installed separately)
- Same approach as CI/CD pipeline
- Completely ephemeral and safe
- Consistent with production build process
- RESTful API communication using pyairtable 3.x
- Bearer token authentication
- JSON payload formatting
- Rate limiting consideration
- Error response handling
- Automatic field creation with pyairtable 3.x APIs
- OAuth2 authentication flow with explicit scopes
- Refresh token management
- File upload and sharing
- URL generation for attachments
- Folder structure management
- Latest Dropbox SDK 12.x with enhanced security features
- Secure token storage in JSON files
- OAuth2 flow for Dropbox integration with explicit scopes
- Personal access token for Airtable
- No hardcoded credentials
- UTF-8 encoding for international character support
- File path validation and sanitization
- Error message sanitization
- Secure file upload handling
- Concurrent processing with ThreadPoolExecutor
- Configurable worker thread count
- Progress tracking for large datasets
- Memory-efficient data processing
- Graceful handling of network failures
- Retry logic for transient errors
- Partial upload recovery
- Comprehensive error logging
- Multiple log levels (DEBUG, INFO, WARNING, ERROR)
- File-based logging with configurable paths
- Structured log messages for parsing
- Version information in logs
- Progress bar for user feedback
- Verbose mode for detailed output
- Error categorization and reporting
- Performance timing utilities
- Additional file format support
- Enhanced error recovery mechanisms
- Performance optimizations
- Extended Airtable field type support
- Continued Dropbox SDK updates for improved API compatibility
- Plugin system for custom data processors
- Configuration file support
- Web interface for non-technical users
- API server mode for integration
- Modernized integration patterns with latest SDK features
- Airtable webhook integration
- CI/CD pipeline integration
- Monitoring and alerting systems
- Backup and recovery procedures
- Clear command-line help and documentation
- Intuitive error messages
- Progress indication for long operations
- Comprehensive usage examples
This documentation should be kept in sync with the cursorrule file to ensure consistent development practices and code quality standards across the project.