skillfed

flake8-use-pathlib

A plugin for flake8 finding use of functions that can be replaced by pathlib module.

flake8-use-pathlib v0.3.0 336.4K downloads/30d#7,461 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

flake8-use-pathlib is a linter plugin that integrates with flake8 to automatically detect and flag legacy file-system operations from the os and os.path modules that should be replaced with pathlib equivalents. Each pattern is assigned a specific rule code so developers can quickly identify and modernize their code.

The plugin works as a standard flake8 extension; once installed, it runs automatically during linting and reports violations with their corresponding rule codes and suggested pathlib replacements. It targets Python 3.7 and later, supporting current Python versions at the time of its last release.

Use it for:

  • Enforce pathlib usage in new code reviews by catching os.path calls during CI/CD linting.
  • Bulk-identify legacy file-operation patterns in an existing codebase for systematic modernization.
  • Teach developers the pathlib API by providing immediate, specific feedback on os module usage.
  • Migrate projects from py.path.local to pathlib as part of a broader modernization effort.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A flake8 plugin that detects uses of os and os.path functions that have modern pathlib equivalents, flagging them with specific rule codes for replacement.

Yes, if you are actively linting code and want to enforce pathlib adoption. The plugin is straightforward, has no security vulnerabilities, and carries a permissive license. However, be aware that the package is abandoned—it has not been updated since 2022-08-14. If you rely on it, verify that its rule set and flake8 compatibility remain suitable for your current Python and flake8 versions; do not expect bug fixes or new features.

Install

flake8-use-pathlib on PyPI

pip

pip install flake8-use-pathlib

uv

uv add flake8-use-pathlib

poetry

poetry add flake8-use-pathlib

Installing flake8-use-pathlib

Before you install

Low install friction; depends only on flake8. However, the package is abandoned—last release was 2022-08-14, over 1461 days ago. No active maintenance or bug fixes should be expected.

License in practice

MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install flake8-use-pathlib

# Then run flake8 on your code; the plugin activates automatically:
flake8 your_file.py

# Output will include lines like:
# your_file.py:1:1: PL100 os.path.abspath("foo") should be replaced by foo_path.resolve()

Requires flake8 to be installed and configured; the plugin does not work standalone.

Verify before relying

  • Whether the rule set remains complete for current pathlib best practices.
  • Compatibility with recent flake8 versions and Python 3.11+ (classifiers list only up to 3.10).
  • Whether all rule codes (PL100–PL124) remain accurate for modern pathlib usage patterns.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — flake8
Maintenance abandoned — 1,461 days since the last release
First released
Downloads 336,391/month — #7,461 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flake8_use_pathlib-0.3.0-py3-none-any.whl

Keywords: flake8, linter, pathlib

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

flake8 pathlib migrationdetect os.path usagepathlib linter pluginmodernize file path codeos module replacement checkerpathlib code qualityflake8 file operations
linterpathlibcode-modernization

More Quality Assurance packages