Skip to main content

Multi-platform extended attributes support

Project description

xattr-compat

Support for extended attributes on multiple platforms. Also includes a mutable mapping class for easy access to file xattrs.

No C modules have to be compiled to use this library and it has no dependencies. The ctypes module in the standard library is used to make the required libc calls. Performance should be fine for all purposes. I mean, it's just xattrs, who is making so many xattr calls from Python that they need something above and beyond this?

Usage

The package exports the getxattr, listxattr, removexattr and setxattr functions. They have identical function signatures to the versions implemented in the os module in the standard library.

There's also a class Xattrs that provides a simple mutable mapping over a file's extended attributes:

# class Xattrs(path: os.PathLike, follow_symlinks: bool = True)

import xattr_compat

xattrs = xattr_compat.Xattrs("./my_file")

xattrs["user.humanfund.xattr"] = b"hello\0world"

print("Extended attributes:", xattrs.items())

License

MIT

Sponsorship

Development of xattr-compat is sponsored by Pro Football History.com, your source for NFL coaching biographies.

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

xattr-compat-1.0.0.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

xattr_compat-1.0.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

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