Skip to main content

Minimal utilities for managing SyftBox file permissions

Project description

CI PyPI version PyPI downloads Python versions Code style: black License

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

Installation

pip install syft-perm

Quick Start - Learn the Entire API in 2 Minutes

import syft_perm as sp

# 1. Opening files and folders
file = sp.open("data.csv")                    # Open a file
folder = sp.open("my_project/")                # Open a folder
remote = sp.open("syft://alice@datasite.org/data.csv")  # Remote files

# 2. Granting permissions (each level includes all lower permissions)
file.grant_read_access("bob@company.com")      # Can view
file.grant_create_access("alice@company.com")  # Can view + create new files
file.grant_write_access("team@company.com")    # Can view + create + modify
file.grant_admin_access("admin@company.com")   # Full control

# 3. Revoking permissions
file.revoke_read_access("bob@company.com")     # Remove all access
file.revoke_create_access("alice@company.com") # Remove create (keeps read)
file.revoke_write_access("team@company.com")   # Remove write (keeps read/create)
file.revoke_admin_access("admin@company.com")  # Remove admin privileges

# 4. Checking permissions
if file.has_read_access("bob@company.com"):
    print("Bob can read this file")

if file.has_create_access("alice@company.com"):
    print("Alice can create new files")

if file.has_write_access("team@company.com"):
    print("Team can modify this file")
    
if file.has_admin_access("admin@company.com"):
    print("Admin has full control")

# 5. Understanding permissions with explain
explanation = file.explain_permissions("bob@company.com")
print(explanation)  # Shows why bob has/doesn't have access

# 6. Working with the Files API
all_files = sp.files.all()                     # Get all permissioned files
paginated = sp.files.get(limit=10, offset=0)   # Get first 10 files
filtered = sp.files.search(admin="me@datasite.org")  # My admin files
sliced = sp.files[0:5]                          # First 5 files using slice

# 7. Moving files while preserving permissions
new_file = file.move_file_and_its_permissions("archive/data.csv")

# 8. Interactive features (Jupyter/web)
file.share                                      # Show sharing widget

Permission Hierarchy Explained

  • Read: View file contents
  • Create: Read + create new files in folders
  • Write: Read + Create + modify existing files
  • Admin: Read + Create + Write + manage permissions

Permission Hierarchy

  • Read - View file contents
  • Create - Read + create new files
  • Write - Read + Create + modify existing files
  • Admin - Read + Create + Write + manage permissions

Learn More

Requirements

  • Python 3.9+
  • Works on Windows, macOS, and Linux

Contributing

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

License

Apache 2.0 License - see LICENSE file for details.

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.4.0.tar.gz (202.3 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.4.0-py3-none-any.whl (133.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: syft_perm-0.4.0.tar.gz
  • Upload date:
  • Size: 202.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.17

File hashes

Hashes for syft_perm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 eb57e45e0d630a516d741882be18b090e3079d07239f90f2c07c75cb7eaea9bb
MD5 77f8d88e1aa56d56bd5a8a6136b17759
BLAKE2b-256 2bc102592142a670dada8f5abef596ca605862831dde4f756d6f7d4832e51ddb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: syft_perm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 133.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.17

File hashes

Hashes for syft_perm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39c282ce51fb66b5b91576f474cea1388a385c917def0ffed5d2881e64481c74
MD5 5fc296f864f70604a13790f746d77fe9
BLAKE2b-256 69c14cb6783b009a8a584df135ee594f62a832b2efeb7c1a4655cc037bfc355b

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