Skip to main content

pylint-tyrant

Pylint plugin with documentation and architecture rules inspired by eslint-plugin-tyrant.

In rule names, doc means Python docstrings.

The plugin currently ships these rules:

  • enforce-doc-tag-order
  • enforce-project-layer-dependencies
  • enforce-package-layer-dependencies
  • no-direct-error-instantiation
  • require-doc-for-public-api
  • require-file-doc
  • require-empty-line-after-file-doc
  • require-relative-base-module-import
  • prefer-single-line-doc
  • restrict-relative-imports-to-base-module

enforce-project-layer-dependencies

Requires configured project directories to depend only on themselves or lower layers.

This rule uses --tyrant-layers:

pylint \
  --load-plugins=pylint_tyrant \
  --enable=enforce-project-layer-dependencies \
  --tyrant-layers=lib,services,app \
  path/to/your_package

enforce-package-layer-dependencies

Requires same-package module layers to be declared in the entry-file docstring and to depend only on themselves or lower layers.

This rule uses --tyrant-shared-modules. __init__.py is treated as the exact entry file automatically, configured same-directory module names such as base or types.py are treated as shared low-level modules, and every other source file or importable directory in the directory is treated as a feature module.

Prefix inheritance is disabled by default. Set --tyrant-inherit-layers-from-module-prefixes=y to let underscore-qualified modules inherit the layer of their longest declared module-name prefix. For example, bbb_unit_test.py and bbb_integration_test.py then inherit the layer declared by @module bbb.py, so they do not need to be listed separately and cannot import higher layers. Qualified configured shared modules such as types_unit_test.py inherit the shared layer from --tyrant-shared-modules=types.py. The entry layer is always the exact __init__.py entry file.

Use @module for one ordered module layer and @module-group for one ordered flat peer layer:

"""Package docs.

@module materials.py - Core data.
@module-group paragraphs.py, lexicons.py - Peer modules derived from the same inputs.
@module metrics.py - Aggregates.
"""

Every feature module must be listed exactly once. Missing modules, extra listed modules, repeated modules, and upward imports are violations. Every @module and @module-group tag must also include a non-empty relationship description. When declaring feature modules or configuring --tyrant-shared-modules, names with .py are source file modules; names without extensions are directory modules. A package may not contain both a source file and an importable directory with the same basename.

pylint \
  --load-plugins=pylint_tyrant \
  --enable=enforce-package-layer-dependencies \
  --tyrant-shared-modules=base,types.py \
  path/to/your_package

Add --tyrant-inherit-layers-from-module-prefixes=y to that command only when prefix inheritance is wanted.

require-doc-for-public-api

Requires public classes, functions, and methods to have docstrings.

This rule currently treats names that do not start with _ as public. It checks:

  • top-level public classes
  • top-level public functions
  • public methods on public classes

Valid:

class UserService:
    """Load users."""

    def load_user(self) -> None:
        """Load one user."""

Also valid:

def load_user() -> None:
    """Load one user."""

Invalid:

def load_user() -> None:
    pass

enforce-doc-tag-order

Requires recognized docstring tags to follow one configured order.

This rule reads tags written as @tag - value from module, class, and function docstrings. It only checks tags listed in tyrant-doc-tag-order.

Configure it in pyproject.toml like this:

[tool.pylint.main]
load-plugins = ["pylint_tyrant"]

[tool.pylint."messages control"]
enable = ["enforce-doc-tag-order"]

[tool.pylint.tyrant-doc-tag-order]
tyrant-doc-tag-order = ["@remarks", "@param", "@returns"]

Command-line equivalent:

pylint \
  --load-plugins=pylint_tyrant \
  --enable=enforce-doc-tag-order \
  --tyrant-doc-tag-order=@remarks,@param,@returns \
  path/to/your_package

Valid:

def load_user() -> User:
    """Load one user.

    @remarks - Used by the public API.
    @param - User id.
    @returns - Loaded user.
    """

Invalid:

def load_user() -> User:
    """Load one user.

    @returns - Loaded user.
    @param - User id.
    """

Metadata

Release files for pylint-tyrant 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylint-tyrant 0.7.0
File Size Uploaded Provenance Actions
pylint_tyrant-0.7.0.tar.gz 16.7 kB With provenance Details for pylint_tyrant-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylint-tyrant 0.7.0
File Interpreter ABI Platform Actions
pylint_tyrant-0.7.0-py3-none-any.whl Python 3 none any Details for pylint_tyrant-0.7.0-py3-none-any.whl

Total release size: 33.1 kB

Release files / pylint_tyrant-0.7.0.tar.gz

Download URL pylint_tyrant-0.7.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8eddc97d331ab2214053b53144d42f64784f39a2c3a7b1dceb61a7160ec914aa
BLAKE2b-256 checksum
How to use checksums
c192b25d636baa7b8c9feb9aaaec314b60bfeb4a03ec34db5a2f1ce4ee0bbe33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / pylint_tyrant-0.7.0-py3-none-any.whl

Download URL pylint_tyrant-0.7.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
904661b6556e0a97e792436d4ff584a3c52541b1d5424380549db31f5de5b912
BLAKE2b-256 checksum
How to use checksums
163531f8fbead428955ef7d33592ee64d6207db82e8de1e365406b3e5bce6785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Security for pylint-tyrant 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pylint_tyrant-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page