flake8-use-pathlib
A plugin for flake8 finding use of functions that can be replaced by pathlib module.
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-pathlibuv
uv add flake8-use-pathlibpoetry
poetry add flake8-use-pathlibInstalling 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
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
flake8-loggingA Flake8 plugin that detects and flags common…
permissive · top 15,000 on PyPI
path.pyProvides Path objects that wrap filesystem…
permissive · top 15,000 on PyPI
flake8-pieA flake8 plugin that detects code quality…
permissive · top 15,000 on PyPI
flake8-deprecatedA flake8 plugin that detects calls to…
copyleft · top 15,000 on PyPI
flake8-executableA Flake8 plugin that detects and reports…
copyleft · top 15,000 on PyPI
flake8-tidy-importsA flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
pathProvides Path objects that wrap filesystem…
permissive · top 5,000 on PyPI
flake8-blackA flake8 plugin that runs black's code style…
permissive · top 15,000 on PyPI
flake8-printA flake8 plugin that detects print statements…
permissive · top 5,000 on PyPI
LogbookLogbook is a logging library that replaces…
permissive · top 5,000 on PyPI