Registry / devops / identify

identify

JSON →
library2.6.19pypypi✓ verified 25d ago

Identify is a Python library primarily used for file identification. It processes files (or file metadata) and returns a set of standardized tags describing their type, executability, language (from shebangs), and more. Maintained by the pre-commit team, it is actively developed with a focus on robust file analysis heuristics. The current version is 2.6.18, and releases typically align with pre-commit's development cycle or as issues require attention.

pip install identify
INSTALL
IMPORT
SIG · IDENTIFY
I
identify
devopspythonv2.6.19
Install
1.8s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.6.19 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tags_from_path
from identify import tags_from_path
from identify import tags_from_path

This example demonstrates how to use `tags_from_path` to identify a Python script and a plain text file, and also shows the result for a non-existent file path. It creates temporary files and cleans them up.

import os from identify import tags_from_path # Create a dummy Python file python_file_content = "#!/usr/bin/env python\nprint('Hello, world!')\n" python_file_path = "temp_script.py" with open(python_file_path, "w") as f: f.write(python_file_content) # Get tags for the dummy Python file python_tags = tags_from_path(python_file_path) print(f"Tags for '{python_file_path}': {python_tags}") # Create a dummy text file text_file_content = "This is a simple text file." text_file_path = "temp_text.txt" with open(text_file_path, "w") as f: f.write(text_file_content) # Get tags for the dummy text file text_tags = tags_from_path(text_file_path) print(f"Tags for '{text_file_path}': {text_tags}") # Demonstrate with a non-existent path (will return an empty set) non_existent_tags = tags_from_path("non_existent_file.xyz") print(f"Tags for 'non_existent_file.xyz': {non_existent_tags}") # Clean up the dummy files os.remove(python_file_path) os.remove(text_file_path)
Debug
Known issues
gotchaThe library identifies files based on a specific heuristic: first by file type, then executable bit, then file extension, then by peeking at file content bytes, and finally by interpreting shebangs. Users should be aware that it might not perform deep content analysis beyond these steps, potentially leading to unexpected tags if relying solely on ambiguous extensions or complex file formats.
fix
Understand the library's identification process as documented on its GitHub page. For critical identification, consider complementing `identify` with more specialized tools if needed.
affects: All versions
gotchaWhile `identify` includes an API for license determination, its approach (e.g., stripping copyright lines, normalizing whitespace) suggests it is a heuristic-based identification, not a definitive legal or cryptographic analysis. It may have limitations with highly customized licenses, incomplete files, or non-standard formatting.
fix
Do not treat `identify`'s license tags as legal advice or a substitute for thorough manual review. Use it as an initial indicator, and verify licenses manually, especially for open-source compliance or distribution.
affects: All versions
breakingThe `identify` library raises an `ImportError` because the name `tags_from_path` cannot be imported. This indicates that the function is not directly available or does not exist in the installed version of the `identify` library, likely due to an API change, a specific version where it's not exposed, or an older version of the library being used.
fix
Review the `identify` library's documentation and changelog to confirm the correct function name and import path for your installed version. Ensure your `identify` version is compatible with the code expecting `tags_from_path`. Consider upgrading `identify` to a version that includes this API, or adjusting your import statement and code to match the available API of your current `identify` installation.
affects: Versions of `identify` where `tags_from_path` is not directly exposed or does not exist in the top-level module (e.g., older versions before its introduction or specific versions after its removal/renaming).
breakingThe `identify` library raises an `ImportError` for `tags_from_path`. This indicates a significant API change where `tags_from_path` is either not directly exposed from the top-level `identify` package, has been renamed, or removed in the installed version, preventing basic usage.
fix
Review the `identify` library's documentation and changelog for the installed version to ascertain the correct import path or replacement function for `tags_from_path`. Modify the import statement accordingly or install a compatible version of the library.
affects: Specific versions where `tags_from_path` is not available as a direct import from `identify`.
Upgrade
Version history
2.6.19latest on PyPI · released Apr 17, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
identify — pip install identify · libregistry