Skip to content

Remove deprecated ignore-init-module-imports from Ruff configuration #2666

Description

@cjemorton

Issue: Remove deprecated Ruff configuration option

Problem

The Ruff formatter configuration in pyproject.toml contains a deprecated option ignore-init-module-imports that is generating warnings during execution. This option was used to control how Ruff handles imports in __init__.py files, but Ruff now correctly handles these imports by default, making this configuration obsolete.

Impact

When running Ruff (linting, formatting, or checking), users encounter the following deprecation warning:

warning: The `ignore-init-module-imports` option is deprecated and will be removed in a future release.

This causes:

  • Unnecessary warning noise in CI/CD pipelines
  • Confusion for contributors who may not understand why the warning appears
  • Technical debt as the option will be removed in a future Ruff release
  • Risk of build failures when Ruff eventually removes this option entirely

Root Cause

The ignore-init-module-imports = true setting in the [tool.ruff.lint] section of pyproject.toml is no longer necessary. Ruff's behavior has evolved to handle __init__.py imports correctly by default, eliminating the need for this explicit configuration.

Proposed Solution

Remove the deprecated ignore-init-module-imports = true line from the [tool.ruff.lint] section in pyproject.toml.

This is a single-line deletion with no functional impact on the codebase:

  • ✅ Eliminates the deprecation warning
  • ✅ Aligns with Ruff's latest best practices
  • ✅ Prevents future breaking changes when Ruff removes this option
  • ✅ No changes to linting or formatting behavior (Ruff handles this correctly by default)

Benefits

  1. Cleaner output: Removes unnecessary warnings from development and CI/CD workflows
  2. Future-proof: Prevents potential issues when Ruff removes this deprecated option
  3. Best practices: Keeps the configuration aligned with Ruff's current recommendations
  4. Minimal change: Single line deletion with no side effects

Additional Context

  • Ruff version where option became deprecated: The exact version varies, but this has been deprecated in recent Ruff releases
  • This change has been tested in a fork and confirmed to work correctly without any adverse effects
  • The Ruff documentation confirms that this option is no longer needed as the default behavior is now correct

Testing

After making this change:

  • ✅ Run ruff check - should complete without deprecation warnings
  • ✅ Run ruff format - should complete without deprecation warnings
  • ✅ Verify existing tests pass
  • ✅ Verify no changes to actual linting/formatting behavior

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions