--- id: pytest-isort version: "4.0.0" license: MIT license_treatment: permissive maintenance: dormant --- # pytest-isort — py.test plugin to check import ordering using isort License: permissive · Maintenance: dormant · Downloads: 101.8K/mo ## What it is and what it does pytest-isort is a pytest plugin that integrates isort import-sorting checks into your test suite. When you run pytest with the --isort flag, it scans all Python files in your project and fails tests for any files with incorrectly ordered imports, showing a diff of what isort expects. You can exclude specific files or patterns via isort_ignore in your pytest configuration, and the plugin skips re-checking files that previously passed to speed up repeated test runs. The plugin sits between pytest and isort, using isort as its sorting engine. It's useful for teams that want import-order enforcement as part of their CI/CD pipeline without requiring a separate linting step. Configuration is minimal—just add the --isort flag or set isort_ignore rules in pytest.ini—and it respects isort's own configuration files. Use it for: - Enforce consistent import ordering in CI/CD pipelines by failing builds when imports are unsorted. - Catch import-order violations during local test runs before code review, using pytest's existing test infrastructure. - Exclude specific files or migration directories from import checks while validating the rest of the codebase. - Speed up repeated test runs by skipping files that already passed isort checks in previous runs. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A pytest plugin that automatically checks whether imports in Python files are sorted correctly according to isort rules, failing tests when import order violations are found. Yes, if you use pytest and want import-order enforcement as part of your test suite. The plugin is stable, has no known vulnerabilities, and integrates cleanly with isort. Maintenance is dormant but the package is mature and unlikely to need updates for basic functionality. Install it if your team values consistent import ordering; skip it if you prefer a separate linting tool or have no import-order standards. ## Install pip install pytest-isort uv add pytest-isort poetry add pytest-isort ## Installing pytest-isort Before you install: Low friction install with two straightforward runtime dependencies (pytest and isort). Maintenance is dormant—last release was 2024-03-05 and no commits since 2024-04-12—but the package is marked Production/Stable and carries no known vulnerabilities. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install pytest-isort # Then in your test run: py.test --isort # Or configure in pytest.ini: [pytest] isort_ignore = docs/conf.py Requires Python >=3.8,<4 and pytest>=5 as runtime dependencies. Verify before relying: - Whether the plugin's skip-on-unchanged-files optimization (mentioned in the description) remains reliable across pytest versions. - Current compatibility with isort's latest major versions and any breaking changes to isort's API. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 101.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest import sorting checker, isort pytest plugin, import order linting, pytest import validation, check import ordering, isort test integration, import style enforcement, import-linting, pytest-plugin, code-style [View on SkillFed](https://skillfed.io/packages/pytest-isort) · [View on PyPI](https://pypi.org/project/pytest-isort/)