Skip to main content

Flake8 __author__ checker

Project description

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: '')

Copyright (c) 2016 Jon Parise

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Changes

2.1.0 (2023-09-17)

  • Drop support for Python 3.7, and add 3.11.

  • Multiple authors can be listed by setting the __author__ attribute to a list (or tuple or set) of strings. Each entry will be validated against the configured pattern.

2.0.0 (2021-12-30)

  • Drop support for Python 2.7 and 3.6, and add 3.10.

  • Drop support for flake8 2.x versions.

1.2.0 (2020-10-12)

  • Drop Python 3.5 support and add versions 3.8 and 3.9.

  • Minor documentation improvements.

1.1.4 (2017-07-29)

  • Minor code and packaging cleanup.

1.1.3 (2017-07-28)

  • Drop the setup_requires dependency on flake8.

1.1.2 (2017-01-12)

  • Only apply the author regular expression pattern check when a pattern has actually been configured.

1.1.1 (2016-11-06)

  • Fix configuration file parsing for flake8 3.0+.

1.1.0 (2016-08-15)

  • Support flake8 3.0.0 (required for development)

1.0.2 (2016-06-02)

  • Support flake8 version 2.6.0

  • Drop test dependency on pytest (development only)

1.0.1 (2016-05-11)

  • Fixed parser validation for configuration-based options

1.0.0 (2016-04-30)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-author-2.1.0.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

flake8_author-2.1.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page