Skip to main content

Invokes Python dev tools at once.

Project description

Invoke Lint

Test CodeQL Test Coverage Maintainability Code Climate technical debt Python versions Twitter URL

Invokes Python dev tools at once.

Attention

  • The development status of this package is Beta now. It may not be able to keep backward compatibility. Be careful to use, especially for CI.
  • Currently, each commands require to run in project home directory.

Advantage

  1. Covers major development tools and they are optional to install
  2. Quick response for developer, slow but detail for CI
  3. Available to place commands into your selected namespace

1. Covers major development tools and they are optional to install

You can choose which dev tool you'll install, this package doesn't force to install each of dev tools. It helps you to avoid conflicts or breaking your project's dependencies.

Supporting tools:

Linters:

Formatters:

For test and coverage:

Package build:

2. Quick response for developer, slow but detailed for CI

The commands for each kind of tasks are designed as unified into 2 main commands:

  • For developer: Runs only quick responsive dev tools at once
  • For CI (or final check): Runs slow but detailed responsive tools at once

3. Available to place commands into your selected namespace

This doesn't pollute your comfortable namespaces of command line tools. Thanks to Invoke, you can place commands into your selected namespace. (See: Quickstart)

Representative commands

(Note that the namespaces of following commands can be changed as you like. See: Quickstart)

inv lint

Runs following fast lints at once:

  1. Bandit
  2. dodgy
  3. Flake8
  4. pydocstyle
  5. Xenon

inv lint.deep

Runs following slow but detailed lints at once:

  1. Pylint
  2. mypy

inv radon

Reports radon both code complexity and maintainability index.

inv style

Formats code by following tools at once:

  1. docformatter
  2. isort
  3. autoflake
  4. Black

It also can only check by inv style --check .

inv test

Runs fast tests (which is not marked @pytest.mark.slow) by pytest.

See:

inv test.cov

Runs all tests and report coverage by pytest and Coverage.py.

It also can dump coverage as XML or HTML format.

inv dist

Builds source and wheel packages into dist/ directory by build.
(Currently, not support in Windows)

See:

Quickstart

1. Install

It's better to use one of dependency management tools to resolve dependencies of many dev tools.

For example, in case when use Pipenv, Pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]
autoflake = "*"
bandit = {version = "*", markers="python_version >= '3.7'"}
black = {version = "*", markers="python_version >= '3.7'"}
build = "*"
# Hotfix for Pipenv's Bug:
# - Pipenv should prioritize more cross-platform sys_platform condition between packages when lock
#   · Issue #4101 · pypa/pipenv
#   https://github.com/pypa/pipenv/issues/4101
colorama = "*"
coverage = ">=3.5.4"
dlint = "*"
docformatter = {extras = ["tomli"], version = "*"}
dodgy = "*"
# Since Pipenv can't lock for too much combinations to attempt lock:
# pip._vendor.resolvelib.resolvers.ResolutionTooDeep: 2000000
flake8 = {version = "==4.0.1", markers="python_version >= '3.6'"}
# To use flake8 --radon-show-closures
flake8-polyfill = "*"
# Latest hacking depends on legacy version of flake8, and legacy hacking doesn't narrow flake8 version.
# When unpin hacking, it has possibility to install too legacy version of hacking.
hacking = {version = ">=5.0.0", markers="python_version >= '3.8'"}
invokelint = {version = "*", markers="python_version >= '3.7'"}
isort = "*"
mypy = "*"
pydocstyle = {version = "*", markers="python_version >= '3.6'"}
pylint = "*"
pytest = "*"
radon = "*"
tomli = {version = "*", markers="python_version >= '3.6'"}
xenon = "*"

then:

pipenv install --dev
pipenv shell

2. Implement

Create tasks.py in project directory:

"""Tasks for maintaining the project.

Execute 'invoke --list' for guidance on using Invoke
"""
from invoke import Collection

from invokelint import _clean, dist, lint, style, test

ns = Collection()
ns.add_collection(dist)
ns.add_collection(lint)
ns.add_collection(style)
ns.add_collection(test)

Commands may be explicitly place with a different name than they were originally given via a name kwarg (or the 2nd regular arg):

ns.add_collection(lint, 'namespace-you-wish')

See: Constructing namespaces — Invoke documentation

3. Check installation

inv --list

4. Setup target package

This package reuses setuptools settings for package discovery for linting, formatting, and measuring coverage. Ensure it already set, or if not yet, follow official documentation of setuptools.

See: Package Discovery and Namespace Packages - setuptools latest documentation

Credits

This package was created with Cookiecutter and the yukihiko-shinoda/cookiecutter-pypackage project template.

Project details


Download files

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

Source Distribution

invokelint-0.1.3.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

invokelint-0.1.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file invokelint-0.1.3.tar.gz.

File metadata

  • Download URL: invokelint-0.1.3.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for invokelint-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d2b082109212defd83fa65078abcc276cb50cfa2a816dfb17b01562062833bec
MD5 4d8995e63294a0e9af23c2c6b55abe2a
BLAKE2b-256 d1923ba53d5e9b3bbf9deee8945332757bb002432ce03a4d5d14a52d3dd991a0

See more details on using hashes here.

Provenance

File details

Details for the file invokelint-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: invokelint-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for invokelint-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0e5f5bc9dc2820c0f38678bce772967aa8b36dda8fa2050cc2cc1e5aa31ca960
MD5 8f5b90dc62cc2eba9074861885d0a28c
BLAKE2b-256 3eeb61c6914647339a3bde585f2d2dff9d4ac73f9b78e5414decb242b9925c8c

See more details on using hashes here.

Provenance

Supported by

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