pep8-naming


Namepep8-naming JSON
Version 0.14.0 PyPI version JSON
download
home_pagehttps://github.com/PyCQA/pep8-naming
SummaryCheck PEP-8 naming conventions, plugin for flake8
upload_time2024-05-16 21:18:53
maintainerNone
docs_urlNone
authorFlorent Xicluna
requires_python>=3.7
licenseExpat license
keywords flake8 pep8 naming
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PEP 8 Naming Conventions
========================

Check your code against `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_
naming conventions.

This module provides a plugin for ``flake8``, the Python code checker.

(It replaces the plugin ``flint-naming`` for the ``flint`` checker.)


Installation
------------

You can install, upgrade, uninstall ``pep8-naming`` with these commands::

  $ pip install pep8-naming
  $ pip install --upgrade pep8-naming
  $ pip uninstall pep8-naming


Plugin for Flake8
-----------------

When both ``flake8`` and ``pep8-naming`` are installed, the plugin is
available in ``flake8``::

  $ flake8 --version
  4.0.1 (mccabe: 0.6.1, naming: 0.13.0, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.10 on Linux

By default the plugin is enabled.

Error Codes
-----------

These error codes are emitted:

+---------+-----------------------------------------------------------------+
| code    | sample message                                                  |
+=========+=================================================================+
| _`N801` | class names should use CapWords convention (`class names`_)     |
+---------+-----------------------------------------------------------------+
| _`N802` | function name should be lowercase (`function names`_)           |
+---------+-----------------------------------------------------------------+
| _`N803` | argument name should be lowercase (`function arguments`_)       |
+---------+-----------------------------------------------------------------+
| _`N804` | first argument of a classmethod should be named 'cls'           |
|         | (`function arguments`_)                                         |
+---------+-----------------------------------------------------------------+
| _`N805` | first argument of a method should be named 'self'               |
|         | (`function arguments`_)                                         |
+---------+-----------------------------------------------------------------+
| _`N806` | variable in function should be lowercase                        |
+---------+-----------------------------------------------------------------+
| _`N807` | function name should not start and end with '__'                |
+---------+-----------------------------------------------------------------+
| _`N811` | constant imported as non constant (`constants`_)                |
+---------+-----------------------------------------------------------------+
| _`N812` | lowercase imported as non-lowercase                             |
+---------+-----------------------------------------------------------------+
| _`N813` | camelcase imported as lowercase                                 |
+---------+-----------------------------------------------------------------+
| _`N814` | camelcase imported as constant                                  |
|         | (distinct from `N817`_ for selective enforcement)               |
+---------+-----------------------------------------------------------------+
| _`N815` | mixedCase variable in class scope                               |
|         | (`constants`_, `method names`_)                                 |
+---------+-----------------------------------------------------------------+
| _`N816` | mixedCase variable in global scope (`constants`_)               |
+---------+-----------------------------------------------------------------+
| _`N817` | camelcase imported as acronym                                   |
|         | (distinct from `N814`_ for selective enforcement)               |
+---------+-----------------------------------------------------------------+
| _`N818` | error suffix in exception names (`exceptions`_)                 |
+---------+-----------------------------------------------------------------+

.. _class names: https://www.python.org/dev/peps/pep-0008/#class-names
.. _constants: https://www.python.org/dev/peps/pep-0008/#constants
.. _exceptions: https://www.python.org/dev/peps/pep-0008/#exception-names
.. _function names: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
.. _function arguments: https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
.. _method names: https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables

Options
-------

The following flake8 options are added:

--ignore-names              Ignore errors for specific names or glob patterns.

                            Currently, this option can only be used for N802, N803, N804, N805, N806, N815, and N816 errors.

                            Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpModule,tearDownModule,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff``.

--classmethod-decorators    List of method decorators pep8-naming plugin should consider class method.

                            Used to prevent false N804 errors.

                            Default: ``classmethod``.

--staticmethod-decorators   List of method decorators pep8-naming plugin should consider static method.

                            Used to prevent false N805 errors.

                            Default: ``staticmethod``.

FAQ
---

How do I configure ``classmethod_decorators`` to recognize `SQLAlchemy`_ class methods?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

    classmethod_decorators =
        classmethod
        declared_attr
        expression
        comparator

.. _SQLAlchemy: https://www.sqlalchemy.org/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PyCQA/pep8-naming",
    "name": "pep8-naming",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "flake8 pep8 naming",
    "author": "Florent Xicluna",
    "author_email": "florent.xicluna@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/5c/3140be131b7f4632c364481477fc09ecd5f6858dff628e36532548bd55ff/pep8-naming-0.14.0.tar.gz",
    "platform": null,
    "description": "PEP 8 Naming Conventions\n========================\n\nCheck your code against `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_\nnaming conventions.\n\nThis module provides a plugin for ``flake8``, the Python code checker.\n\n(It replaces the plugin ``flint-naming`` for the ``flint`` checker.)\n\n\nInstallation\n------------\n\nYou can install, upgrade, uninstall ``pep8-naming`` with these commands::\n\n  $ pip install pep8-naming\n  $ pip install --upgrade pep8-naming\n  $ pip uninstall pep8-naming\n\n\nPlugin for Flake8\n-----------------\n\nWhen both ``flake8`` and ``pep8-naming`` are installed, the plugin is\navailable in ``flake8``::\n\n  $ flake8 --version\n  4.0.1 (mccabe: 0.6.1, naming: 0.13.0, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.10 on Linux\n\nBy default the plugin is enabled.\n\nError Codes\n-----------\n\nThese error codes are emitted:\n\n+---------+-----------------------------------------------------------------+\n| code    | sample message                                                  |\n+=========+=================================================================+\n| _`N801` | class names should use CapWords convention (`class names`_)     |\n+---------+-----------------------------------------------------------------+\n| _`N802` | function name should be lowercase (`function names`_)           |\n+---------+-----------------------------------------------------------------+\n| _`N803` | argument name should be lowercase (`function arguments`_)       |\n+---------+-----------------------------------------------------------------+\n| _`N804` | first argument of a classmethod should be named 'cls'           |\n|         | (`function arguments`_)                                         |\n+---------+-----------------------------------------------------------------+\n| _`N805` | first argument of a method should be named 'self'               |\n|         | (`function arguments`_)                                         |\n+---------+-----------------------------------------------------------------+\n| _`N806` | variable in function should be lowercase                        |\n+---------+-----------------------------------------------------------------+\n| _`N807` | function name should not start and end with '__'                |\n+---------+-----------------------------------------------------------------+\n| _`N811` | constant imported as non constant (`constants`_)                |\n+---------+-----------------------------------------------------------------+\n| _`N812` | lowercase imported as non-lowercase                             |\n+---------+-----------------------------------------------------------------+\n| _`N813` | camelcase imported as lowercase                                 |\n+---------+-----------------------------------------------------------------+\n| _`N814` | camelcase imported as constant                                  |\n|         | (distinct from `N817`_ for selective enforcement)               |\n+---------+-----------------------------------------------------------------+\n| _`N815` | mixedCase variable in class scope                               |\n|         | (`constants`_, `method names`_)                                 |\n+---------+-----------------------------------------------------------------+\n| _`N816` | mixedCase variable in global scope (`constants`_)               |\n+---------+-----------------------------------------------------------------+\n| _`N817` | camelcase imported as acronym                                   |\n|         | (distinct from `N814`_ for selective enforcement)               |\n+---------+-----------------------------------------------------------------+\n| _`N818` | error suffix in exception names (`exceptions`_)                 |\n+---------+-----------------------------------------------------------------+\n\n.. _class names: https://www.python.org/dev/peps/pep-0008/#class-names\n.. _constants: https://www.python.org/dev/peps/pep-0008/#constants\n.. _exceptions: https://www.python.org/dev/peps/pep-0008/#exception-names\n.. _function names: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names\n.. _function arguments: https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments\n.. _method names: https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables\n\nOptions\n-------\n\nThe following flake8 options are added:\n\n--ignore-names              Ignore errors for specific names or glob patterns.\n\n                            Currently, this option can only be used for N802, N803, N804, N805, N806, N815, and N816 errors.\n\n                            Default: ``setUp,tearDown,setUpClass,tearDownClass,setUpModule,tearDownModule,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff``.\n\n--classmethod-decorators    List of method decorators pep8-naming plugin should consider class method.\n\n                            Used to prevent false N804 errors.\n\n                            Default: ``classmethod``.\n\n--staticmethod-decorators   List of method decorators pep8-naming plugin should consider static method.\n\n                            Used to prevent false N805 errors.\n\n                            Default: ``staticmethod``.\n\nFAQ\n---\n\nHow do I configure ``classmethod_decorators`` to recognize `SQLAlchemy`_ class methods?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n    classmethod_decorators =\n        classmethod\n        declared_attr\n        expression\n        comparator\n\n.. _SQLAlchemy: https://www.sqlalchemy.org/\n",
    "bugtrack_url": null,
    "license": "Expat license",
    "summary": "Check PEP-8 naming conventions, plugin for flake8",
    "version": "0.14.0",
    "project_urls": {
        "Changelog": "https://github.com/PyCQA/pep8-naming/blob/main/CHANGELOG.rst",
        "Homepage": "https://github.com/PyCQA/pep8-naming",
        "Issues": "https://github.com/PyCQA/pep8-naming/issues",
        "Source": "https://github.com/PyCQA/pep8-naming"
    },
    "split_keywords": [
        "flake8",
        "pep8",
        "naming"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5272ec315f5dc5601f800322760192bba6e543f925678cc6a54d3e75d794e98",
                "md5": "6a42703c49109541cd7c815e6cccb71d",
                "sha256": "5a74972c7a0f882aa643120c8de16b5d8b8b1636a17ac04dbeaff5ce393aa8b4"
            },
            "downloads": -1,
            "filename": "pep8_naming-0.14.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6a42703c49109541cd7c815e6cccb71d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8860,
            "upload_time": "2024-05-16T21:18:52",
            "upload_time_iso_8601": "2024-05-16T21:18:52.698671Z",
            "url": "https://files.pythonhosted.org/packages/f5/27/2ec315f5dc5601f800322760192bba6e543f925678cc6a54d3e75d794e98/pep8_naming-0.14.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c85c3140be131b7f4632c364481477fc09ecd5f6858dff628e36532548bd55ff",
                "md5": "118065a73e8985aa3a27703e7b0c94ae",
                "sha256": "c2dcf35de7731b4fe1adcea4ca97e0abf52c811b137054edd25816a34016c9cd"
            },
            "downloads": -1,
            "filename": "pep8-naming-0.14.0.tar.gz",
            "has_sig": false,
            "md5_digest": "118065a73e8985aa3a27703e7b0c94ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16525,
            "upload_time": "2024-05-16T21:18:53",
            "upload_time_iso_8601": "2024-05-16T21:18:53.871098Z",
            "url": "https://files.pythonhosted.org/packages/c8/5c/3140be131b7f4632c364481477fc09ecd5f6858dff628e36532548bd55ff/pep8-naming-0.14.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-16 21:18:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PyCQA",
    "github_project": "pep8-naming",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pep8-naming"
}
        
Elapsed time: 0.26526s