[![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 which provides python code cleaning from comments, docstrings, annotations
```
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
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/PasaOpasen/toml-union",
"name": "py-code-cleaner",
"maintainer": "Demetry Pascal",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "clean,comments,docstrings,annotations",
"author": "Demetry Pascal",
"author_email": "qtckpuhdsa@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/11/f6/9a5ab38ee0ac9bbab938e1cf72e530b0c8e14f742c9ea15b606d8bd95f12/py_code_cleaner-1.0.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 which provides python code cleaning from comments, docstrings, annotations\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\ncleane-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",
"bugtrack_url": null,
"license": "MIT",
"summary": "Small PyPI package which provides python code cleaning from comments, docstrings, annotations",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/PasaOpasen/toml-union"
},
"split_keywords": [
"clean",
"comments",
"docstrings",
"annotations"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c041a921da1b75cb640520ad474c7536b947825f6b6fd60350edda6bfa014d8c",
"md5": "9cc4c742d410c1116e98aef62ffdda0e",
"sha256": "af8e5f177b302f63cd87e760a141a8570c8345f7fae0074431889eedb212752e"
},
"downloads": -1,
"filename": "py_code_cleaner-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9cc4c742d410c1116e98aef62ffdda0e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6296,
"upload_time": "2023-12-27T17:09:26",
"upload_time_iso_8601": "2023-12-27T17:09:26.249603Z",
"url": "https://files.pythonhosted.org/packages/c0/41/a921da1b75cb640520ad474c7536b947825f6b6fd60350edda6bfa014d8c/py_code_cleaner-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "11f69a5ab38ee0ac9bbab938e1cf72e530b0c8e14f742c9ea15b606d8bd95f12",
"md5": "3d3ade2387cc3ae0bcce3877bac9ce54",
"sha256": "e5363a8fcc2b06601491bf477e5b4528afa2a3ba13be221a04213cafd70b067a"
},
"downloads": -1,
"filename": "py_code_cleaner-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "3d3ade2387cc3ae0bcce3877bac9ce54",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5505,
"upload_time": "2023-12-27T17:09:27",
"upload_time_iso_8601": "2023-12-27T17:09:27.954373Z",
"url": "https://files.pythonhosted.org/packages/11/f6/9a5ab38ee0ac9bbab938e1cf72e530b0c8e14f742c9ea15b606d8bd95f12/py_code_cleaner-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-27 17:09:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PasaOpasen",
"github_project": "toml-union",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "py-code-cleaner"
}