Share files with explicit mock vs private control
Project description
🎯 Syft Objects
Discover and use files you can't read. Syft Objects enables federated data science by letting you write code against mock data that runs on real data elsewhere.
Why Syft Objects?
In federated computing, you often need to:
- 🔍 Discover files that exist on other machines
- 📍 Address those files in your code
- 🧪 Test your code locally before running remotely
- 🔐 Control who can see what
Syft Objects solves this by providing a simple mock/private pattern for any file type.
Installation
pip install syft-objects
Quick Start
import syft_objects as so
# Create an object with mock (public) and private versions
analysis = so.create_object(
name="Q4 Sales Analysis",
mock_contents="Revenue up 10% to $2.5M", # What others see
private_contents="Revenue: $2,547,891.23", # What you see
discovery_read=["public"], # Who can discover it
mock_read=["team@customer_company.com"], # Who can see mock
private_read=["cfo@our_company.com"] # Who can see real data
)
# Browse available objects
so.objects # Interactive table with search, filter, and permissions
Core Concepts
1. Every Object Has Two Versions
- Mock: Sample/demo data anyone can code against
- Private: Real data only authorized users can access
2. Permissioned Discovery
# Others can discover your object exists, even if they can't read it
so.objects # Shows objects YOU can discover (not everyone sees the same list)
3. Write Once, Run Anywhere
# Test locally with mock data
netflix_data = so.objects["0b2f982d-6f82-48f3-b32e-3005e186e1cc"]
result = len(netflix_data.mock.obj) # Works with mock
# Same code runs on private data elsewhere
def analyze_netflix_data():
data = pd.read_csv(netflix_data.private.path) # Runs on real data
return len(data)
Common Workflows
Creating Objects from Files
# From existing files
dataset = so.create_object(
name="Customer Dataset",
mock_file="sample_100.csv",
private_file="customers_full.csv"
)
# From folders
model = so.create_object(
name="ML Model",
mock_folder="model_demo/",
private_folder="model_prod/"
)
Finding and Using Objects
# 1. Browse available objects
so.objects
# 2. Search and select (checkbox) objects of interest
# 3. Click "Python" button to copy code
# 4. Paste and use:
results = [so.objects["uid-here"]]
mock_data = results[0].mock.obj
Creating Derivative Objects
# Your analysis creates new syft objects
def my_analysis():
# Load input
input_data = pd.read_csv(input_path)
# Process
result = len(input_data)
# Save as new syft object
so.create_object(
name=f"Row count: {result}",
private_file="result.txt",
mock_file="result_mock.txt",
discovery_read=["researcher@university.edu"]
)
CRUD Operations
Create
obj = so.create_object(name="My Object", mock_contents="demo", private_contents="real")
Read
obj.get_name()
obj.get_permissions()
obj.mock.obj # Access mock data
Update
obj.set_name("Updated Name")
obj.set_permissions(mock_read=["new@user.com"])
Delete
obj.delete_obj()
Web Interface
./run.sh # Starts web UI at http://localhost:8004
Features:
- Search and filter objects
- Drag-and-drop file upload
- Edit permissions
- View/edit mock and private files
How It Works
Syft Objects creates YAML config files that point to mock and private versions of your data:
name: Sales Data
mock_url: syft://user@email.com/public/objects/sales_mock.csv
private_url: syft://user@email.com/private/objects/sales_real.csv
mock_permissions: [public]
private_permissions: [cfo@company.com]
The library handles all the complexity of:
- File management and syft:// URLs
- Permission checking
- Mock/private switching
- Cross-datasite discovery
Use Cases
- Federated Data Science: Write analysis code against mock data, run on real data elsewhere
- Privacy-Preserving ML: Train models on distributed data without seeing it
- Secure Collaboration: Share data structure without revealing contents
- Intermediate Results: Track outputs from multi-step federated computations
Learn More
- Tutorial: See
5mins.ipynbfor hands-on examples - Federated Execution: Use with syft-queue or syft-data-science
- Issues: https://github.com/OpenMined/syft-objects/issues
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file syft_objects-0.10.18.tar.gz.
File metadata
- Download URL: syft_objects-0.10.18.tar.gz
- Upload date:
- Size: 61.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bac5f43394dc7fa55d57f269e2b311c60aedba4d5690e15b7a607dac6eeaf9c
|
|
| MD5 |
3d55e48530e79f544afc1aa35c033a9c
|
|
| BLAKE2b-256 |
8a379db513c4889bd337e78723dc8b02abce1488dd6eac412fb452863315a52c
|
File details
Details for the file syft_objects-0.10.18-py3-none-any.whl.
File metadata
- Download URL: syft_objects-0.10.18-py3-none-any.whl
- Upload date:
- Size: 68.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf0dba8a208867158117ea317af8a2dcaa121221591c1a1ff8227ff644c2051
|
|
| MD5 |
a390aacde2b5ed399b82da99aaf944d4
|
|
| BLAKE2b-256 |
29eeec4324f01c8537e714674f38b3e51aab647a1f81a888112ba7555f92a297
|