Skip to content

Instantly share code, notes, and snippets.

@kobybum
kobybum / unused_modules.sh
Last active April 5, 2024 00:44
Finding Unused Python Files
#!/bin/bash
# This is part of a Medium article about finding unused files:
# https://medium.com/@kobybum/finding-dead-python-files-with-snakefood-6c75a3e82294
# Generate a list of included dependencies
sfood -i example-project > /tmp/out.deps
# Get dependant filepath from each dependency, sort and get unique
cat /tmp/out.deps | \
grep -v test | \
<system>
log_level info
</system>
<source>
@id fluentd-containers.log
@type tail
@label @KUBERNETES_CONTAINERS
path /var/log/containers/*.log
pos_file /var/log/containers.log.pos
tag raw.containers.*