Skip to main content

Cross-platform, file handler using native pickers and security models.

Project description

xfilepy


Cross-platform, file handler using native pickers and security models.

Provides overloads for creating file handlers via native file pickers and saving/loading persistent access grants. Supported platforms are Android, iOS, and Desktop (Windows, macOS, Linux). On all platforms you can choose files outside your app's sandbox using the native file picker without asking the user for broad filesystem permissions. Access to the chosen files is mediated by platform-specific security models (e.g., SAF on Android, security-scoped bookmarks on iOS). This allows your app to write to the files later without re-prompting the user, even across app restarts.

Design goals:

  • zero side effects at import
  • late binding to the active platform
  • no runtime deps for platforms you don’t use.

Usage

See API Documentation for full details. Here is a brief example:

from xfilepy import FileHandler

# Open via native picker
FileHandler.create_via_picker(lambda fh: fh.read_bytes(lambda b: print(len(b))))

# Save via native "Save as…"
fh = FileHandler.create_via_save_dialog(lambda fh: fh.write_bytes(b"hello"))

# Serialize back to store in your settings
persist = fh.to_uri_string()

# Rehydrate a previously granted URI/bookmark
fh = FileHandler.from_uri_string(persist, require_write=True)
fh.append_bytes(b"!\n")

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

xfilepy-0.2.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

xfilepy-0.2.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file xfilepy-0.2.1.tar.gz.

File metadata

  • Download URL: xfilepy-0.2.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.22.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xfilepy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1db0c766729ff9fe4178248948e9909c94fbe625d6a1a379534c34ea2f672b96
MD5 d0a8b834adc876f596cf94533c6b3db4
BLAKE2b-256 05fb662434ac0782fceb5b284a043f21dbaff84cedcda468e0fd3cb179a4b15c

See more details on using hashes here.

File details

Details for the file xfilepy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: xfilepy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.22.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xfilepy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a73fe03a27f0c4a62c7f7500e237ef203bb3ae65d4197da387ce744e7d7cb56
MD5 32714492b4797b2e04de20fcd14d9fa0
BLAKE2b-256 485fb0e08b1961289cdbb0b33a5a5708a90d982a58c7a2270b7ecf5f4f883f75

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