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, BSDs). 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, xdg-desktop-portal (if available) on linux). This allows your app to write to the files later without re-prompting the user, even across app restarts.
Usage
See API Documentation for full details. Here is a brief example:
import asyncio
from xfilepy import FileHandler, UserCancelledError
# Open via native picker
try: # The user may cancel the picker, so we catch that exception
fh = asyncio.run(FileHandler.create_via_picker())
with fh.open() as f:
data = f.read()
print(data)
except UserCancelledError:
print("User cancelled the file picker.")
# Save via native "Save as…"
fh = asyncio.run(FileHandler.create_via_save_dialog())
with fh.open(mode="w", encoding="utf-8") as f:
f.write("Hello, world!")
# Serialize back to store in your settings
persist = fh.to_uri_string()
if persist is None:
raise RuntimeError("This file handler cannot be persisted.")
# Rehydrate a previously granted URI/bookmark
fh = FileHandler.from_uri_string(persist, require_write=True)
with fh.open(mode="a") as f:
f.write("Appended line.")
# Best-effort metadata, useful for cache invalidation
stat = fh.stat()
print(stat.display_name, stat.size, stat.mtime_ns)
FileHandler.stat() returns metadata when the platform/provider exposes it.
Fields such as size and mtime_ns may be None, especially for document
providers on mobile. If you need a reliable content fingerprint, hash the
stream returned by open("rb").
Metadata
Release files for xfilepy 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xfilepy-0.5.2.tar.gz | 29.0 kB | Without provenance | Details for xfilepy-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xfilepy-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for xfilepy-0.5.2-py3-none-any.whl |
Total release size: 62.5 kB
Release files / xfilepy-0.5.2.tar.gz
| Download URL | xfilepy-0.5.2.tar.gz |
|---|---|
| Size | 29.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2293e48ebdfbba67767211ad0b2e5336ac8784a2659759359615197e2349e509
|
|
BLAKE2b-256 checksum How to use checksums |
3479f5c0adb3ee7a764c66a5b068c589353619641fb7cf07c54530ad1b9ecca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / xfilepy-0.5.2-py3-none-any.whl
| Download URL | xfilepy-0.5.2-py3-none-any.whl |
|---|---|
| Size | 33.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19c7c42387e9d0be3402a5e335a3aa533506921c5dc60fa086ae0e9417572466
|
|
BLAKE2b-256 checksum How to use checksums |
5534b80a9edf6646bdf0f77a5e08e05a2352631477efb14133391e68e75e62f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for xfilepy 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.