{"id":5360,"library":"pathtools","title":"Path utilities for Python","description":"Pathtools is a Python library providing pattern matching and various utilities for file system paths. The library is currently at version 0.1.2 and was last updated in 2011, indicating an abandoned or extremely slow release cadence.","status":"abandoned","version":"0.1.2","language":"en","source_language":"en","source_url":"http://github.com/gorakhargosh/pathtools","tags":["file system","path utilities","pattern matching","deprecated","abandoned","python3.12"],"install":[{"cmd":"pip install pathtools","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"symbol":"filter_paths","correct":"from pathtools.patterns import filter_paths"},{"symbol":"match_path","correct":"from pathtools.patterns import match_path"},{"symbol":"absolute_path","correct":"from pathtools.path import absolute_path"}],"quickstart":{"code":"import os\nfrom pathtools.patterns import filter_paths\n\n# Create some dummy files for demonstration\nos.makedirs(\"temp_dir\", exist_ok=True)\nwith open(\"temp_dir/file1.txt\", \"w\") as f: f.write(\"test\")\nwith open(\"temp_dir/image.png\", \"w\") as f: f.write(\"test\")\nwith open(\"temp_dir/document.pdf\", \"w\") as f: f.write(\"test\")\n\nall_paths = [\n    \"temp_dir/file1.txt\",\n    \"temp_dir/image.png\",\n    \"temp_dir/document.pdf\",\n    \"temp_dir/another.txt\",\n    \"ignore_me.log\"\n]\n\n# Filter paths to include only .txt files and exclude 'ignore_me.log'\nincluded_patterns = ['*.txt']\nexcluded_patterns = ['*ignore_me.log']\n\nfiltered = filter_paths(all_paths, included_patterns, excluded_patterns)\nprint(list(filtered))\n\n# Clean up\nos.remove(\"temp_dir/file1.txt\")\nos.remove(\"temp_dir/image.png\")\nos.remove(\"temp_dir/document.pdf\")\nos.rmdir(\"temp_dir\")","lang":"python","description":"This example demonstrates how to use `filter_paths` from `pathtools.patterns` to filter a list of file paths based on inclusion and exclusion patterns."},"warnings":[{"fix":"There is no official fix from the maintainer. Consider replacing `pathtools` with `pathlib` for modern Python development or using a vendored/patched version if absolutely necessary.","message":"The `pathtools` library is incompatible with Python 3.12 and newer versions due to its reliance on the removed `imp` module in its `setup.py`.","severity":"breaking","affected_versions":"0.1.2 (Python 3.12+)"},{"fix":"Migrate to `pathlib` for robust and future-proof path handling. Projects like `watchdog` have already replaced `pathtools` with `pathlib`.","message":"The `pathtools` project appears to be unmaintained, with the last commit over 10 years ago and no new releases since 2011. For new projects, the built-in `pathlib` module (available since Python 3.4) offers a more modern, object-oriented, and actively maintained alternative for path manipulation.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Evaluate `pathlib` for more comprehensive and idiomatic Pythonic path operations. For specific advanced use cases, other specialized libraries might be more suitable.","message":"The library's functionality is limited compared to modern alternatives like `pathlib`. It lacks features such as direct path object manipulation, platform-independent path construction (beyond basic separators), and integration with asynchronous operations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}