spamfilter
spamfilter is a lightweight, fast and straightforward Python library that helps you to build your own spam filtering pipelines in order to keep your applications featuring user-generated content clean.
It's object-oriented and makes a quick, concise approach to remove spam easy. spamfilter is highly configurable and ships with deep integrations for third-party APIs, 🤗 Transformers AI/ML text classifiers and language models via OpenAI.
Important links
Installation
You can install spamfilter by cloning the GitHub repository, downloading it from the GitHub page or using pip - which is the recommended approach:
pip install spamfilter
Please see the installation guide for more information and methods on how to install spamfilter and its dependencies, especially if you plan to use API or machine learning functionality as this requires additional dependencies.
Usage
The most basic primer into the spamfilter library is defining a pipeline using several filters stacked on top of each other.
from spamfilter.filters import Length, SpecialChars
from spamfilter.pipelines import Pipeline
# create a new pipeline
m = Pipeline([
# length of 10 to 200 chars, crop if needed
Length(min_=10, max_=200, mode="crop"),
# limit use of special characters
SpecialChars(mode="normal")
])
# test a string against it
TEST_STRING = "This is a test string."
print(m.check(TEST_STRING).passed)
Output:
True
License
This project is published under the MIT License.
Contributing
Feel free to contribute to the project using the GitHub repository. Additions to the spam filters, pipelines and documentation are always welcome!
Learn more here if you're interested in helping out!
Metadata
Release files for spamfilter 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spamfilter-3.0.0.tar.gz | 516.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spamfilter-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 541.3 kB
Release files / spamfilter-3.0.0.tar.gz
| Download URL | spamfilter-3.0.0.tar.gz |
|---|---|
| Size | 516.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
131d5e9d4ec00a0e157006b3610637cf77d9eb7523798e88ad9fbabb08ccf11a
|
|
BLAKE2b-256 checksum How to use checksums |
fdd6ac1059d8d4c6596dd06e39283db678850bc9ca4acd3b091c867694368126
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 28, 2025.
Transparency logRelease files / spamfilter-3.0.0-py3-none-any.whl
| Download URL | spamfilter-3.0.0-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b3064f10ea4d65422f1d0070c5e73207f15a298b4efa16d0eacb4c398d2682b
|
|
BLAKE2b-256 checksum How to use checksums |
397c722f134c62c1f19520b76d88c402b8a10e745ad3c124d84fa039de26b7d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 28, 2025.
Transparency log