Skip to main content

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 implementations Supported Python versions

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           don't actually do anything.
  -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.9+

  • no external package dependencies

  • platform independent

Metadata

Release files for cleanpy 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cleanpy 0.5.1
File Size Uploaded
cleanpy-0.5.1.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cleanpy 0.5.1
File Interpreter ABI Platform
cleanpy-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / cleanpy-0.5.1.tar.gz

Download URL cleanpy-0.5.1.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ddfa7ce80dd888b597a8b0bfeea3b69567839b6f41b775a4f76f46914d5170e
BLAKE2b-256 checksum
How to use checksums
da94c10e463f720c804c55cb4b3c5f04380fa03e9b1e2fb7026420528fd89476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.

Transparency log

Release files / cleanpy-0.5.1-py3-none-any.whl

Download URL cleanpy-0.5.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c60589d5da68527ca0c9151e28ed56fffae69df4ab6c9bfd8c1cf1d9e76a09b8
BLAKE2b-256 checksum
How to use checksums
c161cfd606e2425a7490982cdfa5c8da86f35b158eba792f5f9107a1788a2ad7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 30, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page