Installation¶
This guide covers installing Pydantic Airtable and setting up your development environment.
Requirements¶
- Python 3.8 or higher
- pip package manager
- An Airtable account with API access
Installation Methods¶
Using pip (Recommended)¶
From requirements.txt¶
Add to your requirements.txt:
Then install:
Development Installation¶
For contributing or local development:
# Clone the repository
git clone https://github.com/pydantic-airtable/pydantic-airtable.git
cd pydantic-airtable
# Install in development mode
pip install -e .
# Install with development dependencies
pip install -r requirements-dev.txt
Dependencies¶
Pydantic Airtable automatically installs these dependencies:
| Package | Version | Purpose |
|---|---|---|
pydantic |
>=2.0.0 | Data validation and serialization |
requests |
>=2.28.0 | HTTP client for Airtable API |
python-dateutil |
>=2.8.0 | Date/time parsing utilities |
python-dotenv |
>=1.0.0 | Environment variable loading |
Verifying Installation¶
After installation, verify everything works:
# Test import
import pydantic_airtable
print(f"✅ Pydantic Airtable v{pydantic_airtable.__version__} installed successfully!")
# Test core components
from pydantic_airtable import (
airtable_model,
configure_from_env,
AirtableConfig,
AirtableFieldType
)
print("✅ All core components imported successfully!")
Run this as a script:
python -c "
import pydantic_airtable
print(f'✅ Pydantic Airtable v{pydantic_airtable.__version__} installed!')
from pydantic_airtable import airtable_model, configure_from_env
print('✅ All components ready!')
"
Getting Airtable Credentials¶
Personal Access Token (PAT)¶
- Go to Airtable Developer Hub
- Click "Create new token"
- Give it a descriptive name (e.g., "pydantic-airtable-dev")
- Select the required scopes:
data.records:read- Read recordsdata.records:write- Create, update, delete recordsschema.bases:read- Read base schemaschema.bases:write- Create tables
- Select the bases you want to access
- Copy your token (starts with
pat_)
Token Security
Never commit your Personal Access Token to version control. Always use environment variables or .env files.
Base ID¶
Find your Base ID in the Airtable URL:
Or from the Airtable API documentation for your base.
Environment Setup¶
Option 1: .env File (Recommended)¶
Create a .env file in your project root:
# Required
AIRTABLE_ACCESS_TOKEN=pat_your_personal_access_token_here
AIRTABLE_BASE_ID=appYourBaseIdHere
# Optional
AIRTABLE_TABLE_NAME=DefaultTableName
Git Ignore
Add .env to your .gitignore file to prevent accidentally committing credentials:
Option 2: Environment Variables¶
Set variables directly in your shell:
Troubleshooting¶
Common Installation Issues¶
ModuleNotFoundError: No module named 'pydantic'
Solution: Ensure you have Pydantic v2 installed:
ImportError: cannot import name 'BaseModel'
Solution: You may have Pydantic v1 installed. Upgrade to v2:
ConfigurationError: Airtable Personal Access Token is required
Solution: Set your environment variables or create a .env file:
Invalid access token format
Solution: Personal Access Tokens must start with pat_. Make sure you're using a PAT, not a legacy API key.
Next Steps¶
Now that you have Pydantic Airtable installed:
- Quick Start - Create your first model and interact with Airtable
- Configuration - Learn about all configuration options
- Examples - See real-world usage examples