prospector


Nameprospector JSON
Version 1.13.2 PyPI version JSON
download
home_pagehttp://prospector.readthedocs.io
SummaryProspector is a tool to analyse Python code by aggregating the result of other tools.
upload_time2024-11-14 10:27:39
maintainerCarl Crowder
docs_urlNone
authorCarl Crowder
requires_python<4.0,>=3.9
licenseGPLv2+
keywords pylint prospector static code analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            prospector
==========

.. image:: https://img.shields.io/pypi/v/prospector.svg
   :target: https://pypi.python.org/pypi/prospector
   :alt: Latest Version of Prospector
.. image:: https://github.com/PyCQA/prospector/actions/workflows/tests.yml/badge.svg
   :target: https://github.com/PyCQA/prospector/actions/workflows/tests.yml
   :alt: Build Status
.. image:: https://img.shields.io/coveralls/PyCQA/prospector.svg?style=flat
   :target: https://coveralls.io/r/PyCQA/prospector
   :alt: Test Coverage
.. image:: https://readthedocs.org/projects/prospector/badge/?version=latest
   :target: https://prospector.readthedocs.io/
   :alt: Documentation


About
-----

Prospector is a tool to analyse Python code and output information about
errors, potential problems, convention violations and complexity.

It brings together the functionality of other Python analysis tools such as
`Pylint <https://docs.pylint.org/>`_,
`pycodestyle <https://pycodestyle.pycqa.org/>`_,
and `McCabe complexity <https://pypi.python.org/pypi/mccabe>`_.
See the `Supported Tools <https://prospector.readthedocs.io/en/latest/supported_tools.html>`_
documentation section for a complete list.

The primary aim of Prospector is to be useful 'out of the box'. A common complaint of other
Python analysis tools is that it takes a long time to filter through which errors are relevant
or interesting to your own coding style. Prospector provides some default profiles, which
hopefully will provide a good starting point and will be useful straight away, and adapts
the output depending on the libraries your project uses.

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

Prospector can be installed from PyPI using ``pip`` by running the following command::

    pip install prospector

Optional dependencies for Prospector, such as ``pyroma`` can also be installed by running::

    pip install prospector[with_pyroma]

Some shells (such as ``Zsh``, the default shell of macOS Catalina) require brackets to be escaped::

    pip install prospector\[with_pyroma\]

For a list of all of the optional dependencies, see the optional extras section on the ReadTheDocs
page on `Supported Tools Extras <https://prospector.readthedocs.io/en/latest/supported_tools.html#optional-extras>`_.

For local development, `poetry <https://python-poetry.org/>`_ is used. Check out the code, then run::

    poetry install

And for extras::

    poetry install -E with_everything

For more detailed information on installing the tool, see the
`installation section <https://prospector.readthedocs.io/en/latest/#installation>`_ of the tool's main page
on ReadTheDocs.

Documentation
-------------

Full `documentation is available at ReadTheDocs <https://prospector.readthedocs.io>`_.

Usage
-----

Simply run prospector from the root of your project::

    prospector

This will output a list of messages pointing out potential problems or errors, for example::

    prospector.tools.base (prospector/tools/base.py):
        L5:0 ToolBase: pylint - R0922
        Abstract class is only referenced 1 times

Options
```````

Run ``prospector --help`` for a full list of options and their effects.

Output Format
~~~~~~~~~~~~~

The default output format of ``prospector`` is designed to be human readable. For parsing
(for example, for reporting), you can use the ``--output-format json`` flag to get JSON-formatted
output.

Profiles
~~~~~~~~

Prospector is configurable using "profiles". These are composable YAML files with directives to
disable or enable tools or messages. For more information, read
`the documentation about profiles <https://prospector.readthedocs.io/en/latest/profiles.html>`_.

If your code uses frameworks and libraries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Often tools such as pylint find errors in code which is not an error, for example due to attributes of classes being
created at run time by a library or framework used by your project.
For example, by default, pylint will generate an error for Django models when accessing ``objects``, as the
``objects`` attribute is not part of the ``Model`` class definition.

Prospector mitigates this by providing an understanding of these frameworks to the underlying tools.

Prospector will try to intuit which libraries your project uses by
`detecting dependencies <https://github.com/landscapeio/requirements-detector>`_ and automatically turning on
support for the requisite libraries. You can see which adaptors were run in the metadata section of the report.

If Prospector does not correctly detect your project's dependencies, you can specify them manually from the commandline::

    prospector --uses django celery

Additionally, if Prospector is automatically detecting a library that you do not in fact use, you can turn
off autodetection completely::

    prospector --no-autodetect

Note that as far as possible, these adaptors have been written as plugins or augmentations for the underlying
tools so that they can be used without requiring Prospector. For example, the Django support is available as a pylint plugin.

Strictness
~~~~~~~~~~

Prospector has a configurable 'strictness' level which will determine how harshly it searches for errors::

    prospector --strictness high

Possible values are ``verylow``, ``low``, ``medium``, ``high``, ``veryhigh``.

Prospector does not include documentation warnings by default, but you can turn
this on using the ``--doc-warnings`` flag.

pre-commit
----------

If you'd like Prospector to be run automatically when making changes to files in your Git
repository, you can install `pre-commit <https://pre-commit.com/>`_ and add the following
text to your repositories' ``.pre-commit-config.yaml``::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0 # The version of Prospector to use, if not 'master' for latest
        hooks:
        -   id: prospector

This only installs base prospector - if you also use optional tools, for example bandit and/or mypy, then you can add
them to the hook configuration like so::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0
        hooks:
        -   id: prospector
            additional_dependencies:
            - ".[with_mypy,with_bandit]"
          - args: [
            '--with-tool=mypy',
            '--with-tool=bandit',
            ]

Additional dependencies can be `individually configured <https://prospector.landscape.io/en/master/profiles.html#individual-configuration-options>`_ in your `prospector.yml` file ::

    # https://bandit.readthedocs.io/en/latest/config.html
    bandit:
    options:
        skips:
        - B201
        - B601
        - B610
        - B611
        - B703

    # https://mypy.readthedocs.io/en/stable/command_line.html
    mypy:
    options:
        ignore-missing-imports: true

For prospector options which affect display only - those which are not configurable using a profile - these can be
added as command line arguments to the hook. For example::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0
        hooks:
        -   id: prospector
            additional_dependencies:
            -   ".[with_mypy,with_bandit]"
            args:
            -   --with-tool=mypy
            -   --with-tool=bandit
            -   --summary-only
            -   --zero-exit



License
-------

Prospector is available under the GPLv2 License.


            

Raw data

            {
    "_id": null,
    "home_page": "http://prospector.readthedocs.io",
    "name": "prospector",
    "maintainer": "Carl Crowder",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "git@carlcrowder.com",
    "keywords": "pylint, prospector, static code analysis",
    "author": "Carl Crowder",
    "author_email": "git@carlcrowder.com",
    "download_url": "https://files.pythonhosted.org/packages/c1/be/52b5094f76725d5cdeb9a3e4f7ad6c38f307e2c68f81b9172635fc465559/prospector-1.13.2.tar.gz",
    "platform": null,
    "description": "prospector\n==========\n\n.. image:: https://img.shields.io/pypi/v/prospector.svg\n   :target: https://pypi.python.org/pypi/prospector\n   :alt: Latest Version of Prospector\n.. image:: https://github.com/PyCQA/prospector/actions/workflows/tests.yml/badge.svg\n   :target: https://github.com/PyCQA/prospector/actions/workflows/tests.yml\n   :alt: Build Status\n.. image:: https://img.shields.io/coveralls/PyCQA/prospector.svg?style=flat\n   :target: https://coveralls.io/r/PyCQA/prospector\n   :alt: Test Coverage\n.. image:: https://readthedocs.org/projects/prospector/badge/?version=latest\n   :target: https://prospector.readthedocs.io/\n   :alt: Documentation\n\n\nAbout\n-----\n\nProspector is a tool to analyse Python code and output information about\nerrors, potential problems, convention violations and complexity.\n\nIt brings together the functionality of other Python analysis tools such as\n`Pylint <https://docs.pylint.org/>`_,\n`pycodestyle <https://pycodestyle.pycqa.org/>`_,\nand `McCabe complexity <https://pypi.python.org/pypi/mccabe>`_.\nSee the `Supported Tools <https://prospector.readthedocs.io/en/latest/supported_tools.html>`_\ndocumentation section for a complete list.\n\nThe primary aim of Prospector is to be useful 'out of the box'. A common complaint of other\nPython analysis tools is that it takes a long time to filter through which errors are relevant\nor interesting to your own coding style. Prospector provides some default profiles, which\nhopefully will provide a good starting point and will be useful straight away, and adapts\nthe output depending on the libraries your project uses.\n\nInstallation\n------------\n\nProspector can be installed from PyPI using ``pip`` by running the following command::\n\n    pip install prospector\n\nOptional dependencies for Prospector, such as ``pyroma`` can also be installed by running::\n\n    pip install prospector[with_pyroma]\n\nSome shells (such as ``Zsh``, the default shell of macOS Catalina) require brackets to be escaped::\n\n    pip install prospector\\[with_pyroma\\]\n\nFor a list of all of the optional dependencies, see the optional extras section on the ReadTheDocs\npage on `Supported Tools Extras <https://prospector.readthedocs.io/en/latest/supported_tools.html#optional-extras>`_.\n\nFor local development, `poetry <https://python-poetry.org/>`_ is used. Check out the code, then run::\n\n    poetry install\n\nAnd for extras::\n\n    poetry install -E with_everything\n\nFor more detailed information on installing the tool, see the\n`installation section <https://prospector.readthedocs.io/en/latest/#installation>`_ of the tool's main page\non ReadTheDocs.\n\nDocumentation\n-------------\n\nFull `documentation is available at ReadTheDocs <https://prospector.readthedocs.io>`_.\n\nUsage\n-----\n\nSimply run prospector from the root of your project::\n\n    prospector\n\nThis will output a list of messages pointing out potential problems or errors, for example::\n\n    prospector.tools.base (prospector/tools/base.py):\n        L5:0 ToolBase: pylint - R0922\n        Abstract class is only referenced 1 times\n\nOptions\n```````\n\nRun ``prospector --help`` for a full list of options and their effects.\n\nOutput Format\n~~~~~~~~~~~~~\n\nThe default output format of ``prospector`` is designed to be human readable. For parsing\n(for example, for reporting), you can use the ``--output-format json`` flag to get JSON-formatted\noutput.\n\nProfiles\n~~~~~~~~\n\nProspector is configurable using \"profiles\". These are composable YAML files with directives to\ndisable or enable tools or messages. For more information, read\n`the documentation about profiles <https://prospector.readthedocs.io/en/latest/profiles.html>`_.\n\nIf your code uses frameworks and libraries\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOften tools such as pylint find errors in code which is not an error, for example due to attributes of classes being\ncreated at run time by a library or framework used by your project.\nFor example, by default, pylint will generate an error for Django models when accessing ``objects``, as the\n``objects`` attribute is not part of the ``Model`` class definition.\n\nProspector mitigates this by providing an understanding of these frameworks to the underlying tools.\n\nProspector will try to intuit which libraries your project uses by\n`detecting dependencies <https://github.com/landscapeio/requirements-detector>`_ and automatically turning on\nsupport for the requisite libraries. You can see which adaptors were run in the metadata section of the report.\n\nIf Prospector does not correctly detect your project's dependencies, you can specify them manually from the commandline::\n\n    prospector --uses django celery\n\nAdditionally, if Prospector is automatically detecting a library that you do not in fact use, you can turn\noff autodetection completely::\n\n    prospector --no-autodetect\n\nNote that as far as possible, these adaptors have been written as plugins or augmentations for the underlying\ntools so that they can be used without requiring Prospector. For example, the Django support is available as a pylint plugin.\n\nStrictness\n~~~~~~~~~~\n\nProspector has a configurable 'strictness' level which will determine how harshly it searches for errors::\n\n    prospector --strictness high\n\nPossible values are ``verylow``, ``low``, ``medium``, ``high``, ``veryhigh``.\n\nProspector does not include documentation warnings by default, but you can turn\nthis on using the ``--doc-warnings`` flag.\n\npre-commit\n----------\n\nIf you'd like Prospector to be run automatically when making changes to files in your Git\nrepository, you can install `pre-commit <https://pre-commit.com/>`_ and add the following\ntext to your repositories' ``.pre-commit-config.yaml``::\n\n    repos:\n    -   repo: https://github.com/PyCQA/prospector\n        rev: 1.10.0 # The version of Prospector to use, if not 'master' for latest\n        hooks:\n        -   id: prospector\n\nThis only installs base prospector - if you also use optional tools, for example bandit and/or mypy, then you can add\nthem to the hook configuration like so::\n\n    repos:\n    -   repo: https://github.com/PyCQA/prospector\n        rev: 1.10.0\n        hooks:\n        -   id: prospector\n            additional_dependencies:\n            - \".[with_mypy,with_bandit]\"\n          - args: [\n            '--with-tool=mypy',\n            '--with-tool=bandit',\n            ]\n\nAdditional dependencies can be `individually configured <https://prospector.landscape.io/en/master/profiles.html#individual-configuration-options>`_ in your `prospector.yml` file ::\n\n    # https://bandit.readthedocs.io/en/latest/config.html\n    bandit:\n    options:\n        skips:\n        - B201\n        - B601\n        - B610\n        - B611\n        - B703\n\n    # https://mypy.readthedocs.io/en/stable/command_line.html\n    mypy:\n    options:\n        ignore-missing-imports: true\n\nFor prospector options which affect display only - those which are not configurable using a profile - these can be\nadded as command line arguments to the hook. For example::\n\n    repos:\n    -   repo: https://github.com/PyCQA/prospector\n        rev: 1.10.0\n        hooks:\n        -   id: prospector\n            additional_dependencies:\n            -   \".[with_mypy,with_bandit]\"\n            args:\n            -   --with-tool=mypy\n            -   --with-tool=bandit\n            -   --summary-only\n            -   --zero-exit\n\n\n\nLicense\n-------\n\nProspector is available under the GPLv2 License.\n\n",
    "bugtrack_url": null,
    "license": "GPLv2+",
    "summary": "Prospector is a tool to analyse Python code by aggregating the result of other tools.",
    "version": "1.13.2",
    "project_urls": {
        "Homepage": "http://prospector.readthedocs.io",
        "Repository": "https://github.com/PyCQA/prospector"
    },
    "split_keywords": [
        "pylint",
        " prospector",
        " static code analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c7cd806fe4a3331bc8b24dbf150c34bea70cffa252c831b484763649874f9e3",
                "md5": "5ed537ac4952df962315643e87cd5fad",
                "sha256": "4f3a654d35c37845b8388856dae851678b1040a828dba071c19cc97f484675b2"
            },
            "downloads": -1,
            "filename": "prospector-1.13.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ed537ac4952df962315643e87cd5fad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 82952,
            "upload_time": "2024-11-14T10:27:38",
            "upload_time_iso_8601": "2024-11-14T10:27:38.482481Z",
            "url": "https://files.pythonhosted.org/packages/0c/7c/d806fe4a3331bc8b24dbf150c34bea70cffa252c831b484763649874f9e3/prospector-1.13.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1be52b5094f76725d5cdeb9a3e4f7ad6c38f307e2c68f81b9172635fc465559",
                "md5": "f11fa69561354c50b6b932aca47b0bbd",
                "sha256": "819f5c17386772c41755509411df3e0dc27b3c0fa95ebe151bacdf0457b9a90f"
            },
            "downloads": -1,
            "filename": "prospector-1.13.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f11fa69561354c50b6b932aca47b0bbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 62911,
            "upload_time": "2024-11-14T10:27:39",
            "upload_time_iso_8601": "2024-11-14T10:27:39.684905Z",
            "url": "https://files.pythonhosted.org/packages/c1/be/52b5094f76725d5cdeb9a3e4f7ad6c38f307e2c68f81b9172635fc465559/prospector-1.13.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-14 10:27:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PyCQA",
    "github_project": "prospector",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "prospector"
}
        
Elapsed time: 0.40497s