skillfed

xattr

Python wrapper for extended filesystem attributes

xattr v1.3.0 17.6M downloads/30d#1,111 on PyPI220
Permissive license MIT AGING released

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 xattr

uv

uv add xattr

poetry

poetry add xattr

Installing 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

Environment :: ConsoleIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: POSIX :: BSD :: FreeBSDOperating System :: POSIX :: LinuxOperating System :: POSIX :: SunOS/SolarisProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

extended filesystem attributes pythonxattr read write metadatafile extended attributes wrapperposix xattr accessfilesystem metadata attributesmacos linux file xattrextended file properties
filesystem-metadataposix-systems

More Python Modules packages