Skip to main content

Minimal utilities for managing SyftBox file permissions

Project description

SyftPerm

File permission management for SyftBox made simple.

SyftPerm provides intuitive Python APIs for managing SyftBox file permissions with powerful pattern matching, inheritance, and debugging capabilities.

📚 Complete Documentation

👆 Visit our comprehensive documentation website for tutorials, API reference, and examples.

Quick Links

Overview

SyftPerm transforms complex SyftBox permission management into simple, readable Python code. Set permissions on individual files or entire folder hierarchies with powerful glob patterns, debug permission issues with built-in tools, and manage permissions through a beautiful web interface.

Key Features

  • 🎯 Intuitive Permission Hierarchy - Read → Create → Write → Admin levels that build naturally
  • 🌟 Powerful Pattern Matching - Use *.py, docs/**/*.md to control hundreds of files with one rule
  • 🔍 Nearest-Node Algorithm - Predictable inheritance that finds the "closest" permission rules
  • 🐛 Built-in Debugging - Trace exactly why permissions work or don't work
  • 📁 Folder-Level Efficiency - Set permissions once on directories, files inherit automatically
  • 🎮 Interactive Web Editor - Google Drive-style permission management interface

Installation

# Basic installation
pip install syft-perm

# Full installation with web editor and rich display
pip install "syft-perm[server,display]"

Quick Example

import syft_perm

# Open a file or folder
file = syft_perm.open("my_data.txt")
project = syft_perm.open("my_project/")

# Grant permissions with the hierarchy (higher includes lower)
file.grant_read_access("reviewer@external.org")
file.grant_write_access("colleague@company.com")  # Gets read + write
file.grant_admin_access("boss@company.com")       # Gets everything

# Use powerful patterns for multiple files
project.grant_write_access("*.py", "dev@company.com")
project.grant_read_access("docs/**/*.md", "*")  # Public docs

# Debug permissions easily
print(file.explain_permissions("colleague@company.com"))
# Output: "colleague@company.com has WRITE access: Explicitly granted write in ."

# Check access programmatically  
if file.has_write_access("colleague@company.com"):
    print("Colleague can modify this file")

# Use the web editor for non-technical users
editor_url = syft_perm.get_editor_url("my_project/")
print(f"Manage permissions at: {editor_url}")

Permission Hierarchy

SyftPerm uses a 4-level hierarchy where higher permissions include all lower ones:

  • Read - View file contents
  • Create - Read + create new files
  • Write - Read + Create + modify existing files
  • Admin - Read + Create + Write + manage permissions
# Grant write access - user automatically gets read and create too
file.grant_write_access("alice@example.com")

print(file.has_read_access("alice@example.com"))    # True
print(file.has_create_access("alice@example.com"))  # True  
print(file.has_write_access("alice@example.com"))   # True
print(file.has_admin_access("alice@example.com"))   # False

Pattern Matching

Control multiple files with glob patterns:

project = syft_perm.open("research_project/")

# File extensions
project.grant_write_access("*.py", "developers@team.com")
project.grant_read_access("*.md", "*")  # Public documentation

# Recursive patterns with **
project.grant_read_access("data/**/*.csv", "analysts@team.com")
project.grant_admin_access("src/**", "leads@team.com")

# Specific patterns
project.grant_write_access("tests/test_*.py", "qa@team.com")

Folder Inheritance

Set permissions on folders and files automatically inherit:

# Set permissions once on the folder
project = syft_perm.open("climate_research/")
project.grant_read_access("external_reviewers@university.edu")
project.grant_write_access("research_team@university.edu")

# ALL files in the project now have these permissions
# Even files created later will inherit them automatically

Debugging

Never guess why permissions work or don't work:

file = syft_perm.open("project/src/analysis.py")

# Get human-readable explanation
explanation = file.explain_permissions("alice@example.com")
print(explanation)

# Get detailed reasoning for debugging
has_access, reasons = file._check_permission_with_reasons("alice@example.com", "write")
print(f"Has write access: {has_access}")
for reason in reasons:
    print(f"  - {reason}")

Web-Based Permission Editor

For non-technical team members, SyftPerm includes a beautiful web interface:

# Get editor URL for any file or folder
url = syft_perm.get_editor_url("my_project/")
print(f"Edit permissions at: {url}")

# Server starts automatically when needed
# Or start manually: syft_perm.start_permission_server()

Learn More

🚀 New to SyftPerm?

Start with our 5-Minute Quick Start to learn the essentials.

📚 Want to Master It?

Work through our Comprehensive Tutorial Series:

  1. Fundamentals - Core concepts and hierarchy
  2. Patterns & Matching - Glob patterns and specificity
  3. Inheritance & Hierarchy - Multi-level permission flow
  4. Terminal Nodes & Limits - Advanced control features
  5. Mastery & Complex Scenarios - Expert techniques

🔧 Need API Details?

Browse our Complete API Reference with examples and parameters.

Real-World Use Cases

  • 🔬 Research Collaboration - External reviewers, junior researchers, senior staff, PIs
  • 💼 Enterprise Data Science - Different teams accessing different file types
  • 📊 Data Publishing - Public datasets with controlled modification rights
  • 🏗️ Software Projects - Developers, QA, documentation writers, managers

Requirements

  • Python 3.9+
  • Works on Windows, macOS, and Linux
  • Optional: FastAPI for web editor (pip install "syft-perm[server]")
  • Optional: Rich display formatting (pip install "syft-perm[display]")

Contributing

  1. Check out our GitHub Issues
  2. Read the Contributing Guide
  3. Join the OpenMined Community

License

MIT License - see LICENSE file for details.

Related Projects

  • SyftBox - The privacy-first data science platform
  • OpenMined - Privacy-preserving AI community
  • PySyft - Federated learning framework

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syft_perm-0.3.0.tar.gz (103.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syft_perm-0.3.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file syft_perm-0.3.0.tar.gz.

File metadata

  • Download URL: syft_perm-0.3.0.tar.gz
  • Upload date:
  • Size: 103.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for syft_perm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 36a0e089def45246fdff851304071d2d6514c9028cd81f187bcf694eba6381ef
MD5 5e5ab5e2ec08a829d0b8173117bf9b7c
BLAKE2b-256 1737ef4905e19f7518b55d7a0838c0d439d7fa102bf74c80bb558d74e1614c73

See more details on using hashes here.

File details

Details for the file syft_perm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: syft_perm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for syft_perm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdedd7fc17b5b0ea15d65f6ab56727f8e5af6da968e0b57609f5a7f2eeafa2b4
MD5 8daf172a7ecb7fc217634ff633687729
BLAKE2b-256 91bf4d3e224d0673fff3c579b378322efa5da0f484c839b979b27763f32e59de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page