Package: invokelint
Invoke LintInvokes Python dev tools at once.AttentionThe 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.AdvantageCovers major development tools and they are optional to installQuick response for developer, slow but detail for CIAvailable to place commands into your selected namespace1. Covers major development tools and they are optional to installYou 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:XenonRuffBanditdodgyFlake8pydocstylemypyPylintSemgrepFormatters:docformatterisortautoflakeBlackFor test and coverage:pytestCoverage.pyPackage build:build2. Quick response for developer, slow but detailed for CIThe commands for each kind of tasks are designed as unified into 2 main commands:For developer: Runs only quick responsive dev tools at onceFor CI (or final check): Runs slow but detailed responsive tools at once3. Available to place commands into your selected namespaceThis doesn't pollute your comfortable namespaces of command line tools. Thanks toInvoke, 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 styleFormats code by following tools at once:docformatterisortautoflakeBlackRuffinv style --checkcan only check.inv style --ruffcan leave Ruff warnings.inv lintRuns following fast lints at once:XenonRuffBanditdodgyFlake8pydocstyleThe format task (described later) also run before run above lints. You can skip them by--skip-formatoption.inv lint.deepRuns following slow but detailed lints at once:mypyPylintSemgrepinv radonReportsradonboth code complexity and maintainability index.inv testRuns fast tests (which is not marked@pytest.mark.slow) bypytest.See:How to mark test functions with attributes — pytest documentationWorking with custom markers — pytest documentationinv test.covRuns all tests and report coverage bypytestandCoverage.py.It also can dump coverage as XML or HTML format.inv distBuilds source and wheel packages intodist/directory bybuild.(Currently, not support in Windows)See:Building and Distributing Packages with Setuptools - setuptools latest documentationPackage Discovery and Namespace Packages - setuptools latest documentationQuickstart1. InstallIt's better to use one ofdependency management toolsto resolve dependencies of many dev tools.For example, in case when usePipenv,Pipfile:[[source]]url="https://pypi.org/simple"verify_ssl=truename="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/4101colorama="*"coverage=">=3.5.4"# The dlint less than 0.14.0 limits max version of flake8.dlint=">=0.14.0"docformatter={extras=["tomli"],version="*"}dodgy="*"# Since Pipenv can't lock for too much combinations to attempt lock:# pip._vendor.resolvelib.resolvers.ResolutionTooDeep: 2000000# The hacking depends flake8 ~=5.0.1 or ~=4.0.1.flake8={version="<=6.0.0>=5.0.1,==4.0.1",markers="python_version >= '3.6'"}# To use flake8 --radon-show-closuresflake8-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="*"ruff={version="*",markers="python_version >= '3.7'"}semgrep={version="*",markers="python_version >= '3.6'"}tomli={version="*",markers="python_version >= '3.6'"}xenon="*"then:pipenv install --devpipenv shell2. ImplementCreatetasks.pyin project directory:"""Tasks for maintaining the project.Execute 'invoke --list' for guidance on using Invoke"""frominvokeimportCollectionfrominvokelintimportdist,lint,path,style,testns=Collection()ns.add_collection(dist)ns.add_collection(lint)ns.add_collection(path)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 documentation3. Check installationinv --list4. Setup target packageThis package reusessetuptoolssettings for package discovery for linting, formatting, and measuring coverage. You can check which package are discovered bysetuptoolsand your project's settings, by following command:$invpathSetuptools detected packages: ['invokelint', 'invokelint.path']Root packages: ['invokelint']Setuptools detected Python modules: ['setup', 'tasks']Existing test packages: ['tests']Python file or directories to lint: ['invokelint', 'setup.py', 'tasks.py', 'tests']Python file or directories to lint excluding test packages: ['invokelint', 'setup.py', 'tasks.py']If result is not your expected, follow official documentation ofsetuptoolsto configurepyproject.toml(recommended),setup.cfg, orsetup.py.See:Package Discovery and Namespace Packages - setuptools latest documentationCreditsThis package was created withCookiecutterand theyukihiko-shinoda/cookiecutter-pypackageproject template.