Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ pip install datafog[nlp-advanced]
pip install datafog[all]
```

Python 3.13 support is certified for the core SDK and CLI. Optional extras such
as `nlp`, `nlp-advanced`, `ocr`, `distributed`, and `all` are available but not
yet certified on Python 3.13.

## Quick Start

```python
Expand Down Expand Up @@ -132,9 +136,15 @@ datafog hash-text "john@example.com"

## Telemetry

DataFog includes anonymous telemetry by default.
DataFog telemetry is disabled by default.

To opt in:

```bash
export DATAFOG_TELEMETRY=1
```

To opt out:
To force telemetry off:

```bash
export DATAFOG_NO_TELEMETRY=1
Expand Down
20 changes: 14 additions & 6 deletions datafog/telemetry.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""
Anonymous, opt-out usage telemetry for DataFog.
Anonymous, opt-in usage telemetry for DataFog.

Collects anonymous usage data to help the DataFog team understand which engines,
functions, and features are actually used. No text content is ever sent.

Opt out by setting either environment variable:
Telemetry is disabled by default. Opt in by setting:
DATAFOG_TELEMETRY=1

Force telemetry off by setting either environment variable:
DATAFOG_NO_TELEMETRY=1
DO_NOT_TRACK=1
"""
Expand All @@ -29,13 +32,18 @@
_scope = threading.local()


def _env_truthy(name: str) -> bool:
"""Return True when an environment variable explicitly opts in/out."""
return os.environ.get(name, "").strip().lower() in {"1", "true", "yes", "on"}


def _is_telemetry_enabled() -> bool:
"""Check if telemetry is enabled (opt-out via env vars)."""
if os.environ.get("DATAFOG_NO_TELEMETRY", "").strip() == "1":
"""Check if telemetry is enabled (opt-in, with opt-out overrides)."""
if _env_truthy("DATAFOG_NO_TELEMETRY"):
return False
if os.environ.get("DO_NOT_TRACK", "").strip() == "1":
if _env_truthy("DO_NOT_TRACK"):
return False
return True
return _env_truthy("DATAFOG_TELEMETRY")


def _get_anonymous_id() -> str:
Expand Down
4 changes: 2 additions & 2 deletions docs/v5-compatibility-matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ Compatibility Matrix
- Deferred for v5.1+ overhaul.
- Keep compatibility where practical; no runtime package installs.
* - Telemetry
- Default-on opt-out telemetry.
- Opt-in telemetry.
- Trust-critical behavior change.
- Make opt-in or no-network-by-default.
- Keep no-network-by-default.
* - ``*_lean`` and ``*_original`` modules
- Parallel historical implementations.
- Remove or make private after migration path.
Expand Down
37 changes: 37 additions & 0 deletions scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
from datetime import datetime


def get_current_version():
"""Read the current package version from datafog/__about__.py."""
try:
with open("datafog/__about__.py") as f:
match = re.search(r'^__version__ = "([^"]+)"', f.read(), re.M)
return match.group(1) if match else None
except OSError:
return None


def get_latest_tag():
"""Get the latest git tag."""
try:
Expand Down Expand Up @@ -65,6 +75,7 @@ def generate_changelog(beta=False, alpha=False):
"""Generate changelog content."""
latest_tag = get_latest_tag()
commits = get_commits_since_tag(latest_tag)
current_version = get_current_version()

if not commits:
return "No changes since last release."
Expand All @@ -85,6 +96,32 @@ def generate_changelog(beta=False, alpha=False):
changelog = "# What's New\n\n"
changelog += f"*Released: {datetime.now().strftime('%Y-%m-%d')}*\n\n"

if not alpha and not beta and current_version == "4.4.0":
changelog += "## Python 3.13 Support Scope\n\n"
changelog += (
"Python 3.13 support is certified for the core SDK and CLI: "
"`pip install datafog` and `pip install datafog[cli]`.\n\n"
)
changelog += (
"Optional extras including `nlp`, `nlp-advanced`, `ocr`, "
"`distributed`, and `all` are available but not yet certified on "
"Python 3.13. They will be validated separately based on user "
"demand.\n\n"
)
changelog += "## v5 Migration Bridge\n\n"
changelog += (
"This release adds the v5-preview top-level APIs `datafog.scan`, "
"`datafog.redact`, and `datafog.protect` while keeping the legacy "
"`datafog.detect` and `datafog.process` APIs working with targeted "
"migration warnings.\n\n"
)
changelog += "## Privacy Defaults\n\n"
changelog += (
"Telemetry is now opt-in. DataFog does not send telemetry unless "
"`DATAFOG_TELEMETRY=1` is explicitly set. `DATAFOG_NO_TELEMETRY=1` "
"and `DO_NOT_TRACK=1` continue to force telemetry off.\n\n"
)

if categories["features"]:
changelog += "## 🚀 New Features\n"
for commit in categories["features"]:
Expand Down
Loading
Loading