Skip to main content

cleanpy is a CLI tool to remove caches and temporary files that related to Python.

Project description

Summary

cleanpy is a CLI tool to remove caches and temporary files related to Python.

PyPI package version CI status of Linux/macOS/Windows CodeQL

Installation

Installation: pip

pip install cleanpy
Supported Python versions Supported Python implementations

Installation: snap

sudo snap install cleanpy
snapcraft status

Usage

cleanpy DIR_PATH [DIR_PATH ...]

cleanpy will remove cache files and temporary files under the DIR_PATH

Remove files/directories are as follows:

  • files:
    • *.pyc

    • *.pyo

  • directories:
    • __pycache__

    • .cache

    • .mypy_cache

    • .pytest_cache

You can also remove additional files/directories if the following options are specified:

  • --include-builds:
    • build

    • dist

    • docs/_build: [sphinx]

    • *.manifest: [pyinstaller]

    • *.spec: [pyinstaller]

  • --include-envs:
    • .venv

    • .nox

    • .tox

  • --include-metadata:
    • .eggs

    • *.egg-info

    • .pyre/

    • .pytype/

    • pip-wheel-metadata

  • --include-testing:
    • .coverage

    • coverage.xml

    • nosetests.xml

All the above options are specified if you use the --all option.

The following directories are excluded from the remove:

  • .git

  • .hg

  • .svn

  • node_modules

Execution example

Clean the current directory except for virtual environments:

cleanpy --all --exclude-envs .

Command help

usage: cleanpy [-h] [-V] [--list] [--follow-symlinks] [--dry-run] [-a] [--include-builds] [--include-envs] [--include-metadata] [--include-testing] [--exclude PATTERN] [--exclude-envs] [-i | -f] [-v | --debug | --quiet] DIR_PATH [DIR_PATH ...]

Remove cache files and temporary files that are related to Python.

Skip directories from recursive search: .git, .hg, .svn, node_modules

positional arguments:
  DIR_PATH            path to a root directory to search.

options:
  -h, --help          show this help message and exit
  -V, --version       show program's version number and exit
  --list              print target directories/files. this does not actually remove directories/files.
  --follow-symlinks   follow symlinks.
  --dry-run           do no harm.
  -i, --interactive   prompt on each file/directory delete.
  -f, --force         delete file/directory without prompt.
  -v, --verbose       shows the verbose output.
  --debug             for debug print.
  --quiet             suppress execution log messages.

Remove Target:
  -a, --all           remove all of the caches and temporary files.
  --include-builds    remove files/directories that are related to build: build, dist, docs/_build
  --include-envs      remove virtual environment caches.
  --include-metadata  remove metadata.
  --include-testing   remove test results and coverage files.
  --exclude PATTERN   a regular expression for files and directories to be excluded from the removes.
  --exclude-envs      exclude virtual environments from deletion.

Issue tracker: https://github.com/thombashi/cleanpy/issues

Dependencies

Python 3.7+

  • no external package dependencies

  • platform independent

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

cleanpy-0.4.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cleanpy-0.4.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file cleanpy-0.4.0.tar.gz.

File metadata

  • Download URL: cleanpy-0.4.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for cleanpy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 291dd6b2643b2f434a95c0a4bbefac8b152e7b63cad1d369b0b605b156dbfa90
MD5 6858dcca4844fac4659d16e88c231998
BLAKE2b-256 6e637da258df71f6d35bffa0f449158951888ba2a5e105cb421b777382ad864f

See more details on using hashes here.

File details

Details for the file cleanpy-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: cleanpy-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for cleanpy-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d047ed8c6d3e1439f99b02633a94b1cbae65bbd4d928b5484367a674d66b5d6
MD5 73d2286a772748370d7209b6fe8c6499
BLAKE2b-256 3f1945a7de25bd9376186914ad5df1b8c513e3176e16824a27902ecd3de59c2a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page