xattr
Python wrapper for extended filesystem attributes
What it is and what it does
xattr is a Python wrapper around the extended filesystem attributes available on modern Unix-like systems (macOS 10.4+, Linux 2.6+, BSD, Solaris). It lets you read, write, and delete metadata stored as name-value pairs directly on files and directories, beyond the standard file permissions and timestamps. The package depends on cffi for C bindings and includes both a Python API and a command-line tool for attribute manipulation.
Extended attributes are useful for storing application-specific metadata, file tags, or custom properties without modifying file content. On Linux, attribute keys must be prefixed with 'user.' namespace. The package supports current Python versions (3.9+) and is available as precompiled wheels for common platforms, though it requires a filesystem and OS that support extended attributes.
Use it for:
- Store application-specific metadata or tags on files without modifying file content or using sidecar files.
- Implement file tagging or classification systems that persist in the filesystem independently of the file itself.
- Migrate or inspect extended attributes across systems using the command-line tool or Python API.
- Access macOS file metadata like creation date or file kind via extended attributes (though osxmetadata is recommended for Spotlight metadata).
- Build tools that need to associate custom properties with directories or symlinks in a filesystem-native way.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
xattr is a Python wrapper for reading and writing extended filesystem attributes on macOS, Linux, BSD, and Solaris, with a command-line tool included.
Yes, if you need to work with extended filesystem attributes on macOS, Linux, or BSD. The package is stable, permissively licensed, and has no known vulnerabilities. Install friction is moderate due to C compilation, but wheels are available for modern Python versions. Maintenance has slowed (last release 305 days ago), so verify that your use case doesn't require active development or recent bug fixes.
Install
xattr on PyPI
pip
pip install xattruv
uv add xattrpoetry
poetry add xattrInstalling xattr
Before you install
Medium install friction due to compiled C extensions (cffi dependency); wheels are available for modern Python versions (3.9+) and common platforms. Last release was 305 days ago; repository is active and not archived, though maintenance appears to have slowed.
License in practice
MIT license is permissive; you can use, modify, and distribute xattr freely in commercial and private projects with minimal restrictions.
Quickstart
pip install xattr
import xattr
x = xattr.xattr('/path/to/file')
x['user.myattr'] = b'value'
print(x['user.myattr'])
Requires Python 3.9+. On Linux, custom xattr keys must be prefixed with the 'user' namespace (e.g., 'user.your_attr'). Extended attributes must be supported by the filesystem and operating system.
Verify before relying
- Whether cffi is pre-installed or if compilation is required on your platform
- Performance characteristics when working with many attributes or large attribute values
- Compatibility with all filesystems that claim to support extended attributes
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — cffi |
| Maintenance | aging — 305 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 17,560,946/month — #1,111 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xattr-1.3.0-cp310-cp310-macosx_10_9_universal2.whl; xattr-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl; xattr-1.3.0-cp310-cp310-macosx_11_0_arm64.whl; xattr-1.3.0-cp310-cp310-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; xattr-1.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; xattr-1.3.0-cp310-cp310-musllinux_1_2_aarch64.whl; xattr-1.3.0-cp310-cp310-musllinux_1_2_x86_64.whl; xattr-1.3.0-cp311-cp311-macosx_10_9_universal2.whl; xattr-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl; xattr-1.3.0-cp311-cp311-macosx_11_0_arm64.whl; xattr-1.3.0-cp311-cp311-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; xattr-1.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; xattr-1.3.0-cp311-cp311-musllinux_1_2_aarch64.whl; xattr-1.3.0-cp311-cp311-musllinux_1_2_x86_64.whl; xattr-1.3.0-cp312-cp312-macosx_10_13_universal2.whl; xattr-1.3.0-cp312-cp312-macosx_10_13_x86_64.whl; xattr-1.3.0-cp312-cp312-macosx_11_0_arm64.whl; xattr-1.3.0-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; xattr-1.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; xattr-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl
Keywords: xattr
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
fatfs-ngfatfs-ng wraps ChaN's FatFS library to create,…
permissive · top 5,000 on PyPI
xrootdProvides Python bindings to XRootD, a…
copyleft · top 5,000 on PyPI
pathmagicProvides File and Dir classes that wrap…
permissive · top 15,000 on PyPI
extra-platformsDetects and exposes rich metadata about runtime…
permissive · top 15,000 on PyPI
attrdictProvides dictionary-like objects that allow…
permissive · top 5,000 on PyPI
YORMYORM maps Python object attributes…
permissive · top 15,000 on PyPI
scantreeRecursively scans directories with flexible…
permissive · top 5,000 on PyPI
uptimeRetrieves the system uptime (time since last…
permissive · top 15,000 on PyPI
pathlibProvides object-oriented filesystem path…
permissive · top 5,000 on PyPI
pyarmor.cli.coreProvides prebuilt extension modules required by…
unclear · top 15,000 on PyPI