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 that related to Python.

PyPI package version CI status of Linux/macOS/Windows

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

  • --include-metadata:
    • .eggs

    • *.egg-info

    • .pyre/

    • .pytype/

    • pip-wheel-metadata

  • --include-testing:
    • .nox

    • .tox

    • .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 -avf --exclude-envs .
[INFO] remove directory [cache - Python]: ./test/__pycache__
[INFO] remove directory [cache - pytest]: ./.pytest_cache
[INFO] remove directory [testing - manager]: ./.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] [--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 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
  --list              print target directories/files. does not actually remove.
  --follow-symlinks   follow symlinks.
  --dry-run           do no harm.
  -i, --interactive   prompt before remove.
  -f, --force         no prompt before remove.
  -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 files.
  --include-builds    remove files/directories that related build: build, dist, docs/_build
  --include-envs      remove virtual environments.
  --include-metadata  remove metadata.
  --include-testing   remove test results and coverage files.
  --exclude PATTERN   a regular expression that matches files and directories that should be excluded on recursive searches.
  --exclude-envs      exclude virtual environments.

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

Dependencies

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.

Source Distribution

cleanpy-0.3.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cleanpy-0.3.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for cleanpy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e766701bacec49aeb96b1edfdd131274b93565596c64a877a6cf5bb71ec7708a
MD5 e0fe5e1769036bce10c4308a70048f5c
BLAKE2b-256 fe7ccf4af4de7b32699d26dfb9782833c40be289774b80dd16e2013f7b3da1de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleanpy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for cleanpy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eab93a21a7205f06998e4d83a7c3e329fdc96d443d75833ef39bd80e0f48ce34
MD5 fa00f7495fdc338a4d787d5f9bc8e10a
BLAKE2b-256 da51c29683fabb25fd7c4b22e968e8dd1cc07471c13b06206ef1a42df983e52c

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