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.1.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.1-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: syft_perm-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2773da3ce5090833d8189b3dfa6c002fc51654d8dc2130705b4cff0792c49f89
MD5 7a7e10994a163184044da7d6789f2953
BLAKE2b-256 f091889efa3712d3a6452aa9004c05a2c95e184e170a5d482b2120d564f6b06b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: syft_perm-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4aa78533e47792457ee0284c24c2c3963bedcf83d64fb113b02effdb6fc2878d
MD5 f1a31b3b6aac43a551f3261f2d365634
BLAKE2b-256 23747bab0b38663f1a4c02d4307158278823c3dbc62bc70b45b0f8c84360df74

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