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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file xattr-compat-1.0.0.tar.gz.

File metadata

  • Download URL: xattr-compat-1.0.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

File hashes

Hashes for xattr-compat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5ef02e523585276d78a4ebbc05f2d08f0ddc200116c847826b1a18d8aa71f5bc
MD5 502c7c136a157e7912d281f1f5b42a26
BLAKE2b-256 75825ffb78d69936e7148d6ee907dd44581b6478dbfc313cda32c122b264f505

See more details on using hashes here.

File details

Details for the file xattr_compat-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xattr_compat-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

File hashes

Hashes for xattr_compat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fafcd360b274b362a46c88871473c26236a858071fbbe787a05f8df062899fa
MD5 8132183c26cc6f0fa2e8ccbd3bf058a2
BLAKE2b-256 06514708370113789e0ab876c9bcb895a66fa116bb9e90e8940f6f6c932db5c2

See more details on using hashes here.

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