python-dev-tools
Advanced tools
| [tool.poetry] | ||
| name = "python_dev_tools" | ||
| version = "2020.9.1" | ||
| description = "Needed and up-to-date tools to develop in Python" | ||
| classifiers=[ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: BSD License", | ||
| "Natural Language :: English", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.6", | ||
| "Programming Language :: Python :: 3.7", | ||
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Topic :: Utilities", | ||
| ] | ||
| authors = ["Vincent Poulailleau <vpoulailleau@gmail.com>"] | ||
| readme = "README.rst" | ||
| repository = "https://github.com/vpoulailleau/python-dev-tools" | ||
| homepage = "https://github.com/vpoulailleau/python-dev-tools" | ||
| documentation = "https://python-dev-tools.readthedocs.io/en/latest/" | ||
| keywords = ["python_dev_tools", "development", "tools"] | ||
| license = "BSD-3-Clause" | ||
| include = ["python_dev_tools/**/*.py"] | ||
| [tool.poetry.dependencies] | ||
| python = ">=3.6.1,<4.0" | ||
| autoflake = "^1.3.0" | ||
| bandit = "^1.6.0" | ||
| black = "^19.10b0" | ||
| coverage = "^5.0.0" | ||
| doc8 = "^0.8.0" | ||
| flake8 = "^3.8.0" | ||
| flake8-2020 = "^1.6.0" | ||
| flake8-bandit = "^2.1.0" | ||
| flake8-broken-line = "^0.2.0" | ||
| flake8-bugbear = "^19.3" | ||
| flake8-builtins = "^1.4.0" | ||
| flake8-comprehensions = "^3.2.0" | ||
| flake8-debugger = "^3.2.0" | ||
| flake8-docstrings = "^1.5.0" | ||
| flake8-fixme = "^1.1.0" | ||
| flake8-isort = ">=3.0.1,<4" | ||
| flake8-logging-format = "^0.6.0" | ||
| flake8-mutable = "^1.2.0" | ||
| flake8-variables-names = "^0.0.3" | ||
| isort = "^4.3.5" | ||
| mccabe = "^0.6.0" | ||
| pip = "^20.0.0" | ||
| pep8-naming = "^0.9.0" | ||
| pycodestyle = "^2.5.0" | ||
| pydocstyle = "^5.0.0" | ||
| pyflakes = "^2.1.0" | ||
| pytest = "^6.0.0" | ||
| pytest-cov = "^2.10.0" | ||
| pyupgrade = "^2.1.0" | ||
| Sphinx = "^2.4.0" | ||
| # TODO too old dependencies "wemake-python-styleguide = "^0.8.1" | ||
| tox = "^3.19.0" | ||
| tox-travis = "^0.12" | ||
| wemake-python-styleguide = "^0.14.1" | ||
| [tool.poetry.scripts] | ||
| whatalinter = "python_dev_tools.whatalinter:main" | ||
| whataformatter = "python_dev_tools.whataformatter:main" | ||
| [tool.tox] | ||
| legacy_tox_ini = """ | ||
| [tox] | ||
| isolated_build = True | ||
| envlist = py36, py37, py38 | ||
| [testenv] | ||
| whitelist_externals = | ||
| poetry | ||
| echo | ||
| sed | ||
| cp | ||
| changedir = {toxinidir}/tests | ||
| commands = | ||
| poetry install -v | ||
| poetry run pytest -s -vv --cov=python_dev_tools | ||
| poetry run coverage xml | ||
| echo 'fix travis bug' | ||
| sed --in-place -e 's#//home#/home#g' coverage.xml | ||
| echo 'fix codeclimate bug, use relative path' | ||
| sed --in-place -e 's#/home.*vpoulailleau/python_dev_tools/##g' coverage.xml | ||
| cp coverage.xml ../coverage.xml | ||
| """ | ||
| [build-system] | ||
| requires = ["poetry>=0.12"] | ||
| build-backend = "poetry.masonry.api" |
+251
-228
| Metadata-Version: 2.1 | ||
| Name: python_dev_tools | ||
| Version: 2020.2.5 | ||
| Name: python-dev-tools | ||
| Version: 2020.9.1 | ||
| Summary: Needed and up-to-date tools to develop in Python | ||
| Home-page: https://github.com/vpoulailleau/python-dev-tools | ||
| License: BSD-3-Clause | ||
| Keywords: python_dev_tools,development,tools | ||
| Author: Vincent Poulailleau | ||
| Author-email: vpoulailleau@gmail.com | ||
| License: BSD license | ||
| Description: Python Dev Tools | ||
| ================ | ||
| Needed and up-to-date tools to develop in Python (*WORK IN PROGRESS*) | ||
| .. image:: https://img.shields.io/pypi/v/python_dev_tools.svg | ||
| :target: https://pypi.python.org/pypi/python_dev_tools | ||
| .. image:: https://img.shields.io/pypi/l/python_dev_tools.svg | ||
| :target: https://github.com/vpoulailleau/python_dev_tools/blob/master/LICENSE | ||
| .. image:: https://travis-ci.com/vpoulailleau/python-dev-tools.svg?branch=master | ||
| :target: https://travis-ci.com/vpoulailleau/python-dev-tools | ||
| .. image:: https://readthedocs.org/projects/python-dev-tools/badge/?version=latest | ||
| :target: https://python-dev-tools.readthedocs.io/en/latest/?badge=latest | ||
| :alt: Documentation Status | ||
| .. image:: https://pepy.tech/badge/python-dev-tools | ||
| :target: https://pepy.tech/project/python-dev-tools | ||
| :alt: Downloads | ||
| .. image:: https://coveralls.io/repos/github/vpoulailleau/python-dev-tools/badge.svg?branch=HEAD | ||
| :target: https://coveralls.io/github/vpoulailleau/python-dev-tools?branch=HEAD | ||
| :alt: Coverage Status | ||
| .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/maintainability | ||
| :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/maintainability | ||
| :alt: Maintainability | ||
| .. image:: https://bettercodehub.com/edge/badge/vpoulailleau/python-dev-tools?branch=master | ||
| :target: https://bettercodehub.com/results/vpoulailleau/python-dev-tools | ||
| :alt: Maintainability | ||
| .. image:: https://img.shields.io/lgtm/grade/python/g/vpoulailleau/python-dev-tools.svg?logo=lgtm&logoWidth=1 | ||
| :target: https://lgtm.com/projects/g/vpoulailleau/python-dev-tools/context:python | ||
| :alt: Maintainability | ||
| Documentation | ||
| ------------- | ||
| The full documentation can be read at https://python-dev-tools.readthedocs.io. | ||
| Installation | ||
| ------------ | ||
| Install pipx if not yet installed: https://pipxproject.github.io/pipx/installation/ | ||
| Then in a terminal, run: | ||
| .. code-block:: console | ||
| $ pipx install python-dev-tools | ||
| Then add the new :code:`bin` directory to the path. On Linux for instance, run: | ||
| .. code-block:: console | ||
| $ TOOLS_PATH=$(ls -l ~/.local/bin/whataformatter | sed -e "s/.*-> //" | sed -e "s#/bin.*#/bin#") | ||
| $ userpath prepend $TOOLS_PATH | ||
| Full documentation on installation: https://python-dev-tools.readthedocs.io/en/latest/installation.html | ||
| That's it! Use the provided linter, formatter and precommit hook where | ||
| applicable. | ||
| Upgrade | ||
| ------- | ||
| If not using pipx, follow again the installation procedure. | ||
| If using pipx (preferred installation method), run in a terminal: | ||
| .. code-block:: console | ||
| $ pipx upgrade python-dev-tools | ||
| Installation with Visual Studio Code | ||
| ------------------------------------ | ||
| * Follow the installation procedure for python-dev-tools | ||
| * Be sure to have the official Python extension installed in VS Code | ||
| * In VS Code, open settings (F1 key, then type "Open Settings (JSON)", | ||
| then enter) | ||
| * Add in the opened JSON file: | ||
| .. code:: javascript | ||
| "python.linting.enabled": true, | ||
| "python.linting.flake8Enabled": true, | ||
| "python.linting.flake8Path": "~/.local/bin/whatalinter", | ||
| "python.formatting.provider": "black", | ||
| "python.formatting.blackPath": "~/.local/bin/whataformatter", | ||
| "python.formatting.blackArgs": [], | ||
| * Adapt the previous path according to your installation. | ||
| Features | ||
| -------- | ||
| Integrate features of commonly used tools. This package provides usual | ||
| dependencies to develop Python software. | ||
| * Simple linter | ||
| * ``whatalinter a_python_file.py`` lints a_python_file.py | ||
| * output is compatible with the one of pycodestyle (formerly named pep8) for | ||
| easy integration in text editors and IDE | ||
| * based on | ||
| * pycodestyle: https://github.com/PyCQA/pycodestyle | ||
| * pyflakes: https://github.com/PyCQA/pyflakes | ||
| * mccabe: https://github.com/pycqa/mccabe | ||
| * pydocstyle: https://github.com/PyCQA/pydocstyle | ||
| * flake8 and plugins: https://gitlab.com/pycqa/flake8 | ||
| * flake8-2020: https://github.com/asottile/flake8-2020 | ||
| * flake8-bandit: https://github.com/tylerwince/flake8-bandit | ||
| * flake8-broken-line: https://github.com/sobolevn/flake8-broken-line | ||
| * flake8-bugbear: https://github.com/PyCQA/flake8-bugbear | ||
| * flake8-builtins: https://github.com/gforcada/flake8-builtins | ||
| * flake8-comprehensions: https://github.com/adamchainz/flake8-comprehensions | ||
| * flake8-debugger: https://github.com/JBKahn/flake8-debugger | ||
| * flake8-fixme: https://github.com/tommilligan/flake8-fixme | ||
| * flake8-isort: https://github.com/gforcada/flake8-isort | ||
| * flake8-logging-format: https://github.com/globality-corp/flake8-logging-format | ||
| * flake8-mutable: https://github.com/ebeweber/flake8-mutable | ||
| * flake8-variables-names: https://github.com/best-doctor/flake8-variables-names | ||
| * pep8-naming: https://github.com/PyCQA/pep8-naming | ||
| * Simple formatter | ||
| * ``whataformatter a_python_file.py`` formats a_python_file.py | ||
| * based on | ||
| * autoflake: https://github.com/myint/autoflake | ||
| * black: https://github.com/python/black | ||
| * pyupgrade: https://github.com/asottile/pyupgrade | ||
| * Simple precommit hook | ||
| * TODO | ||
| License | ||
| ------- | ||
| BSD 3-Clause license, feel free to contribute: https://python-dev-tools.readthedocs.io/en/latest/contributing.html. | ||
| TODO | ||
| ---- | ||
| * documentation | ||
| * precommit | ||
| Credits | ||
| ------- | ||
| This package was created with Cookiecutter_ and the | ||
| `audreyr/cookiecutter-pypackage`_ project template. | ||
| .. _Cookiecutter: https://github.com/audreyr/cookiecutter | ||
| .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage | ||
| History | ||
| ======= | ||
| 2019.10.22 | ||
| ---------- | ||
| * Add flake8-2020 linter | ||
| 2019.07.21 | ||
| ---------- | ||
| * Add --quiet and --diff flags to whataformatter for VS Code compatibility | ||
| 2019.07.20 | ||
| ---------- | ||
| * Add black formatter | ||
| * Add autoflake formatter | ||
| * Add pyupgrade formatter | ||
| 2019.04.08 | ||
| ---------- | ||
| * Add flake8 linter | ||
| * Add flake8-isort linter | ||
| * Add pep8-naming linter | ||
| * Add flake8-comprehensions linter | ||
| * Add flake8-logging-format linter | ||
| * Add flake8-bugbear linter | ||
| * Add flake8-builtins linter | ||
| * Add flake8-broken-line linter | ||
| * Add flake8-fixme linter | ||
| * Add flake8-mutable linter | ||
| * Add flake8-debugger linter | ||
| * Add flake8-variables-names linter | ||
| * Add flake8-bandit linter | ||
| 2019.03.02 | ||
| ---------- | ||
| * Add pydocstyle linter | ||
| 2019.03.01 | ||
| ---------- | ||
| * Add McCabe complexity checker | ||
| 2019.02.26 | ||
| ---------- | ||
| * Add pyflakes linter | ||
| * Add pycodestyle linter | ||
| 2019.02.23 | ||
| ---------- | ||
| * First release on PyPI. | ||
| Keywords: python_dev_tools | ||
| Platform: UNKNOWN | ||
| Requires-Python: >=3.6.1,<4.0 | ||
| Classifier: Development Status :: 4 - Beta | ||
@@ -242,2 +19,248 @@ Classifier: Intended Audience :: Developers | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Topic :: Utilities | ||
| Requires-Dist: Sphinx (>=2.4.0,<3.0.0) | ||
| Requires-Dist: autoflake (>=1.3.0,<2.0.0) | ||
| Requires-Dist: bandit (>=1.6.0,<2.0.0) | ||
| Requires-Dist: black (>=19.10b0,<20.0) | ||
| Requires-Dist: coverage (>=5.0.0,<6.0.0) | ||
| Requires-Dist: doc8 (>=0.8.0,<0.9.0) | ||
| Requires-Dist: flake8 (>=3.8.0,<4.0.0) | ||
| Requires-Dist: flake8-2020 (>=1.6.0,<2.0.0) | ||
| Requires-Dist: flake8-bandit (>=2.1.0,<3.0.0) | ||
| Requires-Dist: flake8-broken-line (>=0.2.0,<0.3.0) | ||
| Requires-Dist: flake8-bugbear (>=19.3,<20.0) | ||
| Requires-Dist: flake8-builtins (>=1.4.0,<2.0.0) | ||
| Requires-Dist: flake8-comprehensions (>=3.2.0,<4.0.0) | ||
| Requires-Dist: flake8-debugger (>=3.2.0,<4.0.0) | ||
| Requires-Dist: flake8-docstrings (>=1.5.0,<2.0.0) | ||
| Requires-Dist: flake8-fixme (>=1.1.0,<2.0.0) | ||
| Requires-Dist: flake8-isort (>=3.0.1,<4) | ||
| Requires-Dist: flake8-logging-format (>=0.6.0,<0.7.0) | ||
| Requires-Dist: flake8-mutable (>=1.2.0,<2.0.0) | ||
| Requires-Dist: flake8-variables-names (>=0.0.3,<0.0.4) | ||
| Requires-Dist: isort (>=4.3.5,<5.0.0) | ||
| Requires-Dist: mccabe (>=0.6.0,<0.7.0) | ||
| Requires-Dist: pep8-naming (>=0.9.0,<0.10.0) | ||
| Requires-Dist: pip (>=20.0.0,<21.0.0) | ||
| Requires-Dist: pycodestyle (>=2.5.0,<3.0.0) | ||
| Requires-Dist: pydocstyle (>=5.0.0,<6.0.0) | ||
| Requires-Dist: pyflakes (>=2.1.0,<3.0.0) | ||
| Requires-Dist: pytest (>=6.0.0,<7.0.0) | ||
| Requires-Dist: pytest-cov (>=2.10.0,<3.0.0) | ||
| Requires-Dist: pyupgrade (>=2.1.0,<3.0.0) | ||
| Requires-Dist: tox (>=3.19.0,<4.0.0) | ||
| Requires-Dist: tox-travis (>=0.12,<0.13) | ||
| Requires-Dist: wemake-python-styleguide (>=0.14.1,<0.15.0) | ||
| Project-URL: Documentation, https://python-dev-tools.readthedocs.io/en/latest/ | ||
| Project-URL: Repository, https://github.com/vpoulailleau/python-dev-tools | ||
| Description-Content-Type: text/x-rst | ||
| Python Dev Tools | ||
| ================ | ||
| Needed and up-to-date tools to develop in Python (*WORK IN PROGRESS*) | ||
| .. image:: https://img.shields.io/pypi/v/python_dev_tools.svg | ||
| :target: https://pypi.python.org/pypi/python_dev_tools | ||
| .. image:: https://img.shields.io/pypi/l/python_dev_tools.svg | ||
| :target: https://github.com/vpoulailleau/python_dev_tools/blob/master/LICENSE | ||
| .. image:: https://travis-ci.com/vpoulailleau/python-dev-tools.svg?branch=master | ||
| :target: https://travis-ci.com/vpoulailleau/python-dev-tools | ||
| .. image:: https://readthedocs.org/projects/python-dev-tools/badge/?version=latest | ||
| :target: https://python-dev-tools.readthedocs.io/en/latest/?badge=latest | ||
| :alt: Documentation Status | ||
| .. image:: https://pepy.tech/badge/python-dev-tools | ||
| :target: https://pepy.tech/project/python-dev-tools | ||
| :alt: Downloads | ||
| .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/test_coverage | ||
| :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/test_coverage | ||
| :alt: Test Coverage | ||
| .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/maintainability | ||
| :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/maintainability | ||
| :alt: Maintainability | ||
| .. image:: https://bettercodehub.com/edge/badge/vpoulailleau/python-dev-tools?branch=master | ||
| :target: https://bettercodehub.com/results/vpoulailleau/python-dev-tools | ||
| :alt: Maintainability | ||
| .. image:: https://img.shields.io/lgtm/grade/python/g/vpoulailleau/python-dev-tools.svg?logo=lgtm&logoWidth=1 | ||
| :target: https://lgtm.com/projects/g/vpoulailleau/python-dev-tools/context:python | ||
| :alt: Maintainability | ||
| Documentation | ||
| ------------- | ||
| The full documentation can be read at https://python-dev-tools.readthedocs.io. | ||
| Installation | ||
| ------------ | ||
| In a terminal, run: | ||
| .. code-block:: console | ||
| $ python3 -m pip install python-dev-tools --user | ||
| Full documentation on installation: https://python-dev-tools.readthedocs.io/en/latest/installation.html | ||
| That's it! Use the provided linter, formatter and precommit hook where | ||
| applicable. | ||
| Upgrade | ||
| ------- | ||
| .. code-block:: console | ||
| $ python3 -m pip install python-dev-tools --user --upgrade | ||
| Installation with Visual Studio Code | ||
| ------------------------------------ | ||
| * Follow the installation procedure for python-dev-tools | ||
| * Be sure to have the official Python extension installed in VS Code | ||
| * In VS Code, open settings (F1 key, then type "Open Settings (JSON)", | ||
| then enter) | ||
| * Add in the opened JSON file: | ||
| .. code:: javascript | ||
| "python.linting.enabled": true, | ||
| "python.linting.flake8Enabled": true, | ||
| "python.linting.flake8Path": "flake8", | ||
| "python.formatting.provider": "black", | ||
| "python.formatting.blackPath": "whataformatter", | ||
| "python.formatting.blackArgs": [], | ||
| * Adapt the previous path according to your installation. | ||
| Features | ||
| -------- | ||
| Integrate features of commonly used tools. This package provides usual | ||
| dependencies to develop Python software. | ||
| * Simple linter | ||
| * ``whatalinter a_python_file.py`` lints a_python_file.py | ||
| * output is compatible with the one of pycodestyle (formerly named pep8) for | ||
| easy integration in text editors and IDE | ||
| * based on | ||
| * pydocstyle: https://github.com/PyCQA/pydocstyle | ||
| * flake8 and plugins: https://gitlab.com/pycqa/flake8 | ||
| * flake8-2020: https://github.com/asottile/flake8-2020 | ||
| * flake8-bandit: https://github.com/tylerwince/flake8-bandit | ||
| * flake8-broken-line: https://github.com/sobolevn/flake8-broken-line | ||
| * flake8-bugbear: https://github.com/PyCQA/flake8-bugbear | ||
| * flake8-builtins: https://github.com/gforcada/flake8-builtins | ||
| * flake8-comprehensions: https://github.com/adamchainz/flake8-comprehensions | ||
| * flake8-debugger: https://github.com/JBKahn/flake8-debugger | ||
| * flake8-docstrings: https://gitlab.com/pycqa/flake8-docstrings | ||
| * flake8-fixme: https://github.com/tommilligan/flake8-fixme | ||
| * flake8-isort: https://github.com/gforcada/flake8-isort | ||
| * flake8-logging-format: https://github.com/globality-corp/flake8-logging-format | ||
| * flake8-mutable: https://github.com/ebeweber/flake8-mutable | ||
| * flake8-variables-names: https://github.com/best-doctor/flake8-variables-names | ||
| * pep8-naming: https://github.com/PyCQA/pep8-naming | ||
| * wemake-python-styleguide: https://github.com/wemake-services/wemake-python-styleguide | ||
| * Simple formatter | ||
| * ``whataformatter a_python_file.py`` formats a_python_file.py | ||
| * based on | ||
| * autoflake: https://github.com/myint/autoflake | ||
| * black: https://github.com/python/black | ||
| * pyupgrade: https://github.com/asottile/pyupgrade | ||
| * Simple precommit hook | ||
| * TODO | ||
| License | ||
| ------- | ||
| BSD 3-Clause license, feel free to contribute: https://python-dev-tools.readthedocs.io/en/latest/contributing.html. | ||
| TODO | ||
| ---- | ||
| * documentation | ||
| * precommit | ||
| Changelog | ||
| --------- | ||
| 2020.9.1 | ||
| ^^^^^^^^ | ||
| * Use ``poetry`` | ||
| * Remove redundant linters | ||
| * Change max line length to 88 (default value of ``black``) | ||
| * Replace ``pydocstyle`` with ``flake8-docstrings`` | ||
| * Add ``wemake-python-styleguide`` | ||
| 2019.10.22 | ||
| ^^^^^^^^^^ | ||
| * Add flake8-2020 linter | ||
| 2019.07.21 | ||
| ^^^^^^^^^^ | ||
| * Add --quiet and --diff flags to whataformatter for VS Code compatibility | ||
| 2019.07.20 | ||
| ^^^^^^^^^^ | ||
| * Add black formatter | ||
| * Add autoflake formatter | ||
| * Add pyupgrade formatter | ||
| 2019.04.08 | ||
| ^^^^^^^^^^ | ||
| * Add flake8 linter | ||
| * Add flake8-isort linter | ||
| * Add pep8-naming linter | ||
| * Add flake8-comprehensions linter | ||
| * Add flake8-logging-format linter | ||
| * Add flake8-bugbear linter | ||
| * Add flake8-builtins linter | ||
| * Add flake8-broken-line linter | ||
| * Add flake8-fixme linter | ||
| * Add flake8-mutable linter | ||
| * Add flake8-debugger linter | ||
| * Add flake8-variables-names linter | ||
| * Add flake8-bandit linter | ||
| 2019.03.02 | ||
| ^^^^^^^^^^ | ||
| * Add pydocstyle linter | ||
| 2019.03.01 | ||
| ^^^^^^^^^^ | ||
| * Add McCabe complexity checker | ||
| 2019.02.26 | ||
| ^^^^^^^^^^ | ||
| * Add pyflakes linter | ||
| * Add pycodestyle linter | ||
| 2019.02.23 | ||
| ^^^^^^^^^^ | ||
| * First release on PyPI. | ||
@@ -44,2 +44,3 @@ """Common constants and class to all linters.""" | ||
| self.charno, | ||
| self.tool, | ||
| self.message_id, | ||
@@ -102,3 +103,3 @@ self.message, | ||
| tool="whatalinter", | ||
| message_id=f"E999", | ||
| message_id="E999", | ||
| filename=str(filepath), | ||
@@ -149,3 +150,3 @@ lineno=1, | ||
| else: | ||
| print("ERROR parsing", line) | ||
| print("ERROR parsing:", line) | ||
| return message | ||
@@ -156,19 +157,17 @@ | ||
| messages = [] | ||
| message = "" | ||
| message = None | ||
| regex_index = 0 | ||
| for line in output.splitlines(): | ||
| if regex_index == 0: | ||
| message = cls._parse_line( | ||
| line, cls.regex[regex_index], None, tool=cls.name | ||
| ) | ||
| else: | ||
| message = cls._parse_line( | ||
| line, cls.regex[regex_index], message | ||
| ) | ||
| message = cls._parse_line( | ||
| line, cls.regex[regex_index], message, tool=cls.name | ||
| ) | ||
| if regex_index == len(cls.regex) - 1: | ||
| regex_index = 0 | ||
| messages.append(message) | ||
| else: | ||
| regex_index += 1 | ||
| if isinstance(message, LinterMessage): | ||
| if regex_index == len(cls.regex) - 1: | ||
| regex_index = 0 | ||
| messages.append(message) | ||
| message = None | ||
| else: | ||
| regex_index += 1 | ||
| return messages |
@@ -24,4 +24,18 @@ """Flake8 linter management.""" | ||
| with contextlib.redirect_stdout(stdout): | ||
| main([cls.path, str(filepath), "--exit-zero"]) | ||
| try: | ||
| main( | ||
| [ | ||
| str(filepath), | ||
| "--exit-zero", | ||
| "--max-line-length", | ||
| "88", | ||
| "--max-complexity", | ||
| "10", | ||
| ] | ||
| ) | ||
| except SystemExit: | ||
| # TODO what do we do here? | ||
| pass | ||
| messages = cls._parse_output(stdout.getvalue()) | ||
| return messages |
| """Definition of lint function, calling all linters.""" | ||
| from .flake8 import Flake8Linter | ||
| from .mccabe import MccabeLinter | ||
| from .pycodestyle import PycodestyleLinter | ||
| from .pydocstyle import PydocstyleLinter | ||
| from .pyflakes import PyflakesLinter | ||
| linters = [ | ||
| PyflakesLinter, | ||
| PycodestyleLinter, | ||
| MccabeLinter, | ||
| PydocstyleLinter, | ||
| Flake8Linter, | ||
@@ -15,0 +7,0 @@ ] |
@@ -58,6 +58,3 @@ """Formatter module, aggregation of formatters.""" | ||
| difflib.unified_diff( | ||
| orig_content, | ||
| copy_content, | ||
| fromfile="origin", | ||
| tofile="formatted", | ||
| orig_content, copy_content, fromfile="origin", tofile="formatted", | ||
| ) | ||
@@ -64,0 +61,0 @@ ) |
@@ -34,6 +34,3 @@ """Linter module, aggregation of linters.""" | ||
| parser.add_argument( | ||
| "-f", | ||
| "--format", | ||
| default=DEFAULT_MESSAGE_FORMAT, | ||
| help="format of the output", | ||
| "-f", "--format", default=DEFAULT_MESSAGE_FORMAT, help="format of the output", | ||
| ) | ||
@@ -40,0 +37,0 @@ parser.add_argument( |
+74
-30
@@ -24,5 +24,5 @@ Python Dev Tools | ||
| .. image:: https://coveralls.io/repos/github/vpoulailleau/python-dev-tools/badge.svg?branch=HEAD | ||
| :target: https://coveralls.io/github/vpoulailleau/python-dev-tools?branch=HEAD | ||
| :alt: Coverage Status | ||
| .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/test_coverage | ||
| :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/test_coverage | ||
| :alt: Test Coverage | ||
@@ -49,17 +49,8 @@ .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/maintainability | ||
| Install pipx if not yet installed: https://pipxproject.github.io/pipx/installation/ | ||
| In a terminal, run: | ||
| Then in a terminal, run: | ||
| .. code-block:: console | ||
| $ pipx install python-dev-tools | ||
| $ python3 -m pip install python-dev-tools --user | ||
| Then add the new :code:`bin` directory to the path. On Linux for instance, run: | ||
| .. code-block:: console | ||
| $ TOOLS_PATH=$(ls -l ~/.local/bin/whataformatter | sed -e "s/.*-> //" | sed -e "s#/bin.*#/bin#") | ||
| $ userpath prepend $TOOLS_PATH | ||
| Full documentation on installation: https://python-dev-tools.readthedocs.io/en/latest/installation.html | ||
@@ -73,9 +64,5 @@ | ||
| If not using pipx, follow again the installation procedure. | ||
| If using pipx (preferred installation method), run in a terminal: | ||
| .. code-block:: console | ||
| $ pipx upgrade python-dev-tools | ||
| $ python3 -m pip install python-dev-tools --user --upgrade | ||
@@ -95,5 +82,5 @@ Installation with Visual Studio Code | ||
| "python.linting.flake8Enabled": true, | ||
| "python.linting.flake8Path": "~/.local/bin/whatalinter", | ||
| "python.linting.flake8Path": "flake8", | ||
| "python.formatting.provider": "black", | ||
| "python.formatting.blackPath": "~/.local/bin/whataformatter", | ||
| "python.formatting.blackPath": "whataformatter", | ||
| "python.formatting.blackArgs": [], | ||
@@ -116,5 +103,2 @@ | ||
| * pycodestyle: https://github.com/PyCQA/pycodestyle | ||
| * pyflakes: https://github.com/PyCQA/pyflakes | ||
| * mccabe: https://github.com/pycqa/mccabe | ||
| * pydocstyle: https://github.com/PyCQA/pydocstyle | ||
@@ -130,2 +114,3 @@ * flake8 and plugins: https://gitlab.com/pycqa/flake8 | ||
| * flake8-debugger: https://github.com/JBKahn/flake8-debugger | ||
| * flake8-docstrings: https://gitlab.com/pycqa/flake8-docstrings | ||
| * flake8-fixme: https://github.com/tommilligan/flake8-fixme | ||
@@ -137,2 +122,3 @@ * flake8-isort: https://github.com/gforcada/flake8-isort | ||
| * pep8-naming: https://github.com/PyCQA/pep8-naming | ||
| * wemake-python-styleguide: https://github.com/wemake-services/wemake-python-styleguide | ||
@@ -163,9 +149,67 @@ * Simple formatter | ||
| Credits | ||
| ------- | ||
| Changelog | ||
| --------- | ||
| This package was created with Cookiecutter_ and the | ||
| `audreyr/cookiecutter-pypackage`_ project template. | ||
| 2020.9.1 | ||
| ^^^^^^^^ | ||
| .. _Cookiecutter: https://github.com/audreyr/cookiecutter | ||
| .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage | ||
| * Use ``poetry`` | ||
| * Remove redundant linters | ||
| * Change max line length to 88 (default value of ``black``) | ||
| * Replace ``pydocstyle`` with ``flake8-docstrings`` | ||
| * Add ``wemake-python-styleguide`` | ||
| 2019.10.22 | ||
| ^^^^^^^^^^ | ||
| * Add flake8-2020 linter | ||
| 2019.07.21 | ||
| ^^^^^^^^^^ | ||
| * Add --quiet and --diff flags to whataformatter for VS Code compatibility | ||
| 2019.07.20 | ||
| ^^^^^^^^^^ | ||
| * Add black formatter | ||
| * Add autoflake formatter | ||
| * Add pyupgrade formatter | ||
| 2019.04.08 | ||
| ^^^^^^^^^^ | ||
| * Add flake8 linter | ||
| * Add flake8-isort linter | ||
| * Add pep8-naming linter | ||
| * Add flake8-comprehensions linter | ||
| * Add flake8-logging-format linter | ||
| * Add flake8-bugbear linter | ||
| * Add flake8-builtins linter | ||
| * Add flake8-broken-line linter | ||
| * Add flake8-fixme linter | ||
| * Add flake8-mutable linter | ||
| * Add flake8-debugger linter | ||
| * Add flake8-variables-names linter | ||
| * Add flake8-bandit linter | ||
| 2019.03.02 | ||
| ^^^^^^^^^^ | ||
| * Add pydocstyle linter | ||
| 2019.03.01 | ||
| ^^^^^^^^^^ | ||
| * Add McCabe complexity checker | ||
| 2019.02.26 | ||
| ^^^^^^^^^^ | ||
| * Add pyflakes linter | ||
| * Add pycodestyle linter | ||
| 2019.02.23 | ||
| ^^^^^^^^^^ | ||
| * First release on PyPI. |
+60
-82
@@ -1,89 +0,67 @@ | ||
| """The setup script.""" | ||
| # -*- coding: utf-8 -*- | ||
| from setuptools import setup | ||
| from setuptools import find_packages, setup | ||
| packages = \ | ||
| ['python_dev_tools', 'python_dev_tools.formatters', 'python_dev_tools.linters'] | ||
| with open("README.rst") as readme_file: | ||
| readme = readme_file.read() | ||
| package_data = \ | ||
| {'': ['*']} | ||
| with open("HISTORY.rst") as history_file: | ||
| history = history_file.read() | ||
| install_requires = \ | ||
| ['Sphinx>=2.4.0,<3.0.0', | ||
| 'autoflake>=1.3.0,<2.0.0', | ||
| 'bandit>=1.6.0,<2.0.0', | ||
| 'black>=19.10b0,<20.0', | ||
| 'coverage>=5.0.0,<6.0.0', | ||
| 'doc8>=0.8.0,<0.9.0', | ||
| 'flake8-2020>=1.6.0,<2.0.0', | ||
| 'flake8-bandit>=2.1.0,<3.0.0', | ||
| 'flake8-broken-line>=0.2.0,<0.3.0', | ||
| 'flake8-bugbear>=19.3,<20.0', | ||
| 'flake8-builtins>=1.4.0,<2.0.0', | ||
| 'flake8-comprehensions>=3.2.0,<4.0.0', | ||
| 'flake8-debugger>=3.2.0,<4.0.0', | ||
| 'flake8-docstrings>=1.5.0,<2.0.0', | ||
| 'flake8-fixme>=1.1.0,<2.0.0', | ||
| 'flake8-isort>=3.0.1,<4', | ||
| 'flake8-logging-format>=0.6.0,<0.7.0', | ||
| 'flake8-mutable>=1.2.0,<2.0.0', | ||
| 'flake8-variables-names>=0.0.3,<0.0.4', | ||
| 'flake8>=3.8.0,<4.0.0', | ||
| 'isort>=4.3.5,<5.0.0', | ||
| 'mccabe>=0.6.0,<0.7.0', | ||
| 'pep8-naming>=0.9.0,<0.10.0', | ||
| 'pip>=20.0.0,<21.0.0', | ||
| 'pycodestyle>=2.5.0,<3.0.0', | ||
| 'pydocstyle>=5.0.0,<6.0.0', | ||
| 'pyflakes>=2.1.0,<3.0.0', | ||
| 'pytest-cov>=2.10.0,<3.0.0', | ||
| 'pytest>=6.0.0,<7.0.0', | ||
| 'pyupgrade>=2.1.0,<3.0.0', | ||
| 'tox-travis>=0.12,<0.13', | ||
| 'tox>=3.19.0,<4.0.0', | ||
| 'wemake-python-styleguide>=0.14.1,<0.15.0'] | ||
| requirements = [ | ||
| "autoflake==1.3.1", | ||
| "bandit==1.6.2", | ||
| "black==19.10b0", | ||
| "bumpversion==0.5.3", | ||
| "coverage==5.0.3", | ||
| "coveralls[yaml]==1.10.0", | ||
| "doc8==0.8.0", | ||
| "flake8==3.7.9", | ||
| "flake8-2020==1.5.0", | ||
| "flake8-bandit==2.1.2", | ||
| "flake8-broken-line==0.1.1", | ||
| "flake8-bugbear==20.1.4", | ||
| "flake8-builtins==1.4.2", | ||
| # TODO when we have a better formatter "flake8-commas==2.0.0", | ||
| "flake8-comprehensions==3.2.2", | ||
| "flake8-debugger==3.2.1", | ||
| "flake8-fixme==1.1.1", | ||
| "flake8-isort==2.8.0", | ||
| "flake8-mutable==1.2.0", | ||
| "flake8-logging-format==0.6.0", | ||
| "flake8-variables-names==0.0.3", | ||
| "isort==4.3.21", | ||
| "mccabe==0.6.1", | ||
| "pip==20.0.2", | ||
| "pep8-naming==0.9.1", | ||
| "pycodestyle==2.5.0", | ||
| "pydocstyle==5.0.2", | ||
| "pyflakes==2.1.1", | ||
| "pytest==5.3.5", | ||
| "pytest-cov==2.8.1", | ||
| "pytest-runner==5.2", | ||
| "pyupgrade==1.26.2", | ||
| "Sphinx==2.3.1", | ||
| "tox==3.14.3", | ||
| "twine==3.1.1", | ||
| # TODO too old dependencies "wemake-python-styleguide==0.8.1", | ||
| "wheel==0.34.2", | ||
| ] | ||
| entry_points = \ | ||
| {'console_scripts': ['whataformatter = python_dev_tools.whataformatter:main', | ||
| 'whatalinter = python_dev_tools.whatalinter:main']} | ||
| setup_requirements = ["pytest-runner==5.2"] | ||
| setup_kwargs = { | ||
| 'name': 'python-dev-tools', | ||
| 'version': '2020.9.1', | ||
| 'description': 'Needed and up-to-date tools to develop in Python', | ||
| 'long_description': 'Python Dev Tools\n================\n\nNeeded and up-to-date tools to develop in Python (*WORK IN PROGRESS*)\n\n\n.. image:: https://img.shields.io/pypi/v/python_dev_tools.svg\n :target: https://pypi.python.org/pypi/python_dev_tools\n\n.. image:: https://img.shields.io/pypi/l/python_dev_tools.svg\n :target: https://github.com/vpoulailleau/python_dev_tools/blob/master/LICENSE\n\n.. image:: https://travis-ci.com/vpoulailleau/python-dev-tools.svg?branch=master\n :target: https://travis-ci.com/vpoulailleau/python-dev-tools\n\n.. image:: https://readthedocs.org/projects/python-dev-tools/badge/?version=latest\n :target: https://python-dev-tools.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://pepy.tech/badge/python-dev-tools\n :target: https://pepy.tech/project/python-dev-tools\n :alt: Downloads\n\n.. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/test_coverage\n :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/test_coverage\n :alt: Test Coverage\n\n.. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/maintainability\n :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/maintainability\n :alt: Maintainability\n\n.. image:: https://bettercodehub.com/edge/badge/vpoulailleau/python-dev-tools?branch=master\n :target: https://bettercodehub.com/results/vpoulailleau/python-dev-tools\n :alt: Maintainability\n\n.. image:: https://img.shields.io/lgtm/grade/python/g/vpoulailleau/python-dev-tools.svg?logo=lgtm&logoWidth=1\n :target: https://lgtm.com/projects/g/vpoulailleau/python-dev-tools/context:python\n :alt: Maintainability\n\nDocumentation\n-------------\n\nThe full documentation can be read at https://python-dev-tools.readthedocs.io.\n\nInstallation\n------------\n\nIn a terminal, run:\n\n.. code-block:: console\n\n $ python3 -m pip install python-dev-tools --user\n\nFull documentation on installation: https://python-dev-tools.readthedocs.io/en/latest/installation.html\n\nThat\'s it! Use the provided linter, formatter and precommit hook where\napplicable.\n\nUpgrade\n-------\n\n.. code-block:: console\n\n $ python3 -m pip install python-dev-tools --user --upgrade\n\nInstallation with Visual Studio Code\n------------------------------------\n\n* Follow the installation procedure for python-dev-tools\n* Be sure to have the official Python extension installed in VS Code\n* In VS Code, open settings (F1 key, then type "Open Settings (JSON)",\n then enter)\n* Add in the opened JSON file:\n\n.. code:: javascript\n\n "python.linting.enabled": true,\n "python.linting.flake8Enabled": true,\n "python.linting.flake8Path": "flake8",\n "python.formatting.provider": "black",\n "python.formatting.blackPath": "whataformatter",\n "python.formatting.blackArgs": [],\n\n* Adapt the previous path according to your installation.\n\nFeatures\n--------\n\nIntegrate features of commonly used tools. This package provides usual\ndependencies to develop Python software.\n\n* Simple linter\n\n * ``whatalinter a_python_file.py`` lints a_python_file.py\n * output is compatible with the one of pycodestyle (formerly named pep8) for\n easy integration in text editors and IDE\n * based on\n\n * pydocstyle: https://github.com/PyCQA/pydocstyle\n * flake8 and plugins: https://gitlab.com/pycqa/flake8\n\n * flake8-2020: https://github.com/asottile/flake8-2020\n * flake8-bandit: https://github.com/tylerwince/flake8-bandit\n * flake8-broken-line: https://github.com/sobolevn/flake8-broken-line\n * flake8-bugbear: https://github.com/PyCQA/flake8-bugbear\n * flake8-builtins: https://github.com/gforcada/flake8-builtins\n * flake8-comprehensions: https://github.com/adamchainz/flake8-comprehensions\n * flake8-debugger: https://github.com/JBKahn/flake8-debugger\n * flake8-docstrings: https://gitlab.com/pycqa/flake8-docstrings\n * flake8-fixme: https://github.com/tommilligan/flake8-fixme\n * flake8-isort: https://github.com/gforcada/flake8-isort\n * flake8-logging-format: https://github.com/globality-corp/flake8-logging-format\n * flake8-mutable: https://github.com/ebeweber/flake8-mutable\n * flake8-variables-names: https://github.com/best-doctor/flake8-variables-names\n * pep8-naming: https://github.com/PyCQA/pep8-naming\n * wemake-python-styleguide: https://github.com/wemake-services/wemake-python-styleguide\n\n* Simple formatter\n\n * ``whataformatter a_python_file.py`` formats a_python_file.py\n * based on\n\n * autoflake: https://github.com/myint/autoflake\n * black: https://github.com/python/black\n * pyupgrade: https://github.com/asottile/pyupgrade\n\n* Simple precommit hook\n\n * TODO\n\nLicense\n-------\n\nBSD 3-Clause license, feel free to contribute: https://python-dev-tools.readthedocs.io/en/latest/contributing.html.\n\nTODO\n----\n\n* documentation\n* precommit\n\nChangelog\n---------\n\n2020.9.1\n^^^^^^^^\n\n* Use ``poetry``\n* Remove redundant linters\n* Change max line length to 88 (default value of ``black``)\n* Replace ``pydocstyle`` with ``flake8-docstrings``\n* Add ``wemake-python-styleguide``\n\n2019.10.22\n^^^^^^^^^^\n\n* Add flake8-2020 linter\n\n2019.07.21\n^^^^^^^^^^\n\n* Add --quiet and --diff flags to whataformatter for VS Code compatibility\n\n2019.07.20\n^^^^^^^^^^\n\n* Add black formatter\n* Add autoflake formatter\n* Add pyupgrade formatter\n\n2019.04.08\n^^^^^^^^^^\n\n* Add flake8 linter\n* Add flake8-isort linter\n* Add pep8-naming linter\n* Add flake8-comprehensions linter\n* Add flake8-logging-format linter\n* Add flake8-bugbear linter\n* Add flake8-builtins linter\n* Add flake8-broken-line linter\n* Add flake8-fixme linter\n* Add flake8-mutable linter\n* Add flake8-debugger linter\n* Add flake8-variables-names linter\n* Add flake8-bandit linter\n\n2019.03.02\n^^^^^^^^^^\n\n* Add pydocstyle linter\n\n2019.03.01\n^^^^^^^^^^\n\n* Add McCabe complexity checker\n\n2019.02.26\n^^^^^^^^^^\n\n* Add pyflakes linter\n* Add pycodestyle linter\n\n2019.02.23\n^^^^^^^^^^\n\n* First release on PyPI.\n', | ||
| 'author': 'Vincent Poulailleau', | ||
| 'author_email': 'vpoulailleau@gmail.com', | ||
| 'maintainer': None, | ||
| 'maintainer_email': None, | ||
| 'url': 'https://github.com/vpoulailleau/python-dev-tools', | ||
| 'packages': packages, | ||
| 'package_data': package_data, | ||
| 'install_requires': install_requires, | ||
| 'entry_points': entry_points, | ||
| 'python_requires': '>=3.6.1,<4.0', | ||
| } | ||
| test_requirements = ["pytest==5.3.5"] | ||
| setup( | ||
| author="Vincent Poulailleau", | ||
| author_email="vpoulailleau@gmail.com", | ||
| entry_points={ | ||
| "console_scripts": [ | ||
| "whatalinter = python_dev_tools.whatalinter:main", | ||
| "whataformatter = python_dev_tools.whataformatter:main", | ||
| ] | ||
| }, | ||
| classifiers=[ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: BSD License", | ||
| "Natural Language :: English", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.6", | ||
| "Programming Language :: Python :: 3.7", | ||
| "Programming Language :: Python :: 3.8", | ||
| ], | ||
| description="Needed and up-to-date tools to develop in Python", | ||
| install_requires=requirements, | ||
| license="BSD license", | ||
| long_description=readme + "\n\n" + history, | ||
| long_description_content_type="text/x-rst", | ||
| include_package_data=True, | ||
| keywords="python_dev_tools", | ||
| name="python_dev_tools", | ||
| packages=find_packages(include=["python_dev_tools*"]), | ||
| setup_requires=setup_requirements, | ||
| test_suite="tests", | ||
| tests_require=test_requirements, | ||
| url="https://github.com/vpoulailleau/python-dev-tools", | ||
| version="2020.02.05", | ||
| zip_safe=False, | ||
| ) | ||
| setup(**setup_kwargs) |
-13
| ======= | ||
| Credits | ||
| ======= | ||
| Development Lead | ||
| ---------------- | ||
| * Vincent Poulailleau <vpoulailleau@gmail.com> | ||
| Contributors | ||
| ------------ | ||
| None yet. Why not be the first? |
-125
| .. highlight:: shell | ||
| ============ | ||
| Contributing | ||
| ============ | ||
| Contributions are welcome, and they are greatly appreciated! Every little bit | ||
| helps, and credit will always be given. | ||
| You can contribute in many ways: | ||
| Types of Contributions | ||
| ---------------------- | ||
| Report Bugs | ||
| ~~~~~~~~~~~ | ||
| Report bugs at https://github.com/vpoulailleau/python_dev_tools/issues. | ||
| If you are reporting a bug, please include: | ||
| * Your operating system name and version. | ||
| * Any details about your local setup that might be helpful in troubleshooting. | ||
| * Detailed steps to reproduce the bug. | ||
| Fix Bugs | ||
| ~~~~~~~~ | ||
| Look through the GitHub issues for bugs. Anything tagged with "bug" and "help | ||
| wanted" is open to whoever wants to implement it. | ||
| Implement Features | ||
| ~~~~~~~~~~~~~~~~~~ | ||
| Look through the GitHub issues for features. Anything tagged with "enhancement" | ||
| and "help wanted" is open to whoever wants to implement it. | ||
| Write Documentation | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
| Python Dev Tools could always use more documentation, whether as part of the | ||
| official Python Dev Tools docs, in docstrings, or even on the web in blog | ||
| posts, articles, and such. | ||
| Submit Feedback | ||
| ~~~~~~~~~~~~~~~ | ||
| The best way to send feedback is to file an issue at https://github.com/vpoulailleau/python_dev_tools/issues. | ||
| If you are proposing a feature: | ||
| * Explain in detail how it would work. | ||
| * Keep the scope as narrow as possible, to make it easier to implement. | ||
| * Remember that this is a volunteer-driven project, and that contributions | ||
| are welcome :) | ||
| Get Started! | ||
| ------------ | ||
| Ready to contribute? Here's how to set up `python_dev_tools` for local | ||
| development. | ||
| 1. Fork the `python_dev_tools` repo on GitHub. | ||
| 2. Clone your fork locally:: | ||
| $ git clone git@github.com:your_name_here/python_dev_tools.git | ||
| 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: | ||
| $ mkvirtualenv python_dev_tools | ||
| $ cd python_dev_tools/ | ||
| $ python setup.py develop | ||
| 4. Create a branch for local development:: | ||
| $ git checkout -b name-of-your-bugfix-or-feature | ||
| Now you can make your changes locally. | ||
| 5. When you're done making changes, check that your changes pass flake8 and the | ||
| tests, including testing other Python versions with tox:: | ||
| $ flake8 python_dev_tools tests | ||
| $ python setup.py test or py.test | ||
| $ tox | ||
| To get flake8 and tox, just pip install them into your virtualenv. | ||
| 6. Commit your changes and push your branch to GitHub:: | ||
| $ git add . | ||
| $ git commit -m "Your detailed description of your changes." | ||
| $ git push origin name-of-your-bugfix-or-feature | ||
| 7. Submit a pull request through the GitHub website. | ||
| Pull Request Guidelines | ||
| ----------------------- | ||
| Before you submit a pull request, check that it meets these guidelines: | ||
| 1. The pull request should include tests. | ||
| 2. If the pull request adds functionality, the docs should be updated. Put | ||
| your new functionality into a function with a docstring, and add the | ||
| feature to the list in README.rst. | ||
| 3. The pull request should work for Python 3.6 and 3.7, and for PyPy. Check | ||
| https://travis-ci.org/vpoulailleau/python_dev_tools/pull_requests | ||
| and make sure that the tests pass for all supported Python versions. | ||
| Tips | ||
| ---- | ||
| To run a subset of tests:: | ||
| $ py.test tests.test_python_dev_tools | ||
| Deploying | ||
| --------- | ||
| A reminder for the maintainers on how to deploy. | ||
| Make sure all your changes are committed (including an entry in HISTORY.rst). | ||
| Then run:: | ||
| $ ./deploy.sh |
| .. include:: ../AUTHORS.rst |
-168
| #!/usr/bin/env python | ||
| # | ||
| # python_dev_tools documentation build configuration file, created by | ||
| # sphinx-quickstart on Fri Jun 9 13:47:02 2017. | ||
| # | ||
| # This file is execfile()d with the current directory set to its | ||
| # containing dir. | ||
| # | ||
| # Note that not all possible configuration values are present in this | ||
| # autogenerated file. | ||
| # | ||
| # All configuration values have a default; values that are commented out | ||
| # serve to show the default. | ||
| # If extensions (or modules to document with autodoc) are in another | ||
| # directory, add these directories to sys.path here. If the directory is | ||
| # relative to the documentation root, use os.path.abspath to make it | ||
| # absolute, like shown here. | ||
| # | ||
| import os | ||
| import sys | ||
| sys.path.insert(0, os.path.abspath("..")) | ||
| import python_dev_tools | ||
| # -- General configuration --------------------------------------------- | ||
| # If your documentation needs a minimal Sphinx version, state it here. | ||
| # | ||
| # needs_sphinx = '1.0' | ||
| # Add any Sphinx extension module names here, as strings. They can be | ||
| # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. | ||
| extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"] | ||
| # Add any paths that contain templates here, relative to this directory. | ||
| templates_path = ["_templates"] | ||
| # The suffix(es) of source filenames. | ||
| # You can specify multiple suffix as a list of string: | ||
| # | ||
| # source_suffix = ['.rst', '.md'] | ||
| source_suffix = ".rst" | ||
| # The master toctree document. | ||
| master_doc = "index" | ||
| # General information about the project. | ||
| project = "Python Dev Tools" | ||
| copyright = "2019, Vincent Poulailleau" | ||
| author = "Vincent Poulailleau" | ||
| # The version info for the project you're documenting, acts as replacement | ||
| # for |version| and |release|, also used in various other places throughout | ||
| # the built documents. | ||
| # | ||
| # The short X.Y version. | ||
| version = python_dev_tools.__version__ | ||
| # The full version, including alpha/beta/rc tags. | ||
| release = python_dev_tools.__version__ | ||
| # The language for content autogenerated by Sphinx. Refer to documentation | ||
| # for a list of supported languages. | ||
| # | ||
| # This is also used if you do content translation via gettext catalogs. | ||
| # Usually you set "language" from the command line for these cases. | ||
| language = None | ||
| # List of patterns, relative to source directory, that match files and | ||
| # directories to ignore when looking for source files. | ||
| # This patterns also effect to html_static_path and html_extra_path | ||
| exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
| # The name of the Pygments (syntax highlighting) style to use. | ||
| pygments_style = "sphinx" | ||
| # If true, `todo` and `todoList` produce output, else they produce nothing. | ||
| todo_include_todos = False | ||
| # -- Options for HTML output ------------------------------------------- | ||
| # The theme to use for HTML and HTML Help pages. See the documentation for | ||
| # a list of builtin themes. | ||
| # | ||
| html_theme = "alabaster" | ||
| # Theme options are theme-specific and customize the look and feel of a | ||
| # theme further. For a list of options available for each theme, see the | ||
| # documentation. | ||
| # | ||
| # html_theme_options = {} | ||
| # Add any paths that contain custom static files (such as style sheets) here, | ||
| # relative to this directory. They are copied after the builtin static files, | ||
| # so a file named "default.css" will overwrite the builtin "default.css". | ||
| html_static_path = ["_static"] | ||
| # -- Options for HTMLHelp output --------------------------------------- | ||
| # Output file base name for HTML help builder. | ||
| htmlhelp_basename = "python_dev_toolsdoc" | ||
| # -- Options for LaTeX output ------------------------------------------ | ||
| latex_elements = { | ||
| # The paper size ('letterpaper' or 'a4paper'). | ||
| # | ||
| # 'papersize': 'letterpaper', | ||
| # The font size ('10pt', '11pt' or '12pt'). | ||
| # | ||
| # 'pointsize': '10pt', | ||
| # Additional stuff for the LaTeX preamble. | ||
| # | ||
| # 'preamble': '', | ||
| # Latex figure (float) alignment | ||
| # | ||
| # 'figure_align': 'htbp', | ||
| } | ||
| # Grouping the document tree into LaTeX files. List of tuples | ||
| # (source start file, target name, title, author, documentclass | ||
| # [howto, manual, or own class]). | ||
| latex_documents = [ | ||
| ( | ||
| master_doc, | ||
| "python_dev_tools.tex", | ||
| "Python Dev Tools Documentation", | ||
| "Vincent Poulailleau", | ||
| "manual", | ||
| ) | ||
| ] | ||
| # -- Options for manual page output ------------------------------------ | ||
| # One entry per manual page. List of tuples | ||
| # (source start file, name, description, authors, manual section). | ||
| man_pages = [ | ||
| ( | ||
| master_doc, | ||
| "python_dev_tools", | ||
| "Python Dev Tools Documentation", | ||
| [author], | ||
| 1, | ||
| ) | ||
| ] | ||
| # -- Options for Texinfo output ---------------------------------------- | ||
| # Grouping the document tree into Texinfo files. List of tuples | ||
| # (source start file, target name, title, author, | ||
| # dir menu entry, description, category) | ||
| texinfo_documents = [ | ||
| ( | ||
| master_doc, | ||
| "python_dev_tools", | ||
| "Python Dev Tools Documentation", | ||
| author, | ||
| "python_dev_tools", | ||
| "One line description of project.", | ||
| "Miscellaneous", | ||
| ) | ||
| ] |
| .. include:: ../CONTRIBUTING.rst |
| .. include:: ../HISTORY.rst |
| Welcome to Python Dev Tools's documentation! | ||
| ====================================== | ||
| .. toctree:: | ||
| :maxdepth: 2 | ||
| :caption: Contents: | ||
| readme | ||
| installation | ||
| usage | ||
| modules | ||
| contributing | ||
| authors | ||
| history | ||
| Indices and tables | ||
| ================== | ||
| * :ref:`genindex` | ||
| * :ref:`modindex` | ||
| * :ref:`search` |
| .. highlight:: shell | ||
| ============ | ||
| Installation | ||
| ============ | ||
| Stable release | ||
| -------------- | ||
| Preferred installation method | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Install pipx if not yet installed: https://pipxproject.github.io/pipx/installation/ | ||
| Then in a terminal, run: | ||
| .. code-block:: console | ||
| $ pipx install python_dev_tools | ||
| Then add the new :code:`bin` directory to the path. On Linux for instance, run: | ||
| .. code-block:: console | ||
| $ TOOLS_PATH=$(ls -l ~/.local/bin/whataformatter | sed -e "s/.*-> //" | sed -e "s#/bin.*#/bin#") | ||
| $ userpath prepend $TOOLS_PATH | ||
| Standard installation method | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| To install Python Dev Tools, run this command in your terminal: | ||
| .. code-block:: console | ||
| $ pip install python-dev-tools | ||
| This is the preferred method to install Python Dev Tools, as it will always | ||
| install the most recent stable release. | ||
| If you don't have `pip`_ installed, this `Python installation guide`_ can guide | ||
| you through the process. | ||
| Then pay attention to update your PATH environment variable appropriately. | ||
| .. _pip: https://pip.pypa.io | ||
| .. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ | ||
| From sources | ||
| ------------ | ||
| The sources for Python Dev Tools can be downloaded from the `Github repo`_. | ||
| You can either clone the public repository: | ||
| .. code-block:: console | ||
| $ git clone git://github.com/vpoulailleau/python_dev_tools | ||
| Or download the `tarball`_: | ||
| .. code-block:: console | ||
| $ curl -OL https://github.com/vpoulailleau/python_dev_tools/tarball/master | ||
| Once you have a copy of the source, you can install it with: | ||
| .. code-block:: console | ||
| $ python setup.py install | ||
| .. _Github repo: https://github.com/vpoulailleau/python_dev_tools | ||
| .. _tarball: https://github.com/vpoulailleau/python_dev_tools/tarball/master |
| @ECHO OFF | ||
| pushd %~dp0 | ||
| REM Command file for Sphinx documentation | ||
| if "%SPHINXBUILD%" == "" ( | ||
| set SPHINXBUILD=python -msphinx | ||
| ) | ||
| set SOURCEDIR=. | ||
| set BUILDDIR=_build | ||
| set SPHINXPROJ=python_dev_tools | ||
| if "%1" == "" goto help | ||
| %SPHINXBUILD% >NUL 2>NUL | ||
| if errorlevel 9009 ( | ||
| echo. | ||
| echo.The Sphinx module was not found. Make sure you have Sphinx installed, | ||
| echo.then set the SPHINXBUILD environment variable to point to the full | ||
| echo.path of the 'sphinx-build' executable. Alternatively you may add the | ||
| echo.Sphinx directory to PATH. | ||
| echo. | ||
| echo.If you don't have Sphinx installed, grab it from | ||
| echo.http://sphinx-doc.org/ | ||
| exit /b 1 | ||
| ) | ||
| %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
| goto end | ||
| :help | ||
| %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
| :end | ||
| popd |
| # Minimal makefile for Sphinx documentation | ||
| # | ||
| # You can set these variables from the command line. | ||
| SPHINXOPTS = | ||
| SPHINXBUILD = python -msphinx | ||
| SPHINXPROJ = python_dev_tools | ||
| SOURCEDIR = . | ||
| BUILDDIR = _build | ||
| # Put it first so that "make" without argument is like "make help". | ||
| help: | ||
| @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
| .PHONY: help Makefile | ||
| # Catch-all target: route all unknown targets to Sphinx using the new | ||
| # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| %: Makefile | ||
| @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| .. include:: ../README.rst |
| ===== | ||
| Usage | ||
| ===== | ||
| TODO | ||
| See README. |
-57
| History | ||
| ======= | ||
| 2019.10.22 | ||
| ---------- | ||
| * Add flake8-2020 linter | ||
| 2019.07.21 | ||
| ---------- | ||
| * Add --quiet and --diff flags to whataformatter for VS Code compatibility | ||
| 2019.07.20 | ||
| ---------- | ||
| * Add black formatter | ||
| * Add autoflake formatter | ||
| * Add pyupgrade formatter | ||
| 2019.04.08 | ||
| ---------- | ||
| * Add flake8 linter | ||
| * Add flake8-isort linter | ||
| * Add pep8-naming linter | ||
| * Add flake8-comprehensions linter | ||
| * Add flake8-logging-format linter | ||
| * Add flake8-bugbear linter | ||
| * Add flake8-builtins linter | ||
| * Add flake8-broken-line linter | ||
| * Add flake8-fixme linter | ||
| * Add flake8-mutable linter | ||
| * Add flake8-debugger linter | ||
| * Add flake8-variables-names linter | ||
| * Add flake8-bandit linter | ||
| 2019.03.02 | ||
| ---------- | ||
| * Add pydocstyle linter | ||
| 2019.03.01 | ||
| ---------- | ||
| * Add McCabe complexity checker | ||
| 2019.02.26 | ||
| ---------- | ||
| * Add pyflakes linter | ||
| * Add pycodestyle linter | ||
| 2019.02.23 | ||
| ---------- | ||
| * First release on PyPI. |
-11
| include AUTHORS.rst | ||
| include CONTRIBUTING.rst | ||
| include HISTORY.rst | ||
| include LICENSE | ||
| include README.rst | ||
| recursive-include tests * | ||
| recursive-exclude * __pycache__ | ||
| recursive-exclude * *.py[co] | ||
| recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif |
| [console_scripts] | ||
| whataformatter = python_dev_tools.whataformatter:main | ||
| whatalinter = python_dev_tools.whatalinter:main | ||
Sorry, the diff of this file is not supported yet
| Metadata-Version: 2.1 | ||
| Name: python-dev-tools | ||
| Version: 2020.2.5 | ||
| Summary: Needed and up-to-date tools to develop in Python | ||
| Home-page: https://github.com/vpoulailleau/python-dev-tools | ||
| Author: Vincent Poulailleau | ||
| Author-email: vpoulailleau@gmail.com | ||
| License: BSD license | ||
| Description: Python Dev Tools | ||
| ================ | ||
| Needed and up-to-date tools to develop in Python (*WORK IN PROGRESS*) | ||
| .. image:: https://img.shields.io/pypi/v/python_dev_tools.svg | ||
| :target: https://pypi.python.org/pypi/python_dev_tools | ||
| .. image:: https://img.shields.io/pypi/l/python_dev_tools.svg | ||
| :target: https://github.com/vpoulailleau/python_dev_tools/blob/master/LICENSE | ||
| .. image:: https://travis-ci.com/vpoulailleau/python-dev-tools.svg?branch=master | ||
| :target: https://travis-ci.com/vpoulailleau/python-dev-tools | ||
| .. image:: https://readthedocs.org/projects/python-dev-tools/badge/?version=latest | ||
| :target: https://python-dev-tools.readthedocs.io/en/latest/?badge=latest | ||
| :alt: Documentation Status | ||
| .. image:: https://pepy.tech/badge/python-dev-tools | ||
| :target: https://pepy.tech/project/python-dev-tools | ||
| :alt: Downloads | ||
| .. image:: https://coveralls.io/repos/github/vpoulailleau/python-dev-tools/badge.svg?branch=HEAD | ||
| :target: https://coveralls.io/github/vpoulailleau/python-dev-tools?branch=HEAD | ||
| :alt: Coverage Status | ||
| .. image:: https://api.codeclimate.com/v1/badges/282fcd71714dabd6a847/maintainability | ||
| :target: https://codeclimate.com/github/vpoulailleau/python-dev-tools/maintainability | ||
| :alt: Maintainability | ||
| .. image:: https://bettercodehub.com/edge/badge/vpoulailleau/python-dev-tools?branch=master | ||
| :target: https://bettercodehub.com/results/vpoulailleau/python-dev-tools | ||
| :alt: Maintainability | ||
| .. image:: https://img.shields.io/lgtm/grade/python/g/vpoulailleau/python-dev-tools.svg?logo=lgtm&logoWidth=1 | ||
| :target: https://lgtm.com/projects/g/vpoulailleau/python-dev-tools/context:python | ||
| :alt: Maintainability | ||
| Documentation | ||
| ------------- | ||
| The full documentation can be read at https://python-dev-tools.readthedocs.io. | ||
| Installation | ||
| ------------ | ||
| Install pipx if not yet installed: https://pipxproject.github.io/pipx/installation/ | ||
| Then in a terminal, run: | ||
| .. code-block:: console | ||
| $ pipx install python-dev-tools | ||
| Then add the new :code:`bin` directory to the path. On Linux for instance, run: | ||
| .. code-block:: console | ||
| $ TOOLS_PATH=$(ls -l ~/.local/bin/whataformatter | sed -e "s/.*-> //" | sed -e "s#/bin.*#/bin#") | ||
| $ userpath prepend $TOOLS_PATH | ||
| Full documentation on installation: https://python-dev-tools.readthedocs.io/en/latest/installation.html | ||
| That's it! Use the provided linter, formatter and precommit hook where | ||
| applicable. | ||
| Upgrade | ||
| ------- | ||
| If not using pipx, follow again the installation procedure. | ||
| If using pipx (preferred installation method), run in a terminal: | ||
| .. code-block:: console | ||
| $ pipx upgrade python-dev-tools | ||
| Installation with Visual Studio Code | ||
| ------------------------------------ | ||
| * Follow the installation procedure for python-dev-tools | ||
| * Be sure to have the official Python extension installed in VS Code | ||
| * In VS Code, open settings (F1 key, then type "Open Settings (JSON)", | ||
| then enter) | ||
| * Add in the opened JSON file: | ||
| .. code:: javascript | ||
| "python.linting.enabled": true, | ||
| "python.linting.flake8Enabled": true, | ||
| "python.linting.flake8Path": "~/.local/bin/whatalinter", | ||
| "python.formatting.provider": "black", | ||
| "python.formatting.blackPath": "~/.local/bin/whataformatter", | ||
| "python.formatting.blackArgs": [], | ||
| * Adapt the previous path according to your installation. | ||
| Features | ||
| -------- | ||
| Integrate features of commonly used tools. This package provides usual | ||
| dependencies to develop Python software. | ||
| * Simple linter | ||
| * ``whatalinter a_python_file.py`` lints a_python_file.py | ||
| * output is compatible with the one of pycodestyle (formerly named pep8) for | ||
| easy integration in text editors and IDE | ||
| * based on | ||
| * pycodestyle: https://github.com/PyCQA/pycodestyle | ||
| * pyflakes: https://github.com/PyCQA/pyflakes | ||
| * mccabe: https://github.com/pycqa/mccabe | ||
| * pydocstyle: https://github.com/PyCQA/pydocstyle | ||
| * flake8 and plugins: https://gitlab.com/pycqa/flake8 | ||
| * flake8-2020: https://github.com/asottile/flake8-2020 | ||
| * flake8-bandit: https://github.com/tylerwince/flake8-bandit | ||
| * flake8-broken-line: https://github.com/sobolevn/flake8-broken-line | ||
| * flake8-bugbear: https://github.com/PyCQA/flake8-bugbear | ||
| * flake8-builtins: https://github.com/gforcada/flake8-builtins | ||
| * flake8-comprehensions: https://github.com/adamchainz/flake8-comprehensions | ||
| * flake8-debugger: https://github.com/JBKahn/flake8-debugger | ||
| * flake8-fixme: https://github.com/tommilligan/flake8-fixme | ||
| * flake8-isort: https://github.com/gforcada/flake8-isort | ||
| * flake8-logging-format: https://github.com/globality-corp/flake8-logging-format | ||
| * flake8-mutable: https://github.com/ebeweber/flake8-mutable | ||
| * flake8-variables-names: https://github.com/best-doctor/flake8-variables-names | ||
| * pep8-naming: https://github.com/PyCQA/pep8-naming | ||
| * Simple formatter | ||
| * ``whataformatter a_python_file.py`` formats a_python_file.py | ||
| * based on | ||
| * autoflake: https://github.com/myint/autoflake | ||
| * black: https://github.com/python/black | ||
| * pyupgrade: https://github.com/asottile/pyupgrade | ||
| * Simple precommit hook | ||
| * TODO | ||
| License | ||
| ------- | ||
| BSD 3-Clause license, feel free to contribute: https://python-dev-tools.readthedocs.io/en/latest/contributing.html. | ||
| TODO | ||
| ---- | ||
| * documentation | ||
| * precommit | ||
| Credits | ||
| ------- | ||
| This package was created with Cookiecutter_ and the | ||
| `audreyr/cookiecutter-pypackage`_ project template. | ||
| .. _Cookiecutter: https://github.com/audreyr/cookiecutter | ||
| .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage | ||
| History | ||
| ======= | ||
| 2019.10.22 | ||
| ---------- | ||
| * Add flake8-2020 linter | ||
| 2019.07.21 | ||
| ---------- | ||
| * Add --quiet and --diff flags to whataformatter for VS Code compatibility | ||
| 2019.07.20 | ||
| ---------- | ||
| * Add black formatter | ||
| * Add autoflake formatter | ||
| * Add pyupgrade formatter | ||
| 2019.04.08 | ||
| ---------- | ||
| * Add flake8 linter | ||
| * Add flake8-isort linter | ||
| * Add pep8-naming linter | ||
| * Add flake8-comprehensions linter | ||
| * Add flake8-logging-format linter | ||
| * Add flake8-bugbear linter | ||
| * Add flake8-builtins linter | ||
| * Add flake8-broken-line linter | ||
| * Add flake8-fixme linter | ||
| * Add flake8-mutable linter | ||
| * Add flake8-debugger linter | ||
| * Add flake8-variables-names linter | ||
| * Add flake8-bandit linter | ||
| 2019.03.02 | ||
| ---------- | ||
| * Add pydocstyle linter | ||
| 2019.03.01 | ||
| ---------- | ||
| * Add McCabe complexity checker | ||
| 2019.02.26 | ||
| ---------- | ||
| * Add pyflakes linter | ||
| * Add pycodestyle linter | ||
| 2019.02.23 | ||
| ---------- | ||
| * First release on PyPI. | ||
| Keywords: python_dev_tools | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 4 - Beta | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: BSD License | ||
| Classifier: Natural Language :: English | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Description-Content-Type: text/x-rst |
| autoflake==1.3.1 | ||
| bandit==1.6.2 | ||
| black==19.10b0 | ||
| bumpversion==0.5.3 | ||
| coverage==5.0.3 | ||
| coveralls[yaml]==1.10.0 | ||
| doc8==0.8.0 | ||
| flake8==3.7.9 | ||
| flake8-2020==1.5.0 | ||
| flake8-bandit==2.1.2 | ||
| flake8-broken-line==0.1.1 | ||
| flake8-bugbear==20.1.4 | ||
| flake8-builtins==1.4.2 | ||
| flake8-comprehensions==3.2.2 | ||
| flake8-debugger==3.2.1 | ||
| flake8-fixme==1.1.1 | ||
| flake8-isort==2.8.0 | ||
| flake8-mutable==1.2.0 | ||
| flake8-logging-format==0.6.0 | ||
| flake8-variables-names==0.0.3 | ||
| isort==4.3.21 | ||
| mccabe==0.6.1 | ||
| pip==20.0.2 | ||
| pep8-naming==0.9.1 | ||
| pycodestyle==2.5.0 | ||
| pydocstyle==5.0.2 | ||
| pyflakes==2.1.1 | ||
| pytest==5.3.5 | ||
| pytest-cov==2.8.1 | ||
| pytest-runner==5.2 | ||
| pyupgrade==1.26.2 | ||
| Sphinx==2.3.1 | ||
| tox==3.14.3 | ||
| twine==3.1.1 | ||
| wheel==0.34.2 |
| AUTHORS.rst | ||
| CONTRIBUTING.rst | ||
| HISTORY.rst | ||
| LICENSE | ||
| MANIFEST.in | ||
| README.rst | ||
| setup.cfg | ||
| setup.py | ||
| docs/Makefile | ||
| docs/authors.rst | ||
| docs/conf.py | ||
| docs/contributing.rst | ||
| docs/history.rst | ||
| docs/index.rst | ||
| docs/installation.rst | ||
| docs/make.bat | ||
| docs/readme.rst | ||
| docs/usage.rst | ||
| python_dev_tools/__init__.py | ||
| python_dev_tools/whataformatter.py | ||
| python_dev_tools/whatalinter.py | ||
| python_dev_tools.egg-info/PKG-INFO | ||
| python_dev_tools.egg-info/SOURCES.txt | ||
| python_dev_tools.egg-info/dependency_links.txt | ||
| python_dev_tools.egg-info/entry_points.txt | ||
| python_dev_tools.egg-info/not-zip-safe | ||
| python_dev_tools.egg-info/requires.txt | ||
| python_dev_tools.egg-info/top_level.txt | ||
| python_dev_tools/formatters/__init__.py | ||
| python_dev_tools/formatters/autoflake.py | ||
| python_dev_tools/formatters/black.py | ||
| python_dev_tools/formatters/common.py | ||
| python_dev_tools/formatters/format_file.py | ||
| python_dev_tools/formatters/pyupgrade.py | ||
| python_dev_tools/linters/__init__.py | ||
| python_dev_tools/linters/common.py | ||
| python_dev_tools/linters/flake8.py | ||
| python_dev_tools/linters/lint.py | ||
| python_dev_tools/linters/mccabe.py | ||
| python_dev_tools/linters/pycodestyle.py | ||
| python_dev_tools/linters/pydocstyle.py | ||
| python_dev_tools/linters/pyflakes.py | ||
| tests/test_python_dev_tools.py |
| python_dev_tools |
| """McCabe linter management.""" | ||
| import contextlib | ||
| import io | ||
| import mccabe | ||
| from .common import Linter | ||
| class MccabeLinter(Linter): | ||
| """McCabe linter management.""" | ||
| name = "McCabe" | ||
| max_complexity = 10 | ||
| regex = [r"(?P<lineno>\d+):(?P<charno>\d+):\s+(?P<message>.*)"] | ||
| @classmethod | ||
| def _lint(cls, filepath): | ||
| stdout = io.StringIO() | ||
| with contextlib.redirect_stdout(stdout): | ||
| mccabe.main(["--min", str(cls.max_complexity), str(filepath)]) | ||
| messages = cls._parse_output(stdout.getvalue()) | ||
| for message in messages: | ||
| message.filename = str(filepath) | ||
| message.message_id = "C901" | ||
| message.message = f"too complex: {message.message}" | ||
| return messages |
| """Pycodestyle linter management.""" | ||
| from .common import Linter | ||
| class PycodestyleLinter(Linter): | ||
| """Pycodestyle linter management.""" | ||
| name = "pycodestyle" | ||
| path = "pycodestyle" | ||
| regex = [ | ||
| r"(?P<filename>.*?):(?P<lineno>\d+):(?P<charno>\d+):" | ||
| r"\s+(?P<message_id>.*?)\s+(?P<message>.*)" | ||
| ] |
| """Pydocstyle linter management.""" | ||
| from .common import Linter | ||
| class PydocstyleLinter(Linter): | ||
| """Pydocstyle linter management.""" | ||
| name = "pydocstyle" | ||
| path = "pydocstyle" | ||
| regex = [ | ||
| r"(?P<filename>.*?):(?P<lineno>\d+)\s+(?P<extramessage>.*):", | ||
| r"\s*(?P<message_id>D\d+):\s+(?P<message>.*)", | ||
| ] |
| """Pyflakes linter management.""" | ||
| from .common import Linter | ||
| class PyflakesLinter(Linter): | ||
| """Pyflakes linter management.""" | ||
| name = "pyflakes" | ||
| path = "pyflakes" | ||
| regex = [r"(?P<filename>.*?):(?P<lineno>\d+):\s+(?P<message>.*)"] | ||
| @classmethod | ||
| def _lint(cls, filepath): | ||
| args = [cls.path, str(filepath)] | ||
| result = cls._execute_command(args) | ||
| messages = cls._parse_output(result.stdout) | ||
| for message in messages: | ||
| message.message_id = "W999" | ||
| return messages |
-29
| [bumpversion] | ||
| current_version = 2020.02.05 | ||
| commit = True | ||
| tag = True | ||
| [bumpversion:file:setup.py] | ||
| search = version="{current_version}" | ||
| replace = version="{new_version}" | ||
| [bumpversion:file:python_dev_tools/__init__.py] | ||
| search = __version__ = "{current_version}" | ||
| replace = __version__ = "{new_version}" | ||
| [bdist_wheel] | ||
| universal = 1 | ||
| [flake8] | ||
| exclude = docs | ||
| [aliases] | ||
| test = pytest | ||
| [tool:pytest] | ||
| collect_ignore = ['setup.py'] | ||
| [egg_info] | ||
| tag_build = | ||
| tag_date = 0 | ||
| """Tests for `python_dev_tools` package.""" | ||
| from pathlib import Path | ||
| from textwrap import dedent | ||
| import python_dev_tools.whatalinter | ||
| from python_dev_tools.linters.common import LinterMessage | ||
| from python_dev_tools.linters.lint import lint, linters | ||
| from python_dev_tools.whataformatter import main as main_formatter | ||
| from python_dev_tools.whatalinter import main as main_linter | ||
| def test_main_formatter(tmpdir): | ||
| """Test main call.""" | ||
| import sys | ||
| p = tmpdir.join("foo.py") | ||
| p.write( | ||
| dedent( | ||
| """ | ||
| a = 1 | ||
| """ | ||
| ) | ||
| ) | ||
| sys.argv = ["whataformatter", str(p)] | ||
| python_dev_tools.whataformatter.__name__ = "__main__" | ||
| main_formatter() | ||
| # TODO assert file content | ||
| # TODO test formatting | ||
| def test_main_linter(tmpdir, capsys): | ||
| """Test main call.""" | ||
| import sys | ||
| p = tmpdir.join("foo.py") | ||
| p.write("a = 1\n") | ||
| sys.argv = ["whatalinter", str(p)] | ||
| python_dev_tools.whatalinter.__name__ = "__main__" | ||
| main_linter() | ||
| captured = capsys.readouterr() | ||
| assert "[pydocstyle] Missing docstring in public module" in captured.out | ||
| def test_str_message(): | ||
| """Test message formatting.""" | ||
| msg = LinterMessage( | ||
| tool="foo", | ||
| message_id="bar", | ||
| filename="baz", | ||
| lineno=1, | ||
| charno=2, | ||
| message="msg)", | ||
| extramessage="extra msg", | ||
| ) | ||
| assert str(msg) == "baz:1:2: War [foo] msg) (extra msg)" | ||
| def test_long_line(tmpdir): | ||
| """Test pycodestyle is working.""" | ||
| p = tmpdir.join("foo.py") | ||
| p.write('"""Docstring."""\n\n"' + 78 * "#" + '"\n') | ||
| result = lint(p) | ||
| assert result == [ | ||
| LinterMessage( | ||
| tool="pycodestyle", | ||
| message_id="E501", | ||
| filename=str(p), | ||
| lineno=3, | ||
| charno=80, | ||
| message="line too long (80 > 79 characters)", | ||
| extramessage="", | ||
| ) | ||
| ] | ||
| def test_duplicate_key(tmpdir): | ||
| """Test pyflakes is working.""" | ||
| p = tmpdir.join("foo.py") | ||
| p.write('"""Docstring."""\n\naaa = {1: 5, 1: 6}\n') | ||
| result = lint(p) | ||
| assert result == [ | ||
| LinterMessage( | ||
| tool="pyflakes", | ||
| message_id="W999", | ||
| filename=str(p), | ||
| lineno=3, | ||
| charno=1, | ||
| message="dictionary key 1 repeated with different values", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="F601", | ||
| filename=str(p), | ||
| lineno=3, | ||
| charno=8, | ||
| message="dictionary key 1 repeated with different values", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="F601", | ||
| filename=str(p), | ||
| lineno=3, | ||
| charno=14, | ||
| message="dictionary key 1 repeated with different values", | ||
| extramessage="", | ||
| ), | ||
| ] | ||
| def test_complexity(tmpdir): | ||
| """Test McCabe is working.""" | ||
| p = tmpdir.join("foo.py") | ||
| file_content = '"""Docstring."""\n\n' | ||
| file_content += dedent( | ||
| """ | ||
| elements = [open(str(i)) for i in range(10)] | ||
| def foo(): | ||
| \"\"\"Docstring.\"\"\" | ||
| if elements[0]: | ||
| aaa = 1 | ||
| elif elements[1]: | ||
| aaa = 1 | ||
| elif elements[2]: | ||
| aaa = 1 | ||
| elif elements[3]: | ||
| aaa = 1 | ||
| elif elements[4]: | ||
| aaa = 1 | ||
| elif elements[5]: | ||
| aaa = 1 | ||
| elif elements[6]: | ||
| aaa = 1 | ||
| elif elements[7]: | ||
| aaa = 1 | ||
| elif elements[8]: | ||
| aaa = 1 | ||
| elif elements[9]: | ||
| aaa = 1 | ||
| print(aaa) | ||
| """ | ||
| ) | ||
| p.write(file_content) | ||
| result = lint(p) | ||
| assert result == [ | ||
| LinterMessage( | ||
| tool="McCabe", | ||
| message_id="C901", | ||
| filename=str(p), | ||
| lineno=7, | ||
| charno=0, | ||
| message="too complex: 'foo' 11", | ||
| extramessage="", | ||
| ) | ||
| ] | ||
| def test_no_docstring(tmpdir): | ||
| """Test pydocstyle is working.""" | ||
| p = tmpdir.join("foo.py") | ||
| p.write("aaa = 3\n") | ||
| result = lint(p) | ||
| assert result == [ | ||
| LinterMessage( | ||
| tool="pydocstyle", | ||
| message_id="D100", | ||
| filename=str(p), | ||
| lineno=1, | ||
| charno=1, | ||
| message="Missing docstring in public module", | ||
| extramessage="at module level", | ||
| ) | ||
| ] | ||
| def test_all_warnings(tmpdir): | ||
| """Test all_warnings enabled in lint.""" | ||
| p = tmpdir.join("foo.py") | ||
| chars = "ABCDEFGJKLMNP" | ||
| content = "" | ||
| for char in chars: | ||
| content += f"{char}{char}{char} = {char}{char}{char}\n" | ||
| p.write(content) | ||
| result = lint(p, all_warnings=True) | ||
| assert len(result) == 2 * len(chars) + 1 | ||
| def test_not_all_warnings(tmpdir): | ||
| """Test all_warnings disabled in lint.""" | ||
| p = tmpdir.join("foo.py") | ||
| chars = "ABCDEFGJKLMNP" | ||
| content = "" | ||
| for char in chars: | ||
| content += f"{char}{char}{char} = {char}{char}{char}\n" | ||
| p.write(content) | ||
| result = lint(p, all_warnings=False) | ||
| assert len(result) == 10 | ||
| def test_lint_myself(): | ||
| """Test no lint message for this project.""" | ||
| source_dir = Path("python_dev_tools") | ||
| print() | ||
| results = [] | ||
| for python_file in sorted(source_dir.rglob("*.py")): | ||
| result = lint(python_file, all_warnings=True) | ||
| print(python_file, result) | ||
| results.extend(result) | ||
| assert results == [ | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="S404", | ||
| filename="python_dev_tools/formatters/common.py", | ||
| lineno=2, | ||
| charno=1, | ||
| message="Consider possible security implications associated with subprocess module.", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="S603", | ||
| filename="python_dev_tools/formatters/common.py", | ||
| lineno=37, | ||
| charno=1, | ||
| message="subprocess call - check for execution of untrusted input.", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="S404", | ||
| filename="python_dev_tools/linters/common.py", | ||
| lineno=4, | ||
| charno=1, | ||
| message="Consider possible security implications associated with subprocess module.", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="T101", | ||
| filename="python_dev_tools/linters/common.py", | ||
| lineno=10, | ||
| charno=3, | ||
| message="fixme found (TODO)", | ||
| extramessage="", | ||
| ), | ||
| LinterMessage( | ||
| tool="flake8", | ||
| message_id="S603", | ||
| filename="python_dev_tools/linters/common.py", | ||
| lineno=120, | ||
| charno=1, | ||
| message="subprocess call - check for execution of untrusted input.", | ||
| extramessage="", | ||
| ), | ||
| ] | ||
| def test_installation_error(tmpdir): | ||
| """ | ||
| Test for installation error, with missing executable. | ||
| Useless test, except for coverage or installation error. | ||
| """ | ||
| for linter_class in linters: | ||
| linter_class.path = "unknown" | ||
| p = tmpdir.join("foo.py") | ||
| p.write("a = 3\n") | ||
| lint(p) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
38935
-40.38%18
-59.09%454
-49.1%