jparise / flake8-author

Flake8 extension that checks Python modules for __author__ attributes

Home Page:https://pypi.python.org/pypi/flake8-author

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flake8 __author Checker

PyPI Version Python Versions

flake8-author is a Flake8 extension that checks Python modules for module-level __author__ attributes.

There is no official standard on __author__ usage. It is used largely by convention. Guido had this to say back in 2001:

Anothor source of discomfort is that there's absolutely no standard for this kind of meta-data variables. We've got __version__, and I believe we once agreed on that (in 1994 or so :-). But __author__? __credits__? What next -- __cute_signoff__?

This extension can therefore be configured to explicitly require or forbid __author__ attributes. By default, __author__ is considered optional.

If the __author__ attribute is allowed, its value can also be validated using a configurable regular expression pattern.

The __author__ attribute is generally assigned to a string, but multiple authors can be listed using a list (or tuple or set) of strings.

Installation

Install from PyPI using pip:

$ pip install flake8-author

The extension will be activated automatically by flake8. You can verify that it has been loaded by inspecting the flake8 --version string.

$ flake8 --version
6.1.0 (author: 2.1.0, ...) CPython 3.11.5 on Darwin

Error Codes

This extension adds three new error codes__ (using the A40 prefix):

  • A400: a module-level __author__ attribute is required
  • A401: __author__ attributes are not allowed
  • A402: __author__ attribute value does not match pattern

Configuration

Configuration values are specified in the [flake8] section of your config file or as command line arguments (e.g. --author-attribute=required).

  • author-attribute: "optional", "required", "forbidden" (default: optional)
  • author-pattern: __author__ validation re pattern (default: '')

About

Flake8 extension that checks Python modules for __author__ attributes

https://pypi.python.org/pypi/flake8-author

License:MIT License


Languages

Language:Python 100.0%