Skip to main content

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

Project description


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

PyPI package version Linux/macOS CI status


Installation: pip

pip install cleanpy
Supported Python versions Supported Python implementations

Installation: snap

sudo snap install cleanpy
snapcraft status


cleanpy DIR_PATH [DIR_PATH ...]

cleanpy will remove cache files and temporaly 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:
    • .nox
    • .tox
    • .venv
  • --include-metadata:
    • .eggs
    • *.egg-info
    • .pyre
    • .pytype
    • pip-wheel-metadata
  • --include-tests:
    • .coverage
    • coverage.xml
    • nosetests.xml

All of the above options are specified if set the --all option to the command.

Following directories are excluded from the search:

  • .git
  • .hg
  • .svn
  • node_modules

Execution example

$ cleanpy -av .
[INFO] remove directory [cache - Python]: ./test/__pycache__
[INFO] remove directory [cache - pytest]: ./.pytest_cache
[INFO] remove directory [env - virtual env]: ./.tox
[INFO] remove directory [build - Python]: ./dist
[INFO] remove directory [cache - mypy]: ./.mypy_cache
[INFO] remove directory [metadata - type checker]: ./.pytype
[INFO] remove directory [build - Python]: ./build
[INFO] remove directory [metadata - Python]: ./cleanpy.egg-info
[INFO] removed 8 directories

Command help

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

Remove cache files and temporary files that related to Python.

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

positional arguments:
DIR_PATH            path to a root directory to search

optional arguments:
-h, --help          show this help message and exit
-V, --version       show program's version number and exit
--follow-symlinks   follow symlinks
--dry-run           do no harm.
-v, --verbose       shows verbose output.
--debug             for debug print.
--quiet             suppress execution log messages.

Remove Target:
-a, --all           remove all of the caches and teporary fils.
--include-builds    remove files/directories that related build: build,
                    dist, docs/_build
--include-envs      remove virtual environments.
--include-metadata  remove metadata.
--include-tests     remove test results and coverage files.
--exclude PATTERN   a regular expression that matches files and directories
                    that should be excluded on recursive searches.

Issue tracker:


Python 3.6+

  • 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.

Files for cleanpy, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size cleanpy-0.0.6-py3-none-any.whl (8.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size cleanpy-0.0.6.tar.gz (10.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page