python_clamd is a modernized Python wrapper for the ClamAV anti-virus engine.
It allows you to interact with a running clamd daemon on Linux, macOS, and Windows.
This project is a fork of python-clamd (last updated 2014), itself a fork of pyClamd v0.2.0 by Philippe Lagadec, which in turn extended pyClamd v0.1.1 by Alexandre Norman.
- Updated for Python 3.12+ compatibility (replaced deprecated
pkg_resourceswithimportlib.metadata). - Added type hints and annotations for better IDE/autocomplete and
mypysupport. - Actively maintained with patches and modernization.
import python_clamd
cd = python_clamd.ClamdUnixSocket()
cd.ping() # 'PONG'
cd.version() # 'ClamAV ...'
cd.reload() # 'RELOADING'open('/tmp/EICAR','wb').write(python_clamd.EICAR)
cd.scan('/tmp/EICAR')
# {'/tmp/EICAR': ('FOUND', 'Eicar-Test-Signature')}from io import BytesIO
cd.instream(BytesIO(python_clamd.EICAR))
# {'stream': ('FOUND', 'Eicar-Test-Signature')}Coming soon via PyPI:
pip install python-clamdOn Ubuntu:
sudo apt-get install clamav-daemon clamav-freshclam clamav-unofficial-sigs
sudo freshclam
sudo service clamav-daemon start- Python 3.9 – 3.13
- Python 2.x (dropped)
Released under the LGPL license.
PRs and issues are welcome. This fork exists to keep ClamAV bindings usable on modern Python.