Metadata-Version: 2.4
Name: dispose
Version: 0.1.0
Summary: Local privacy classifier and redactor for sensitive files (emails, text, markdown, PDFs)
Author: hiddendispatches
License: MIT License
        
        Copyright (c) 2026 hiddendispatches
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://codeberg.org/hiddendispatches/dispose
Project-URL: Repository, https://codeberg.org/hiddendispatches/dispose
Project-URL: Issues, https://codeberg.org/hiddendispatches/dispose/issues
Keywords: privacy,pii,redaction,classifier,cli,email
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Text Processing :: Filters
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1
Requires-Dist: pypdf>=4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# dispose

Local privacy classifier and redactor for sensitive files — text, markdown, email (`.eml`), and PDF.

Built for scrubbing **iCloud / personal email exports** before you feed them to an AI agent. Sensitive spans are replaced with `[REDACTED]`. Nothing is sent to OpenAI or any other network service.

**Source:** [codeberg.org/hiddendispatches/dispose](https://codeberg.org/hiddendispatches/dispose)

## Install

Requires Python 3.9+.

```bash
pip install dispose
```

Then:

```bash
dispose --version
dispose categories
```

### From source (contributors)

```bash
git clone https://codeberg.org/hiddendispatches/dispose.git
cd dispose
pip install -e ".[dev]"
pytest
```

## Eight privacy categories

Same taxonomy as OpenAI Privacy Filter (without using their model or tool):

| Category | What gets redacted |
|---|---|
| `account_number` | SSNs, credit cards (Luhn), bank accounts, routing numbers, IBANs, labeled account / member / policy IDs |
| `private_address` | Street addresses, city/state/ZIP, PO boxes |
| `private_email` | Email addresses |
| `private_person` | Names in email headers, salutations, signatures |
| `private_phone` | Phone numbers |
| `private_url` | URLs and IP addresses (including iCloud / share links) |
| `private_date` | Dates, especially DOB-labeled dates |
| `secret` | Passwords, API keys, tokens, JWTs, PEM private keys |

Classifiers are deterministic pattern engines tuned for high recall on structured PII in correspondence. They run entirely offline.

## Usage

```bash
# List the eight categories
dispose categories

# Read an .eml: decode base64 / quoted-printable so you can actually read it
dispose view path/to/mail.eml
dispose decode path/to/mail.eml          # alias for view
dispose view mail.eml --pager            # open in less/more
dispose view mail.eml -o readable.txt    # save decoded text

# Read decoded content AND redact privacy spans
dispose view mail.eml --redact
dispose view mail.eml --redact -o clean.txt

# Classify a file (report spans, do not write)
dispose classify path/to/email.eml
dispose classify ./exports --recursive --json

# Redact → writes path.redacted.ext by default
dispose redact path/to/notes.md
dispose redact ./icloud-export --recursive

# Print redacted text to stdout (pipe into an agent)
dispose redact message.eml --stdout

# Pipe / stdin
cat message.eml | dispose view -
cat message.eml | dispose redact -

# Overwrite in place (careful)
dispose redact sensitive.txt --in-place

# Only certain categories
dispose redact mail.eml -c private_email -c private_phone -c account_number

# Labeled placeholders: [REDACTED:private_email]
dispose redact mail.eml --label-categories

# OpenAI Privacy Filter-style alias
dispose filter mail.eml --stdout
```

### Supported inputs

- Text / markdown: `.txt`, `.md`, `.markdown`, `.rst`, `.log`, …
- Email: `.eml` (MIME-parsed into headers + body by default; **base64** and quoted-printable transfer encodings are decoded before redaction, including multipart bodies, nested messages, text attachments, and RFC 2047 headers)
- Structured text: `.csv`, `.json`, `.yaml`, `.html`, …
- PDF: `.pdf` (text is extracted, redacted, and written as a clean text PDF or plain text if you choose a non-`.pdf` output path)

## Library use

```python
from dispose import PrivacyPipeline

pipeline = PrivacyPipeline()
result = pipeline.redact(open("mail.eml").read())
print(result.redacted)
print(result.summary())
for span in result.spans:
    print(span.category, span.text, span.score)
```

## Safety notes

- `dispose` is a **data minimization aid**, not a legal anonymization guarantee.
- Pattern classifiers can miss novel formats and can over-redact lookalikes.
- Review high-sensitivity outputs before sharing, even with an AI agent you trust.
- Prefer `--stdout` or a separate output directory over `--in-place` until you trust the result.

## Releasing (maintainers)

Version lives only in `pyproject.toml`. Tag on Codeberg matches that version:

```bash
# after bumping version in pyproject.toml
git tag -a v0.1.0 -m "dispose 0.1.0"
git push origin main --tags

pip install -e ".[dev]"
pytest
python -m build
python -m twine check dist/*
# TestPyPI, then PyPI (API token; username __token__)
twine upload --repository testpypi dist/*
twine upload dist/*
```

PyPI does not require GitHub; Codeberg is the source host. Publish with a PyPI API token + `twine` (Trusted Publishing from Codeberg is not available yet).

## License

MIT — see [LICENSE](LICENSE).

## Contributions
If you found this package useful, please consider donating or supporting development as a solo founder I've been without gainful employment for years.

Donations
```
SOL AH7TXdVn2ZddT7DALxSQz97AJBvweBXZdvV5vAojqgBy
ZEC BNB Chain 0xF7fE0DD3165053bD87217BF3e09041e123736175
TON/GRAM UQAnfI9jJj1iI5nxRcc0jXjrFtg41Ik7XvskB77mLNNMKwwK
```

Dev Studio `https://6-castles.xyz`

Support `dispose-dev AT beconfidential DOT co`

