ruff/docs/rules/implicit-namespace-package.md
Martin Fischer 28c9263722 Automatically linkify option references in rule documentation
Previously the rule documentation referenced configuration options
via full https:// URLs, which was bad for several reasons:

* changing the website would mean you'd have to change all URLs
* the links didn't work when building mkdocs locally
* the URLs showed up in the `ruff rule` output
* broken references weren't detected by our CI

This commit solves all of these problems by post-processing the
Markdown, recognizing sections such as:

    ## Options

    * `flake8-tidy-imports.ban-relative-imports`

`cargo dev generate-all` will automatically linkify such references
and panic if the referenced option doesn't exist.
Note that the option can also be linked in the other Markdown sections
via e.g. [`flake8-tidy-imports.ban-relative-imports`] since
the post-processing code generates a CommonMark link definition.

Resolves #2766.
2023-02-12 13:19:11 -05:00

907 B

implicit-namespace-package (INP001)

Derived from the flake8-no-pep420 linter.

What it does

Checks for packages that are missing an __init__.py file.

Why is this bad?

Python packages are directories that contain a file named __init__.py. The existence of this file indicates that the directory is a Python package, and so it can be imported the same way a module can be imported.

Directories that lack an __init__.py file can still be imported, but they're indicative of a special kind of package, known as a "namespace package" (see: PEP 420). Namespace packages are less widely used, so a package that lacks an __init__.py file is typically meant to be a regular package, and the absence of the __init__.py file is probably an oversight.

Options