pylama


Namepylama JSON
Version 8.4.1 PyPI version JSON
download
home_pagehttps://github.com/klen/pylama
SummaryCode audit tool for python
upload_time2022-08-08 11:27:28
maintainer
docs_urlhttps://pythonhosted.org/pylama/
authorKirill Klenov
requires_python>=3.7
licenseMIT
keywords qa linter pydocstyle pycodestyle mccabe pylint
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            |logo| Pylama
#############

.. _badges:

.. image:: https://github.com/klen/pylama/workflows/tests/badge.svg
    :target: https://github.com/klen/pylama/actions/workflows/tests.yml
    :alt: Tests Status

.. image:: https://github.com/klen/pylama/workflows/docs/badge.svg
    :target: https://klen.github.io/pylama
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/v/pylama
    :target: https://pypi.org/project/pylama/
    :alt: PYPI Version

.. image:: https://img.shields.io/pypi/pyversions/pylama
    :target: https://pypi.org/project/pylama/
    :alt: Python Versions

.. _description:

Code audit tool for Python. Pylama wraps these tools:

* pycodestyle_ (formerly pep8) © 2012-2013, Florent Xicluna;
* pydocstyle_ (formerly pep257 by Vladimir Keleshev) © 2014, Amir Rachum;
* PyFlakes_ © 2005-2013, Kevin Watters;
* Mccabe_ © Ned Batchelder;
* Pylint_ © 2013, Logilab;
* Radon_ © Michele Lacchia
* eradicate_ © Steven Myint;
* Mypy_ © Jukka Lehtosalo and contributors;
* Vulture_ © Jendrik Seipp and contributors;


.. _documentation:

Docs are available at https://klen.github.io/pylama/. Pull requests with
documentation enhancements and/or fixes are awesome and most welcome.


.. _contents:

.. contents::

.. _requirements:

Requirements:
=============

- Python (3.7, 3.8, 3.9, 3.10)
- If your tests are failing on Win platform you are missing: ``curses`` -
  http://www.lfd.uci.edu/~gohlke/pythonlibs/ (The curses library supplies a
  terminal-independent screen-painting and keyboard-handling facility for
  text-based terminals)

For python versions < 3.7 install pylama 7.7.1


.. _installation:

Installation:
=============
**Pylama** can be installed using pip: ::

    $ pip install pylama

TOML configuration can be enabled optionally: ::

    $ pip install pylama[toml]

You may optionally install the requirements with the library: ::

    $ pip install pylama[mypy]
    $ pip install pylama[pylint]
    $ pip install pylama[eradicate]
    $ pip install pylama[radon]
    $ pip install pylama[vulture]

Or install them all: ::

    $ pip install pylama[all]


.. _quickstart:

Quickstart
==========

**Pylama** is easy to use and really fun for checking code quality.  Just run
`pylama` and get common output from all pylama plugins (pycodestyle_,
PyFlakes_, etc.)

Recursively check the current directory. ::

    $ pylama

Recursively check a path. ::

    $ pylama <path_to_directory_or_file>

Ignore errors ::

    $ pylama -i W,E501

.. note:: You can choose a group of errors like `D`, `E1`, etc, or special errors like `C0312`

Choose code checkers ::

    $ pylama -l "pycodestyle,mccabe"


.. _options:

Set Pylama (checkers) options
=============================

Command line options
--------------------

::

    $ pylama --help

    usage: pylama [-h] [--version] [--verbose] [--options FILE] [--linters LINTERS] [--from-stdin] [--concurrent] [--format {pydocstyle,pycodestyle,pylint,parsable,json}] [--abspath]
                  [--max-line-length MAX_LINE_LENGTH] [--select SELECT] [--ignore IGNORE] [--skip SKIP] [--sort SORT] [--report REPORT] [--hook] [--max-complexity MAX_COMPLEXITY]
                  [--pydocstyle-convention {pep257,numpy,google}] [--pylint-confidence {HIGH,INFERENCE,INFERENCE_FAILURE,UNDEFINED}]
                  [paths ...]

    Code audit tool for python.

    positional arguments:
      paths                 Paths to files or directories for code check.

    optional arguments:
      -h, --help            show this help message and exit
      --version             show program's version number and exit
      --verbose, -v         Verbose mode.
      --options FILE, -o FILE
                            Specify configuration file. Looks for pylama.ini, setup.cfg, tox.ini, or pytest.ini in the current directory (default: None)
      --linters LINTERS, -l LINTERS
                            Select linters. (comma-separated). Choices are eradicate,mccabe,mypy,pycodestyle,pydocstyle,pyflakes,pylint,isort.
      --from-stdin          Interpret the stdin as a python script, whose filename needs to be passed as the path argument.
      --concurrent, --async
                            Enable async mode. Useful for checking a lot of files.
      --format {pydocstyle,pycodestyle,pylint,parsable,json}, -f {pydocstyle,pycodestyle,pylint,parsable,json}
                            Choose output format.
      --abspath, -a         Use absolute paths in output.
      --max-line-length MAX_LINE_LENGTH, -m MAX_LINE_LENGTH
                            Maximum allowed line length
      --select SELECT, -s SELECT
                            Select errors and warnings. (comma-separated list)
      --ignore IGNORE, -i IGNORE
                            Ignore errors and warnings. (comma-separated)
      --skip SKIP           Skip files by masks (comma-separated, Ex. */messages.py)
      --sort SORT           Sort result by error types. Ex. E,W,D
      --report REPORT, -r REPORT
                            Send report to file [REPORT]
      --hook                Install Git (Mercurial) hook.
      --max-complexity MAX_COMPLEXITY
                            Max complexity threshold

.. note:: additional options may be available depending on installed linters

.. _modeline:

File modelines
--------------

You can set options for **Pylama** inside a source file. Use
a pylama *modeline* for this, anywhere in the file.

Format: ::

    # pylama:{name1}={value1}:{name2}={value2}:...


For example, ignore warnings except W301: ::

     # pylama:ignore=W:select=W301


Disable code checking for current file: ::

     # pylama:skip=1

Those options have a higher priority.

.. _skiplines:

Skip lines (noqa)
-----------------

Just add ``# noqa`` at the end of a line to ignore:

::

    def urgent_fuction():
        unused_var = 'No errors here' # noqa


.. _config:

Configuration file
==================

**Pylama** looks for a configuration file in the current directory.

You can use a “global” configuration, stored in `.pylama.ini` in your home
directory. This will be used as a fallback configuration.

The program searches for the first matching configuration file in the
directories of command line argument. Pylama looks for the configuration in
this order: ::

    ./pylama.ini
    ./pyproject.toml
    ./setup.cfg
    ./tox.ini
    ./pytest.ini
    ~/.pylama.ini

The ``--option`` / ``-o`` argument can be used to specify a configuration file.

INI-style configuration
-----------------------

Pylama searches for sections whose names start with `pylama`.

The `pylama` section configures global options like `linters` and `skip`.

::

    [pylama]
    format = pylint
    skip = */.tox/*,*/.env/*
    linters = pylint,mccabe
    ignore = F0401,C0111,E731

Set code-checkers' options
^^^^^^^^^^^^^^^^^^^^^^^^^^

You can set options for a special code checkers with pylama configurations.

::

    [pylama:pyflakes]
    builtins = _

    [pylama:pycodestyle]
    max_line_length = 100

    [pylama:pylint]
    max_line_length = 100
    disable = R

See code-checkers' documentation for more info. Note that dashes are
replaced by underscores (e.g. Pylint's ``max-line-length`` becomes
``max_line_length``).


Set options for file (group of files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can set options for special file (group of files)
with sections:

The options have a higher priority than in the `pylama` section.

::

    [pylama:*/pylama/main.py]
    ignore = C901,R0914,W0212
    select = R

    [pylama:*/tests.py]
    ignore = C0110

    [pylama:*/setup.py]
    skip = 1

TOML configuration
-----------------------

Pylama searches for sections whose names start with `tool.pylama`.

The `tool.pylama` section configures global options like `linters` and `skip`.

::

    [tool.pylama]
    format = "pylint"
    skip = "*/.tox/*,*/.env/*"
    linters = "pylint,mccabe"
    ignore = "F0401,C0111,E731"

Set code-checkers' options
^^^^^^^^^^^^^^^^^^^^^^^^^^

You can set options for a special code checkers with pylama configurations.

::

    [tool.pylama.linter.pyflakes]
    builtins = "_"

    [tool.pylama.linter.pycodestyle]
    max_line_length = 100

    [tool.pylama.linter.pylint]
    max_line_length = 100
    disable = "R"

See code-checkers' documentation for more info. Note that dashes are
replaced by underscores (e.g. Pylint's ``max-line-length`` becomes
``max_line_length``).


Set options for file (group of files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can set options for special file (group of files)
with sections:

The options have a higher priority than in the `tool.pylama` section.

::

    [[tool.pylama.files]]
    path = "*/pylama/main.py"
    ignore = "C901,R0914,W0212"
    select = "R"

    [[tool.pylama.files]]
    path = "pylama:*/tests.py"
    ignore = "C0110"

    [[tool.pylama.files]]
    path = "pylama:*/setup.py"
    skip = 1


Pytest integration
==================

Pylama has Pytest_ support. The package automatically registers itself as a pytest
plugin during installation. Pylama also supports the `pytest_cache` plugin.

Check files with pylama ::

    pytest --pylama ...

The recommended way to set pylama options when using pytest — configuration
files (see below).


Writing a linter
================

You can write a custom extension for Pylama.
The custom linter should be a python module. Its name should be like 'pylama_<name>'.

In 'setup.py', 'pylama.linter' entry point should be defined. ::

    setup(
        # ...
        entry_points={
            'pylama.linter': ['lintername = pylama_lintername.main:Linter'],
        }
        # ...
    )

'Linter' should be an instance of 'pylama.lint.Linter' class.
It must implement two methods:

1. ``allow`` takes a `path` argument and returns true if the linter can check this file for errors.
2. ``run`` takes a `path` argument and `meta` keyword arguments and returns a list of errors.

Example:
--------

Just a virtual 'WOW' checker.

setup.py: ::

    setup(
        name='pylama_wow',
        install_requires=[ 'setuptools' ],
        entry_points={
            'pylama.linter': ['wow = pylama_wow.main:Linter'],
        }
        # ...
    )

pylama_wow.py: ::

    from pylama.lint import Linter as BaseLinter

    class Linter(BaseLinter):

        def allow(self, path):
            return 'wow' in path

        def run(self, path, **meta):
            with open(path) as f:
                if 'wow' in f.read():
                    return [{
                        lnum: 0,
                        col: 0,
                        text: '"wow" has been found.',
                        type: 'WOW'
                    }]


Run pylama from python code
---------------------------
::

    from pylama.main import check_paths, parse_options

    # Use and/or modify 0 or more of the options defined as keys in the variable my_redefined_options below.
    # To use defaults for any option, remove that key completely.
    my_redefined_options = {
        'linters': ['pep257', 'pydocstyle', 'pycodestyle', 'pyflakes' ...],
        'ignore': ['D203', 'D213', 'D406', 'D407', 'D413' ...],
        'select': ['R1705' ...],
        'sort': 'F,E,W,C,D,...',
        'skip': '*__init__.py,*/test/*.py,...',
        'async': True,
        'force': True
        ...
    }
    # relative path of the directory in which pylama should check
    my_path = '...'

    options = parse_options([my_path], **my_redefined_options)
    errors = check_paths(my_path, options, rootdir='.')


.. _bagtracker:

Bug tracker
-----------

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/pylama/issues


.. _contributing:

Contributing
------------

Development of `pylama` happens at GitHub: https://github.com/klen/pylama

Contributors
^^^^^^^^^^^^

See CONTRIBUTORS_.


.. _license:

License
-------

This is free software. You are permitted to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of it, under the terms of the MIT
License. See LICENSE file for the complete license.

This software is provided WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
LICENSE file for the complete disclaimer.


.. _links:

.. _CONTRIBUTORS: https://github.com/klen/pylama/graphs/contributors
.. _Mccabe: http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html
.. _pydocstyle: https://github.com/PyCQA/pydocstyle/
.. _pycodestyle: https://github.com/PyCQA/pycodestyle
.. _PyFlakes: https://github.com/pyflakes/pyflakes
.. _Pylint: http://pylint.org
.. _Pytest: http://pytest.org
.. _klen: http://klen.github.io/
.. _eradicate: https://github.com/myint/eradicate
.. _Mypy: https://github.com/python/mypy
.. _Vulture: https://github.com/jendrikseipp/vulture

.. |logo| image:: https://raw.github.com/klen/pylama/develop/docs/_static/logo.png
                  :width: 100
.. _Radon: https://github.com/rubik/radon




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/pylama",
    "name": "pylama",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/pylama/",
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "qa,linter,pydocstyle,pycodestyle,mccabe,pylint",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/4f/b6e14fa7fcc805bdfc970c2505535722bcfac7d2a2ad4da826f4865dc0ef/pylama-8.4.1.tar.gz",
    "platform": null,
    "description": "|logo| Pylama\n#############\n\n.. _badges:\n\n.. image:: https://github.com/klen/pylama/workflows/tests/badge.svg\n    :target: https://github.com/klen/pylama/actions/workflows/tests.yml\n    :alt: Tests Status\n\n.. image:: https://github.com/klen/pylama/workflows/docs/badge.svg\n    :target: https://klen.github.io/pylama\n    :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/v/pylama\n    :target: https://pypi.org/project/pylama/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/pylama\n    :target: https://pypi.org/project/pylama/\n    :alt: Python Versions\n\n.. _description:\n\nCode audit tool for Python. Pylama wraps these tools:\n\n* pycodestyle_ (formerly pep8) \u00a9 2012-2013, Florent Xicluna;\n* pydocstyle_ (formerly pep257 by Vladimir Keleshev) \u00a9 2014, Amir Rachum;\n* PyFlakes_ \u00a9 2005-2013, Kevin Watters;\n* Mccabe_ \u00a9 Ned Batchelder;\n* Pylint_ \u00a9 2013, Logilab;\n* Radon_ \u00a9 Michele Lacchia\n* eradicate_ \u00a9 Steven Myint;\n* Mypy_ \u00a9 Jukka Lehtosalo and contributors;\n* Vulture_ \u00a9 Jendrik Seipp and contributors;\n\n\n.. _documentation:\n\nDocs are available at https://klen.github.io/pylama/. Pull requests with\ndocumentation enhancements and/or fixes are awesome and most welcome.\n\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements:\n=============\n\n- Python (3.7, 3.8, 3.9, 3.10)\n- If your tests are failing on Win platform you are missing: ``curses`` -\n  http://www.lfd.uci.edu/~gohlke/pythonlibs/ (The curses library supplies a\n  terminal-independent screen-painting and keyboard-handling facility for\n  text-based terminals)\n\nFor python versions < 3.7 install pylama 7.7.1\n\n\n.. _installation:\n\nInstallation:\n=============\n**Pylama** can be installed using pip: ::\n\n    $ pip install pylama\n\nTOML configuration can be enabled optionally: ::\n\n    $ pip install pylama[toml]\n\nYou may optionally install the requirements with the library: ::\n\n    $ pip install pylama[mypy]\n    $ pip install pylama[pylint]\n    $ pip install pylama[eradicate]\n    $ pip install pylama[radon]\n    $ pip install pylama[vulture]\n\nOr install them all: ::\n\n    $ pip install pylama[all]\n\n\n.. _quickstart:\n\nQuickstart\n==========\n\n**Pylama** is easy to use and really fun for checking code quality.  Just run\n`pylama` and get common output from all pylama plugins (pycodestyle_,\nPyFlakes_, etc.)\n\nRecursively check the current directory. ::\n\n    $ pylama\n\nRecursively check a path. ::\n\n    $ pylama <path_to_directory_or_file>\n\nIgnore errors ::\n\n    $ pylama -i W,E501\n\n.. note:: You can choose a group of errors like `D`, `E1`, etc, or special errors like `C0312`\n\nChoose code checkers ::\n\n    $ pylama -l \"pycodestyle,mccabe\"\n\n\n.. _options:\n\nSet Pylama (checkers) options\n=============================\n\nCommand line options\n--------------------\n\n::\n\n    $ pylama --help\n\n    usage: pylama [-h] [--version] [--verbose] [--options FILE] [--linters LINTERS] [--from-stdin] [--concurrent] [--format {pydocstyle,pycodestyle,pylint,parsable,json}] [--abspath]\n                  [--max-line-length MAX_LINE_LENGTH] [--select SELECT] [--ignore IGNORE] [--skip SKIP] [--sort SORT] [--report REPORT] [--hook] [--max-complexity MAX_COMPLEXITY]\n                  [--pydocstyle-convention {pep257,numpy,google}] [--pylint-confidence {HIGH,INFERENCE,INFERENCE_FAILURE,UNDEFINED}]\n                  [paths ...]\n\n    Code audit tool for python.\n\n    positional arguments:\n      paths                 Paths to files or directories for code check.\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --version             show program's version number and exit\n      --verbose, -v         Verbose mode.\n      --options FILE, -o FILE\n                            Specify configuration file. Looks for pylama.ini, setup.cfg, tox.ini, or pytest.ini in the current directory (default: None)\n      --linters LINTERS, -l LINTERS\n                            Select linters. (comma-separated). Choices are eradicate,mccabe,mypy,pycodestyle,pydocstyle,pyflakes,pylint,isort.\n      --from-stdin          Interpret the stdin as a python script, whose filename needs to be passed as the path argument.\n      --concurrent, --async\n                            Enable async mode. Useful for checking a lot of files.\n      --format {pydocstyle,pycodestyle,pylint,parsable,json}, -f {pydocstyle,pycodestyle,pylint,parsable,json}\n                            Choose output format.\n      --abspath, -a         Use absolute paths in output.\n      --max-line-length MAX_LINE_LENGTH, -m MAX_LINE_LENGTH\n                            Maximum allowed line length\n      --select SELECT, -s SELECT\n                            Select errors and warnings. (comma-separated list)\n      --ignore IGNORE, -i IGNORE\n                            Ignore errors and warnings. (comma-separated)\n      --skip SKIP           Skip files by masks (comma-separated, Ex. */messages.py)\n      --sort SORT           Sort result by error types. Ex. E,W,D\n      --report REPORT, -r REPORT\n                            Send report to file [REPORT]\n      --hook                Install Git (Mercurial) hook.\n      --max-complexity MAX_COMPLEXITY\n                            Max complexity threshold\n\n.. note:: additional options may be available depending on installed linters\n\n.. _modeline:\n\nFile modelines\n--------------\n\nYou can set options for **Pylama** inside a source file. Use\na pylama *modeline* for this, anywhere in the file.\n\nFormat: ::\n\n    # pylama:{name1}={value1}:{name2}={value2}:...\n\n\nFor example, ignore warnings except W301: ::\n\n     # pylama:ignore=W:select=W301\n\n\nDisable code checking for current file: ::\n\n     # pylama:skip=1\n\nThose options have a higher priority.\n\n.. _skiplines:\n\nSkip lines (noqa)\n-----------------\n\nJust add ``# noqa`` at the end of a line to ignore:\n\n::\n\n    def urgent_fuction():\n        unused_var = 'No errors here' # noqa\n\n\n.. _config:\n\nConfiguration file\n==================\n\n**Pylama** looks for a configuration file in the current directory.\n\nYou can use a \u201cglobal\u201d configuration, stored in `.pylama.ini` in your home\ndirectory. This will be used as a fallback configuration.\n\nThe program searches for the first matching configuration file in the\ndirectories of command line argument. Pylama looks for the configuration in\nthis order: ::\n\n    ./pylama.ini\n    ./pyproject.toml\n    ./setup.cfg\n    ./tox.ini\n    ./pytest.ini\n    ~/.pylama.ini\n\nThe ``--option`` / ``-o`` argument can be used to specify a configuration file.\n\nINI-style configuration\n-----------------------\n\nPylama searches for sections whose names start with `pylama`.\n\nThe `pylama` section configures global options like `linters` and `skip`.\n\n::\n\n    [pylama]\n    format = pylint\n    skip = */.tox/*,*/.env/*\n    linters = pylint,mccabe\n    ignore = F0401,C0111,E731\n\nSet code-checkers' options\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can set options for a special code checkers with pylama configurations.\n\n::\n\n    [pylama:pyflakes]\n    builtins = _\n\n    [pylama:pycodestyle]\n    max_line_length = 100\n\n    [pylama:pylint]\n    max_line_length = 100\n    disable = R\n\nSee code-checkers' documentation for more info. Note that dashes are\nreplaced by underscores (e.g. Pylint's ``max-line-length`` becomes\n``max_line_length``).\n\n\nSet options for file (group of files)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can set options for special file (group of files)\nwith sections:\n\nThe options have a higher priority than in the `pylama` section.\n\n::\n\n    [pylama:*/pylama/main.py]\n    ignore = C901,R0914,W0212\n    select = R\n\n    [pylama:*/tests.py]\n    ignore = C0110\n\n    [pylama:*/setup.py]\n    skip = 1\n\nTOML configuration\n-----------------------\n\nPylama searches for sections whose names start with `tool.pylama`.\n\nThe `tool.pylama` section configures global options like `linters` and `skip`.\n\n::\n\n    [tool.pylama]\n    format = \"pylint\"\n    skip = \"*/.tox/*,*/.env/*\"\n    linters = \"pylint,mccabe\"\n    ignore = \"F0401,C0111,E731\"\n\nSet code-checkers' options\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can set options for a special code checkers with pylama configurations.\n\n::\n\n    [tool.pylama.linter.pyflakes]\n    builtins = \"_\"\n\n    [tool.pylama.linter.pycodestyle]\n    max_line_length = 100\n\n    [tool.pylama.linter.pylint]\n    max_line_length = 100\n    disable = \"R\"\n\nSee code-checkers' documentation for more info. Note that dashes are\nreplaced by underscores (e.g. Pylint's ``max-line-length`` becomes\n``max_line_length``).\n\n\nSet options for file (group of files)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can set options for special file (group of files)\nwith sections:\n\nThe options have a higher priority than in the `tool.pylama` section.\n\n::\n\n    [[tool.pylama.files]]\n    path = \"*/pylama/main.py\"\n    ignore = \"C901,R0914,W0212\"\n    select = \"R\"\n\n    [[tool.pylama.files]]\n    path = \"pylama:*/tests.py\"\n    ignore = \"C0110\"\n\n    [[tool.pylama.files]]\n    path = \"pylama:*/setup.py\"\n    skip = 1\n\n\nPytest integration\n==================\n\nPylama has Pytest_ support. The package automatically registers itself as a pytest\nplugin during installation. Pylama also supports the `pytest_cache` plugin.\n\nCheck files with pylama ::\n\n    pytest --pylama ...\n\nThe recommended way to set pylama options when using pytest \u2014 configuration\nfiles (see below).\n\n\nWriting a linter\n================\n\nYou can write a custom extension for Pylama.\nThe custom linter should be a python module. Its name should be like 'pylama_<name>'.\n\nIn 'setup.py', 'pylama.linter' entry point should be defined. ::\n\n    setup(\n        # ...\n        entry_points={\n            'pylama.linter': ['lintername = pylama_lintername.main:Linter'],\n        }\n        # ...\n    )\n\n'Linter' should be an instance of 'pylama.lint.Linter' class.\nIt must implement two methods:\n\n1. ``allow`` takes a `path` argument and returns true if the linter can check this file for errors.\n2. ``run`` takes a `path` argument and `meta` keyword arguments and returns a list of errors.\n\nExample:\n--------\n\nJust a virtual 'WOW' checker.\n\nsetup.py: ::\n\n    setup(\n        name='pylama_wow',\n        install_requires=[ 'setuptools' ],\n        entry_points={\n            'pylama.linter': ['wow = pylama_wow.main:Linter'],\n        }\n        # ...\n    )\n\npylama_wow.py: ::\n\n    from pylama.lint import Linter as BaseLinter\n\n    class Linter(BaseLinter):\n\n        def allow(self, path):\n            return 'wow' in path\n\n        def run(self, path, **meta):\n            with open(path) as f:\n                if 'wow' in f.read():\n                    return [{\n                        lnum: 0,\n                        col: 0,\n                        text: '\"wow\" has been found.',\n                        type: 'WOW'\n                    }]\n\n\nRun pylama from python code\n---------------------------\n::\n\n    from pylama.main import check_paths, parse_options\n\n    # Use and/or modify 0 or more of the options defined as keys in the variable my_redefined_options below.\n    # To use defaults for any option, remove that key completely.\n    my_redefined_options = {\n        'linters': ['pep257', 'pydocstyle', 'pycodestyle', 'pyflakes' ...],\n        'ignore': ['D203', 'D213', 'D406', 'D407', 'D413' ...],\n        'select': ['R1705' ...],\n        'sort': 'F,E,W,C,D,...',\n        'skip': '*__init__.py,*/test/*.py,...',\n        'async': True,\n        'force': True\n        ...\n    }\n    # relative path of the directory in which pylama should check\n    my_path = '...'\n\n    options = parse_options([my_path], **my_redefined_options)\n    errors = check_paths(my_path, options, rootdir='.')\n\n\n.. _bagtracker:\n\nBug tracker\n-----------\n\nIf you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/pylama/issues\n\n\n.. _contributing:\n\nContributing\n------------\n\nDevelopment of `pylama` happens at GitHub: https://github.com/klen/pylama\n\nContributors\n^^^^^^^^^^^^\n\nSee CONTRIBUTORS_.\n\n\n.. _license:\n\nLicense\n-------\n\nThis is free software. You are permitted to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of it, under the terms of the MIT\nLicense. See LICENSE file for the complete license.\n\nThis software is provided WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\nLICENSE file for the complete disclaimer.\n\n\n.. _links:\n\n.. _CONTRIBUTORS: https://github.com/klen/pylama/graphs/contributors\n.. _Mccabe: http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html\n.. _pydocstyle: https://github.com/PyCQA/pydocstyle/\n.. _pycodestyle: https://github.com/PyCQA/pycodestyle\n.. _PyFlakes: https://github.com/pyflakes/pyflakes\n.. _Pylint: http://pylint.org\n.. _Pytest: http://pytest.org\n.. _klen: http://klen.github.io/\n.. _eradicate: https://github.com/myint/eradicate\n.. _Mypy: https://github.com/python/mypy\n.. _Vulture: https://github.com/jendrikseipp/vulture\n\n.. |logo| image:: https://raw.github.com/klen/pylama/develop/docs/_static/logo.png\n                  :width: 100\n.. _Radon: https://github.com/rubik/radon\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Code audit tool for python",
    "version": "8.4.1",
    "split_keywords": [
        "qa",
        "linter",
        "pydocstyle",
        "pycodestyle",
        "mccabe",
        "pylint"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "dca83da7a5031973a8f207525046ee77",
                "sha256": "5bbdbf5b620aba7206d688ed9fc917ecd3d73e15ec1a89647037a09fa3a86e60"
            },
            "downloads": -1,
            "filename": "pylama-8.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dca83da7a5031973a8f207525046ee77",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 33151,
            "upload_time": "2022-08-08T11:27:26",
            "upload_time_iso_8601": "2022-08-08T11:27:26.957088Z",
            "url": "https://files.pythonhosted.org/packages/4d/3c/11be5c276f593f70d858db28e913449af76f07a1fb60612ef4131edc4527/pylama-8.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a722c874571acb580f3faa0b4a04e6bb",
                "sha256": "2d4f7aecfb5b7466216d48610c7d6bad1c3990c29cdd392ad08259b161e486f6"
            },
            "downloads": -1,
            "filename": "pylama-8.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a722c874571acb580f3faa0b4a04e6bb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 33616,
            "upload_time": "2022-08-08T11:27:28",
            "upload_time_iso_8601": "2022-08-08T11:27:28.752175Z",
            "url": "https://files.pythonhosted.org/packages/bf/4f/b6e14fa7fcc805bdfc970c2505535722bcfac7d2a2ad4da826f4865dc0ef/pylama-8.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-08 11:27:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "klen",
    "github_project": "pylama",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pylama"
}
        
Elapsed time: 0.03434s