mirror of https://github.com/astral-sh/ruff
Improve implicit-namespace-package documentation
This commit is contained in:
parent
113610a8d4
commit
c8f60c9588
|
|
@ -18,13 +18,16 @@ define_violation!(
|
||||||
/// imported.
|
/// imported.
|
||||||
///
|
///
|
||||||
/// Directories that lack an `__init__.py` file can still be imported, but
|
/// 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
|
/// they're indicative of a special kind of package, known as a "namespace
|
||||||
/// package (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
|
/// package" (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
|
||||||
|
/// 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.
|
||||||
///
|
///
|
||||||
/// Namespace packages are a relatively new feature of Python, and they're
|
/// Note that namespace packages can be specified via the
|
||||||
/// not widely used. So a package that lacks an `__init__.py` file is
|
/// [`namespace-packages`](https://github.com/charliermarsh/ruff#namespace-packages)
|
||||||
/// typically meant to be a regular package, and the absence of the
|
/// configuration option. Adding a namespace package to the configuration
|
||||||
/// `__init__.py` file is probably an oversight.
|
/// will suppress this violation for a given package.
|
||||||
pub struct ImplicitNamespacePackage(pub String);
|
pub struct ImplicitNamespacePackage(pub String);
|
||||||
);
|
);
|
||||||
impl Violation for ImplicitNamespacePackage {
|
impl Violation for ImplicitNamespacePackage {
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,13 @@ package, and so it can be imported the same way a module can be
|
||||||
imported.
|
imported.
|
||||||
|
|
||||||
Directories that lack an `__init__.py` file can still be imported, but
|
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
|
they're indicative of a special kind of package, known as a "namespace
|
||||||
package (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
|
package" (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
|
||||||
|
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.
|
||||||
|
|
||||||
Namespace packages are a relatively new feature of Python, and they're
|
Note that namespace packages can be specified via the
|
||||||
not widely used. So a package that lacks an `__init__.py` file is
|
[`namespace-packages`](https://github.com/charliermarsh/ruff#namespace-packages)
|
||||||
typically meant to be a regular package, and the absence of the
|
configuration option. Adding a namespace package to the configuration
|
||||||
`__init__.py` file is probably an oversight.
|
will suppress this violation for a given package.
|
||||||
Loading…
Reference in New Issue