dec
decker
pypi i decker
dec

decker

Simple development tool that simplifies a pythonist's daily tasks.

by Douglas Farinelli

0.3.0 (see all)License:MIT
pypi i decker
Readme

decker

Simple development tool that simplifies a pythonist's daily tasks.

PyPi Status Build Status Package version PyPI - Wheel


Decker is a command line, which aims to optimize some tasks, such as configuration and execution of the tools most used by the community. In addition, it aims to reduce configuration files and centralize everything on pyproject.toml.



Installation

The installation of decker can be via pip, pipenv, poetry or any other tool you prefer:

pipenv install decker

Note: We recommend installing only on virtualenv.

Features

Welcome to Decker!

  Simple development tool that simplifies a pythonist's daily tasks.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  format  Run code style format.

Format your code

  Run code style format.

Options:
  --exclude TEXT                  Files and directories that should be
                                  excluded on recursive searches.

  -l, --line-length INTEGER       How many characters per line to allow.
                                  [default: 79]

  -b, --backend [autoflake|docformatter|black|unify|isort]
                                  Specify formatting backends.
  --help                          Show this message and exit.

Formatting uses several tools, such as:

  • autoflake to remove unusable variables and imports,
  • docformatter to format docstrings,
  • black to apply your coding style, format blocks, constants, among other things,
  • unify to normalize quotes,
  • And last but not least, isort to reorganize your imports.

To save and avoid many configurations, decker pre defines some things like:

ToolOptionPré definedDescription
autoflakeexpand-star-importsTrueExpand wildcard star imports with undefined names
autoflakein-placeTrueApply changes
autoflakerecursiveTrueRecursive to defined sources
autoflakeremove-all-unused-importsTrueRemove all unused imports (not just those from the standard library)
autoflakeremove-unused-variablesTrue
docformatterblankFalseRemove blank line after description
docformatterin-placeTrueApply changes
docformattermake-summary-multi-lineTrueAdd a newline before and after the summary of a one-line docstring
docformatterpre-summary-newlineTrueAdd a newline before the summary of a multi-line docstring
docformatterrecursiveTrueRecursive to defined sources
docformatterwrap-summaries79 (from decker global line-length setting)Wrap long summary lines
blackline-length79 (from decker global line-length setting)How many characters per line to allow
blackskip-string-normalizationFalseSkip string normalization to use unify to normalize
unifyin-placeTrueApply changes
unifyquote"'" (Single quote)
unifyrecursiveTrueRecursive to defined sources
isortatomicTrueEnsures the output doesn't save if the resulting file contains syntax errors
isortcase-sensitiveTrueTells isort to include casing when sorting module names
isortcombine-asTrueCombines as imports on the same line
isortline-length79 (from decker global line-length setting)How many characters per line to allow
isortlines-after-imports2
isortmulti-line3Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).
isortorder-by-typeTrueOrder imports by type in addition to alphabetically
isortremove-import[__future__]Removes the specified import from all files
isortskip-glob*venv*Files that sort imports should skip over
isorttrailing-commaTrueIncludes a trailing comma on multi line imports that include parentheses
isortuse-parenthesesTrueUse parenthesis for line continuation on length limit instead of slashes

Note: Despite pre-defining all these settings, nothing is MANDATORY. All of these and any other configuration of these tools can be adjusted in pyproject.toml or in each configuration file of these tools.

The intention was to save time for those who already know and help those who do not already know.

Global Settings

To ensure ease and centralization of the other configurations, decker searches almost all of them in the pyproject.toml file, if any. Example:

[tool.autoflake]
expand-star-imports=false

[tool.black]
line-length=120
...

[tool.docformatter]
blank=false
...

[tool.unify]
quote='"'
...

[tool.isort]
line-length=120
trailing-comma=false
...

Decker settings on pyproject.toml

In addition, there are some that are global, where they are automatically passed on to all tools, such as:

[tool.decker]
line-length=79
exclude=same-package
verbose=1
sources=src/

Default sources (src/)

And to help as well, if the sources were not defined by the command line or pyproject.toml, decker looks for .py files in the directory in question and also for the src folder.

Extra

pdb++ & ipython

When installing decker, pdb++ and ipython are also installed to aid development.

Better print to pyproject.toml errors

Wraps and shows toml errors in a more "human" way, for example:

 + Unable to load pyproject.toml:
 |   
 |   [project]
 |   author='Douglas Farinelli'
 |   name='decker'
 |   repository='https://gitlab.com/douglasfarinelli/decker/'
 |   
 |   [tool.black]
 |   line-length=79
 |   skip-string-normalization=true
 |   target-version=
 |   
 + ^ Empty value is invalid
 |   
 |   ['py38']
 |   
 |   [tool.isort]
 |   atomic=true
 |   
 |   [tool.towncrier]
 |   package = 'crm'
 |   package_dir = 'src'
 |   filename = 'CHANGELOG.md'
 |   directory = 'changelog.d'

Next features

  • [0.2.0] - Command decker check

A command to analyze various things in your code, such as type hints, pep8 and Code quality.

  • [0.3.0] - Command decker release

Why not automate the flow VCS + bumpversion + towncrier? In other words, automate the generation of tags, changelog and auto-commit them.

Example:

decker release minor

License

This project is licensed under the terms of the MIT license.

GitHub Stars

17

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.3.0
2yrs ago
0.1.0
2yrs ago
No alternatives found
No tutorials found
Add a tutorial