Tool for cleaning up python virtual environments (venv), __pycache__, node_modules directories and saving requirements.txt for entire directory trees
Project description
env_cleanup_utils
A Python package for cleaning up virtual environments (venv), __pycache__, and node_modules directories within a directory tree. It also saves the requirements of virtual environments to a requirements.txt file.
It is capable of traversing the subdirectories and finding all virtual environments
Installation
You can install the env_cleanup_utils package using pip:
pip install env_cleanup_utils
Usage
Command Line Usage
You can use env_cleanup_utils as a command-line utility by running the following command:
python -m env_cleanup_utils [OPTIONS] ROOT_DIR
Replace ROOT_DIR with the root directory where you want to search for virtual environments.
Options:
--delete-all: Delete venvs,__pycache__, andnode_modulesdirectories.--delete-venv: Delete virtual environments.--delete-pycache: Delete__pycache__directories (confirmed automatically).--delete-node: Deletenode_modulesdirectories.-y: Auto-confirm all deletion prompts.--debug: Enable debug mode for additional logging.
Python API
You can also use env_cleanup_utils programmatically in your Python code. Import the necessary functions and classes from the package and call them as needed.
Example:
from env_cleanup_utils import (
find_venv_dirs,
find_pycache_dirs,
find_node_modules_dirs,
save_requirements,
delete_venv,
delete_pycache,
delete_node_modules,
)
# Use the functions and classes as needed.
Sample Usage
# Example command line usage:
python -m env_cleanup_utils ./my_project_directory --delete-venv --debug
# Example Python API usage:
from env_cleanup_utils import (
find_venv_dirs,
save_requirements,
delete_venv,
)
root_dir = "./my_project_directory"
venv_dirs = find_venv_dirs(root_dir)
for venv_dir in venv_dirs:
save_requirements(venv_dir)
delete_venv(venv_dir)
Contributing
If you would like to contribute to the development of the env_cleanup_utils package by adding more functionality, you are welcome to open a pull request.
References
Please ensure you have the required permissions before running the tool, and use it responsibly. This package is provided as-is, without any warranty or guarantee.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file env_cleanup_utils-0.1.0.tar.gz.
File metadata
- Download URL: env_cleanup_utils-0.1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60609ecbd8f44c75ada0f73b6e7c33ee27ae93e027a15949f1cc3b961eee2af4
|
|
| MD5 |
da9103124631151097a1efde15b59494
|
|
| BLAKE2b-256 |
9fe4758b14e569efd69344a0085b24bf1e6d2cf950fc256cc0cb9054e612503f
|
File details
Details for the file env_cleanup_utils-0.1.0-py3-none-any.whl.
File metadata
- Download URL: env_cleanup_utils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90facbbf3b84af52179c3e30c472e7c07a0bd2317b3c6d0980595e2098ec3174
|
|
| MD5 |
db35f99e239f7a294afccc3e553c5f0f
|
|
| BLAKE2b-256 |
f212a0daf5c137f0cb61d1fa8c177f75140d8cdba3d5683c3d94d58207c29c46
|