Welcome to TabPFN Extensions! This repository is a collection of community-contributed packages that extend and enhance TabPFN, a foundation model for tabular data. We welcome all contributions and aim to make the process as simple as possible.
Before developing a feature / opening a PR, please open a GitHub issue and describe the bug or feature request. This allows us to discuss the proposal and helps avoid unnecessary work.
-
Setup your development environment:
We use uv to manage the project's environment, so install that first. Then, run the following:
# Clone the repository
git clone https://github.com/PriorLabs/tabpfn-extensions.git
cd tabpfn-extensions
# Install a lightweight environment for extension development
uv sync # Only installs base requirements
# OR full install with all dependencies (may take longer)
uv sync --all-extras
# Activate the environment
source .venv/bin/activate # On Windows: venv\Scripts\activate- Create your extension package:
mkdir -p src/tabpfn_extensions/your_package examples/your_package tests/-
Start coding:
- Implement your extension in
src/tabpfn_extensions/your_package/ - Create examples in
examples/your_package/ - Write tests in
tests/test_your_package.py
- Implement your extension in
-
Test your code:
# Quick test run for your package only
FAST_TEST_MODE=1 pytest tests/test_your_package.py -v
# Even faster test with debug mode (smaller datasets)
TABPFN_DEBUG=1 FAST_TEST_MODE=1 pytest tests/test_your_package.py -v
# Full test of your package (before submitting PR)
pytest tests/test_your_package.py -v
# Run all tests (optional, CI will do this anyway)
pytestTabPFN Extensions supports two different TabPFN implementations:
- TabPFN Package - Full PyTorch implementation for local inference
- TabPFN Client - Lightweight API client for cloud-based inference
To ensure your extension works with both backends:
- Import TabPFN in a flexible way:
try:
# Try standard TabPFN package first
from tabpfn import TabPFNClassifier, TabPFNRegressor
except ImportError:
# Fall back to TabPFN client
from tabpfn_client import TabPFNClassifier, TabPFNRegressor-
Use common parameters that are available in both implementations.
-
Add appropriate test markers in your tests:
client_compatibleif your extension works with TabPFN clientlocal_compatibleif it requires the full TabPFN package
TabPFN Extensions uses a modular structure where each contribution lives in its own subpackage:
tabpfn-extensions/
├── src/
│ └── tabpfn_extensions/
│ └── your_package/ # Your extension code
├── examples/
│ └── your_package/ # Usage examples
└── tests/
└── test_your_package.py # Tests for your extension
- Python 3.9+ compatibility
- Support for both TabPFN and TabPFN-client when possible
- Minimize dependencies and document them in pyproject.toml
- Follow scikit-learn API conventions when appropriate
- Document all public functions and classes
Each extension should include:
- Basic docstrings explaining what functions/classes do
- At least one example script in the examples directory
- Google style format docstrings for key functions
- Type hints for main functions and parameters
- Comments explaining non-obvious code sections
- Write tests using pytest
- For quick test development, use
FAST_TEST_MODE=1 pytest tests/test_your_package.py - Only run long tests (like full dataset tests) when
FAST_TEST_MODEis not set - Use appropriate markers:
client_compatible,local_compatible - Use the fixtures provided in conftest.py for TabPFN instances
- Focus on testing your core functionality first, not edge cases
- Added extension under src/tabpfn_extensions/
- Included at least one example in examples/
- Added required dependencies to pyproject.toml
- Written basic tests that pass with FAST_TEST_MODE=1
- Documented public functions and classes
- Ensured compatibility with both TabPFN backends (when possible)
- All tests pass:
pytest tests/test_your_package.py
- Added type hints for main functions
- Run linting with ruff:
ruff check src/tabpfn_extensions/your_package/ - Run type checking:
mypy src/tabpfn_extensions/your_package/
- Only contribute code you have rights to
- Don't include sensitive or private data
- All contributions must be Apache 2.0 licensed
- No machine learning models or large datasets in the repository
Here's a minimal example of a complete extension:
src/tabpfn_extensions/sample_extension/
├── __init__.py
├── core.py
└── utils.py
examples/sample_extension/
├── basic_usage.py
└── advanced_features.py
tests/
└── test_sample_extension.py
We follow Semantic Versioning, with version numbers in the format MAJOR.MINOR.PATCH:
- MAJOR: Incompatible API changes
- MINOR: New functionality in a backwards compatible manner
- PATCH: Backwards compatible bug fixes
- Join our Discord for questions
- Open an issue for bug reports
- Check out existing extensions for examples