py-code-cleaner


Namepy-code-cleaner JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/PasaOpasen/py-code-cleaner
SummarySmall PyPI package which provides python code cleaning from comments, docstrings, annotations
upload_time2024-12-06 15:30:28
maintainerDemetry Pascal
docs_urlNone
authorDemetry Pascal
requires_pythonNone
licenseMIT
keywords code clean comments docstrings annotations
VCS
bugtrack_url
requirements astunparse typing_extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/py-code-cleaner.svg)](https://pypi.org/project/py-code-cleaner/)
[![Downloads](https://pepy.tech/badge/py-code-cleaner)](https://pepy.tech/project/py-code-cleaner)
[![Downloads](https://pepy.tech/badge/py-code-cleaner/month)](https://pepy.tech/project/py-code-cleaner)
[![Downloads](https://pepy.tech/badge/py-code-cleaner/week)](https://pepy.tech/project/py-code-cleaner)


# py-code-cleaner

Small PyPI package provides python code cleaning from comments, docstrings, annotations. Primary I use it for automated checks whether no code in the python files has been changed whatever new lines or comments added.

```
pip install py-code-cleaner
```

```py
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 

```sh
clean-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)
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PasaOpasen/py-code-cleaner",
    "name": "py-code-cleaner",
    "maintainer": "Demetry Pascal",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "code, clean, comments, docstrings, annotations",
    "author": "Demetry Pascal",
    "author_email": "qtckpuhdsa@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/6e/24c759e98891d9526c1351a04b77fd796444deb8a72a0390523f26432d85/py_code_cleaner-1.1.0.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/py-code-cleaner.svg)](https://pypi.org/project/py-code-cleaner/)\n[![Downloads](https://pepy.tech/badge/py-code-cleaner)](https://pepy.tech/project/py-code-cleaner)\n[![Downloads](https://pepy.tech/badge/py-code-cleaner/month)](https://pepy.tech/project/py-code-cleaner)\n[![Downloads](https://pepy.tech/badge/py-code-cleaner/week)](https://pepy.tech/project/py-code-cleaner)\n\n\n# py-code-cleaner\n\nSmall PyPI package provides python code cleaning from comments, docstrings, annotations. Primary I use it for automated checks whether no code in the python files has been changed whatever new lines or comments added.\n\n```\npip install py-code-cleaner\n```\n\n```py\nfrom py-code-cleaner import clean_py, clean_py_deep, clean_py_main\n\n# def clean_py_main(\n#     src: PathLike,\n#     dst: Optional[PathLike] = None,\n#     keep_nonpy: Optional[Iterable[str]] = ('.pyx',),\n#     filter_empty_lines: bool = True,\n#     filter_docstrings: bool = True,\n#     filter_annotations: bool = True,\n#     quiet: bool = False,\n#     dry_run: bool = False\n# )\n```\n\n## CLI \n\n```sh\nclean-py -h\n```\n\n```\nusage: clean-py [-h] [--destination DESTINATION] [--keep-nonpy KEEP_NONPY [KEEP_NONPY ...]] [--keep-empty-lines] [--keep-docstrings] [--keep-annotations] [--quiet] [--dry-run] source\n\nCleanses *.py files from comments, empty lines, annotations and docstrings\n\npositional arguments:\n  source                python file path or path to directory with files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --destination DESTINATION, -d DESTINATION\n                        destination file or directory; empty means to print to stdout (default: None)\n  --keep-nonpy KEEP_NONPY [KEEP_NONPY ...], -k KEEP_NONPY [KEEP_NONPY ...]\n                        additional file extensions to transfer between src and dst directories (to not ignore) (default: )\n  --keep-empty-lines, -e\n                        Whether to not remove empty lines (default: False)\n  --keep-docstrings, -s\n                        Whether to not remove docstrings (default: False)\n  --keep-annotations, -a\n                        Whether to not remove annotations (default: False)\n  --quiet, -q           Do not print processing info (default: False)\n  --dry-run, -n         Whether to run without performing file processing operations (default: False)\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Small PyPI package which provides python code cleaning from comments, docstrings, annotations",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/PasaOpasen/py-code-cleaner"
    },
    "split_keywords": [
        "code",
        " clean",
        " comments",
        " docstrings",
        " annotations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2cacc4885b5dc6f64f667e814fde277d67e73bcca36ee700bcb2420923a0ffc2",
                "md5": "2c473cdfbb826fadeb28c8568ab9923a",
                "sha256": "d4831230730d2e0d5a348589c5d114b379f42def6200f007c2a2a1c1c3832519"
            },
            "downloads": -1,
            "filename": "py_code_cleaner-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c473cdfbb826fadeb28c8568ab9923a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8499,
            "upload_time": "2024-12-06T15:30:27",
            "upload_time_iso_8601": "2024-12-06T15:30:27.304755Z",
            "url": "https://files.pythonhosted.org/packages/2c/ac/c4885b5dc6f64f667e814fde277d67e73bcca36ee700bcb2420923a0ffc2/py_code_cleaner-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "956e24c759e98891d9526c1351a04b77fd796444deb8a72a0390523f26432d85",
                "md5": "f1a1166725b326316886a8d162485732",
                "sha256": "e290297b0debe5fd33bb646a74efcc21a33f6d88d8255db7a2a41c894935d3e4"
            },
            "downloads": -1,
            "filename": "py_code_cleaner-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f1a1166725b326316886a8d162485732",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7047,
            "upload_time": "2024-12-06T15:30:28",
            "upload_time_iso_8601": "2024-12-06T15:30:28.212906Z",
            "url": "https://files.pythonhosted.org/packages/95/6e/24c759e98891d9526c1351a04b77fd796444deb8a72a0390523f26432d85/py_code_cleaner-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-06 15:30:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PasaOpasen",
    "github_project": "py-code-cleaner",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "astunparse",
            "specs": []
        },
        {
            "name": "typing_extensions",
            "specs": []
        }
    ],
    "lcname": "py-code-cleaner"
}
        
Elapsed time: 0.41559s