pynudger
opennudge Python linter (naming conventions and other automated checks)
✨ Features 🚀 Quick start 📚 Documentation 🤝 Contribute 👍 Adopters 📜 Legal
Features
pynudger is an opinionated linter for Python projects, focused on naming conventions and making your code "more Pythonic".
- Length rules: Too long class/function names are flagged.
- Setters/getters: Discourages usage of setters/getters, encourages properties instead.
- No helpers/utils/commons/shared names: Incentivizes more descriptive and semantically coherent names for functionalities.
Table of contents
Quick start
Installation
> pip install pynudger
Install pynudger[rich] for rich output, pynudger[mcp] for the MCP
command, or pynudger[all] for both.
Usage
To check against the rules run the following from the command line:
> pynudger check
You can pass additional arguments to pynudger check, like files
to check (by default all Python files in the current directory):
> pynudger check path/to/package single.py
Advanced
Configuration
You can configure individual pynudger rules in pyproject.toml (or
.pynudger.toml in the root of your project, just remove the
[tool.pynudger] prefix), for example:
[tool.pynudger.PYNUDGER44]
max_union_types = 4
Run as a pre-commit hook
pynudger can be used as a pre-commit hook, to add as a plugin:
repos:
- repo: "https://github.com/open-nudge/pynudger"
rev: ... # select the tag or revision you want, or run `pre-commit autoupdate`
hooks:
- id: "pynudger"
Disable in code
You can disable pynudger on a line-by-line basis
(you have to specify exact code), e.g.:
def set_my_too_long_function_name(): # noqa: PYNUDGER0, PYNUDGER19
pass
or a line span:
# noqa-start: PYNUDGER0, PYNUDGER19
def set_my_too_long_function_name():
pass
def set_another_long_function():
pass
# noqa-end: PYNUDGER0, PYNUDGER19
def set_will_error_out_this_time():
pass
It is also possible to disable all checks in a file by placing the following somewhere in the file (preferably at the top):
# noqa-file: PYNUDGER0, PYNUDGER19
Rules
pynudger provides the following rules:
| Name | Description |
|---|---|
PYNUDGER0 |
Avoid using setters in class names. Use properties instead. |
PYNUDGER1 |
Avoid using setters in function names. Use properties instead. |
PYNUDGER2 |
Avoid using setters in file names. Define file name without it. |
PYNUDGER3 |
Avoid using getters in class names. Use properties instead. |
PYNUDGER4 |
Avoid using getters in function names. Use properties instead. |
PYNUDGER5 |
Avoid using getters in file names. Define file name without it. |
PYNUDGER6 |
Avoid using utils in class names. Name the class appropriately. |
PYNUDGER7 |
Avoid using utils in function names. Name the function appropriately. |
PYNUDGER8 |
Avoid defining utils modules. Move functionality to appropriate modules. |
PYNUDGER9 |
Avoid using helpers in class names. Name the class appropriately. |
PYNUDGER10 |
Avoid using helpers in function names. Name the function appropriately. |
PYNUDGER11 |
Avoid defining utils modules. Move functionality to appropriate modules. |
PYNUDGER12 |
Avoid using common in class names. Name the class appropriately. |
PYNUDGER13 |
Avoid using common in function names. Name the function appropriately. |
PYNUDGER14 |
Avoid defining common modules. Move functionality to appropriate modules. |
PYNUDGER15 |
Avoid using shared in class names. Name the class appropriately. |
PYNUDGER16 |
Avoid using shared in function names. Name the function appropriately. |
PYNUDGER17 |
Avoid defining shared modules. Move functionality to appropriate modules. |
PYNUDGER18 |
Avoid long class names. Specify intent by nesting modules/packages. |
PYNUDGER19 |
Avoid long function names. Specify intent by nesting modules/packages. |
PYNUDGER20 |
Avoid long path names. Specify intent by nesting modules/packages. |
PYNUDGER21 |
Avoid restricted state management keywords: del, global, nonlocal. |
PYNUDGER22 |
Avoid restricted iteration keywords: break, continue. |
PYNUDGER23 |
Avoid restricted compatibility functionality: object, basestring, unicode, long. |
PYNUDGER24 |
Avoid restricted utility/interactive functions: breakpoint, help, id. |
PYNUDGER25 |
Avoid restricted explicit casting functionality: typing.cast, cast, bool, float, int, str. |
PYNUDGER26 |
Avoid restricted insecure builtin functions: exec, eval, compile. |
PYNUDGER27 |
Avoid restricted explicit iteration: iter, aiter, anext, next. |
PYNUDGER28 |
Avoid restricted attribute manipulation: delattr, getattr, hasattr, setattr, globals, locals, vars, dir. |
PYNUDGER29 |
Avoid restricted explicit dunder access: attributes starting with __. |
PYNUDGER30 |
Avoid returning empty strings. Return None to indicate lack of value. |
PYNUDGER31 |
Avoid more than assert statements in pytest tests. Keep each test focused. |
PYNUDGER32 |
Avoid modules with more than total lines. Split code into focused modules. |
PYNUDGER33 |
Avoid modules with more than code lines. Split code into focused modules. |
PYNUDGER34 |
Avoid undocumented function parameters. Add an Args: docstring section. |
PYNUDGER35 |
Avoid undocumented generator yields. Add a Yields: docstring section. |
PYNUDGER36 |
Avoid undocumented return values. Add a Returns: docstring section. |
PYNUDGER37 |
Avoid small, rarely used internal functions. |
PYNUDGER38 |
Avoid small, rarely used internal classes. |
PYNUDGER39 |
Avoid small, rarely used internal methods. |
PYNUDGER40 |
Avoid repeating module names in variables. |
PYNUDGER41 |
Avoid repeating module names in classes. |
PYNUDGER42 |
Avoid repeating module names in functions. |
PYNUDGER43 |
Group globals with shared name words under modules. |
PYNUDGER44 |
Avoid pipe type unions with more than the configured number of members. |
PYNUDGER45 |
Avoid deeply nested types. |
PYNUDGER46 |
Avoid modules with fewer than objects. Move them into other modules. |
with the following configurable options (in pyproject.toml
or .pynudger.toml):
| Option | Description | Affected rules | Default |
|---|---|---|---|
pascal_length |
Maximum allowed length of PascalCase names | PYNUDGER18 | 3 |
snake_length |
Maximum allowed length of snake_case names | PYNUDGER19, PYNUDGER20 | 3 |
pascal_excludes |
List of words to exclude from PascalCase length check | PYNUDGER18 | [] |
snake_excludes |
List of words to exclude from snake_case length check | PYNUDGER19, PYNUDGER20 | [] |
maximum_test_asserts |
Maximum number of assert statements in pytest tests |
PYNUDGER31 | 1 |
max_module_lines |
Maximum number of any lines in a Python module | PYNUDGER32 | 600 |
max_module_code_lines |
Maximum number of code lines in a Python module | PYNUDGER33 | 200 |
minimum_module_objects |
Minimum assignment names, classes, and functions in a module | PYNUDGER46 | 2 |
exclude_private |
Exclude objects whose names start with a single underscore | PYNUDGER46 | True |
minimum_internal_function_usages |
Minimum same-file usages for internal functions | PYNUDGER37 | 2 |
minimum_internal_function_lines |
Minimum code lines for internal functions | PYNUDGER37 | 5 |
minimum_internal_class_usages |
Minimum same-file usages for internal classes | PYNUDGER38 | 2 |
minimum_internal_class_lines |
Minimum code lines for internal classes | PYNUDGER38 | 5 |
minimum_internal_method_usages |
Minimum same-file usages for internal methods | PYNUDGER39 | 2 |
minimum_internal_method_lines |
Minimum code lines for internal methods | PYNUDGER39 | 5 |
minimum_same_name_occurrences |
Minimum declarations sharing a name word | PYNUDGER43 | 2 |
max_union_types |
Maximum members in a pipe type union | PYNUDGER44 | 3 |
max_type_depth |
Maximum nested type subscript depth | PYNUDGER45 | 1 |
Contribute
We welcome your contributions! Start here:
Legal
- This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- This project is copyrighted by open-nudge - the appropriate copyright notice is included in each file.
Metadata
Release files for pynudger 2.3.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 | |
|---|---|---|---|
| pynudger-2.3.0.tar.gz | 32.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pynudger-2.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.7 kB
Release files / pynudger-2.3.0.tar.gz
| Download URL | pynudger-2.3.0.tar.gz |
|---|---|
| Size | 32.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad2ae31dc644f51272ca9f33aba2664d66a9ee6d39518b0a5a9b6875fa94fc07
|
|
BLAKE2b-256 checksum How to use checksums |
24ffcf47341a080a81e03c240c84cc49079430829fbcdf56f12f4e40b97cdfa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 31, 2026.
Transparency logRelease files / pynudger-2.3.0-py3-none-any.whl
| Download URL | pynudger-2.3.0-py3-none-any.whl |
|---|---|
| Size | 37.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12b8dc09cf195096fd203b9d63c44401cc5f486b2b4bafe4e4de12286eaf209f
|
|
BLAKE2b-256 checksum How to use checksums |
e96838d434d3a52999767485613c659226709e9b54f8b84e2795361e7cce4491
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 31, 2026.
Transparency log