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-orderenforce-package-layer-dependenciesno-direct-error-instantiationno-test-only-exportsrequire-doc-for-public-apirequire-file-docrequire-empty-line-after-file-docprefer-single-line-docprefer-directory-modules-for-siblingsrestrict-relative-imports-to-base-module
no-test-only-exports
Reports public module-level identifiers that have no imports from production files. Imports from test files and uses within the declaring module do not make an identifier part of the production API.
Names beginning with _ or __ are private and are not checked. Prefer an _
prefix for implementation details that do not need to be imported by production
code. If a public identifier is complex enough to require direct tests, suppress
the message for that declaration with a Pylint disable comment.
enforce-package-layer-dependencies
Organizes same-package modules into shared, feature, and entry layers declared in the entry-file docstring, allowing only downward coupling.
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 dotted-qualified
modules inherit the layer of their first-component base module. 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
must not be listed separately. They 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
Makes public classes, functions, and methods self-describing with docstrings, so consumers need not read the implementation.
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
Makes recognized docstring tags follow one configured order, so the order stays the single source of truth for tag sequence.
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.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylint_tyrant-0.9.0.tar.gz | 20.2 kB | With provenance | Details for pylint_tyrant-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pylint_tyrant-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for pylint_tyrant-0.9.0-py3-none-any.whl |
Total release size: 39.7 kB
Release files / pylint_tyrant-0.9.0.tar.gz
| Download URL | pylint_tyrant-0.9.0.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce7c94056202d5bf5ac405a242b40e5020db871ce2f7bd927dd5ab7afd78ee4e
|
|
BLAKE2b-256 checksum How to use checksums |
0d70bf7265d60005d9eccb754b744533ff6f24dee3ccd2622e011c4f9a41ec84
|
| 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 Sep 16, 2026.
Transparency logRelease files / pylint_tyrant-0.9.0-py3-none-any.whl
| Download URL | pylint_tyrant-0.9.0-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e23e2f733e33cf4e2e1ff7e0dbbe99e2fa41712ba9da6098fb7be0c89742e2d
|
|
BLAKE2b-256 checksum How to use checksums |
50910fafd4df597b4f1089ff15546910945efeb4dc19c21761ffb174d935543b
|
| 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 Sep 16, 2026.
Transparency logSecurity for pylint-tyrant 0.9.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.
Attestation for pylint_tyrant-0.9.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 Sep 16, 2026.
Transparency logA 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.