Skip to main content

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

Project description

Introduction

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.

Removing files or directories targets are as follows:

  • Files to be deleted:
    • *.pyc

    • *.pyo

  • Directories to be deleted:
    • __pycache__

    • .cache

    • .mypy_cache

    • .pytest_cache

    • .ruff_cache

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

  • --include-builds:
    • build directory

    • dist directory

    • docs/_build directory: [sphinx]

    • *.manifest files: [pyinstaller]

    • *.spec files: [pyinstaller]

  • --include-envs:
    • .venv directory

    • .nox directory

    • .tox directory

  • --include-metadata:
    • .eggs directory

    • *.egg-info directories

    • .pyre directory

    • .pytype directory

    • pip-wheel-metadata directory

  • --include-testing:
    • .coverage file

    • coverage.xml file

    • nosetests.xml file

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

The following directories are always 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 ...]

cleanpy will remove cache files and temporary files under the DIR_PATH.

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.5.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

cleanpy-0.5.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cleanpy-0.5.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cleanpy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 58a54c909b2626a5b54efaff8b6416130ebef57fbe225ac4b411d3507c327c65
MD5 cd6e91c7d6bb9bcc08cf194f6d3cae0e
BLAKE2b-256 4377da13eece913a0d728bc6736884e00365263e4538327a4cfa2be51b708a7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleanpy-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cleanpy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 061c3c0ec1d44a89151298257ff0217be33f92be890a5a04088e04a22ff1fb69
MD5 0f49b3887a1f63cadea32078d3541060
BLAKE2b-256 f8534976b3cc79ba0f43dbd26a640ba65ebb81f222ca5fa544b24487b494b0b7

See more details on using hashes here.

Supported by

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