py-code-cleaner


Namepy-code-cleaner JSON
Version 1.1.1 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_time2025-01-13 09:43:40
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 

### `clean-py`

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

### `clean-py-many`

```sh
clean-py-many --help
```

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

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

positional arguments:
  sources               paths to python files or files directories to be cleaned; all results will be saved in destination directory with same relative names as in input;absolute paths will be cut to base names,
                        recommended to use relative paths

optional arguments:
  -h, --help            show this help message and exit
  --destination DESTINATION, -d DESTINATION
                        destination directory (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/f8/2a/971900d2b1b57ac6ccb19150ac8b194a750c82be06959d6e79e9bda3a7c2/py_code_cleaner-1.1.1.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### `clean-py`\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### `clean-py-many`\n\n```sh\nclean-py-many --help\n```\n\n```\nusage: clean-py-many [-h] --destination DESTINATION [--keep-nonpy KEEP_NONPY [KEEP_NONPY ...]] [--keep-empty-lines] [--keep-docstrings] [--keep-annotations] [--quiet] [--dry-run] sources [sources ...]\n\nCleans *.py files from comments, empty lines, annotations and docstrings\n\npositional arguments:\n  sources               paths to python files or files directories to be cleaned; all results will be saved in destination directory with same relative names as in input;absolute paths will be cut to base names,\n                        recommended to use relative paths\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --destination DESTINATION, -d DESTINATION\n                        destination directory (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\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Small PyPI package which provides python code cleaning from comments, docstrings, annotations",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/PasaOpasen/py-code-cleaner"
    },
    "split_keywords": [
        "code",
        " clean",
        " comments",
        " docstrings",
        " annotations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4825c98f38f468cc5cf7bb3e61cf066f397ee7d8467477ec2053e2b377e9a0e",
                "md5": "12a228092a514a29f8e80f9ffb766a33",
                "sha256": "bd26a5c5c12542107d3adad92c939d1d29aa61d4743a1628021658e3bec138ba"
            },
            "downloads": -1,
            "filename": "py_code_cleaner-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12a228092a514a29f8e80f9ffb766a33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8668,
            "upload_time": "2025-01-13T09:43:35",
            "upload_time_iso_8601": "2025-01-13T09:43:35.819325Z",
            "url": "https://files.pythonhosted.org/packages/c4/82/5c98f38f468cc5cf7bb3e61cf066f397ee7d8467477ec2053e2b377e9a0e/py_code_cleaner-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f82a971900d2b1b57ac6ccb19150ac8b194a750c82be06959d6e79e9bda3a7c2",
                "md5": "73afebb04939cbdaf7689b4d8a0fa70b",
                "sha256": "8bdb77ec27d17eb1b518b4882a979a22896b9ab7ea4de930d5e711bc71e096a7"
            },
            "downloads": -1,
            "filename": "py_code_cleaner-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "73afebb04939cbdaf7689b4d8a0fa70b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7466,
            "upload_time": "2025-01-13T09:43:40",
            "upload_time_iso_8601": "2025-01-13T09:43:40.209986Z",
            "url": "https://files.pythonhosted.org/packages/f8/2a/971900d2b1b57ac6ccb19150ac8b194a750c82be06959d6e79e9bda3a7c2/py_code_cleaner-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-13 09:43:40",
    "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.49203s