Skip to main content

Small PyPI package which provides python code cleaning from comments, docstrings, annotations

Project description

PyPI version Downloads Downloads Downloads

py-code-cleaner

Small PyPI package which provides python code cleaning from comments, docstrings, annotations

pip install py_code_cleaner
from py_code_cleaner import clean_py, clean_py_deep, clean_py_main

# def clean_py_main(
#     src: PathLike,
#     dst: Optional[PathLike] = None,
#     keep_nonpy: Optional[Iterable[str]] = ('.pyx',),
#     filter_empty_lines: bool = True,
#     filter_docstrings: bool = True,
#     filter_annotations: bool = True,
#     quiet: bool = False,
#     dry_run: bool = False
# )

CLI

cleane-py -h
usage: clean-py [-h] [--destination DESTINATION] [--keep-nonpy KEEP_NONPY [KEEP_NONPY ...]] [--keep-empty-lines] [--keep-docstrings] [--keep-annotations] [--quiet] [--dry-run] source

Cleanses *.py files from comments, empty lines, annotations and docstrings

positional arguments:
  source                python file path or path to directory with files

optional arguments:
  -h, --help            show this help message and exit
  --destination DESTINATION, -d DESTINATION
                        destination file or directory; empty means to print to stdout (default: None)
  --keep-nonpy KEEP_NONPY [KEEP_NONPY ...], -k KEEP_NONPY [KEEP_NONPY ...]
                        additional file extensions to transfer between src and dst directories (to not ignore) (default: )
  --keep-empty-lines, -e
                        Whether to not remove empty lines (default: False)
  --keep-docstrings, -s
                        Whether to not remove docstrings (default: False)
  --keep-annotations, -a
                        Whether to not remove annotations (default: False)
  --quiet, -q           Do not print processing info (default: False)
  --dry-run, -n         Whether to run without performing file processing operations (default: False)

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

py_code_cleaner-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

py_code_cleaner-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file py_code_cleaner-1.0.0.tar.gz.

File metadata

  • Download URL: py_code_cleaner-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for py_code_cleaner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e5363a8fcc2b06601491bf477e5b4528afa2a3ba13be221a04213cafd70b067a
MD5 3d3ade2387cc3ae0bcce3877bac9ce54
BLAKE2b-256 11f69a5ab38ee0ac9bbab938e1cf72e530b0c8e14f742c9ea15b606d8bd95f12

See more details on using hashes here.

File details

Details for the file py_code_cleaner-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_code_cleaner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af8e5f177b302f63cd87e760a141a8570c8345f7fae0074431889eedb212752e
MD5 9cc4c742d410c1116e98aef62ffdda0e
BLAKE2b-256 c041a921da1b75cb640520ad474c7536b947825f6b6fd60350edda6bfa014d8c

See more details on using hashes here.

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