Skip to content

Commit 25f87fd

Browse files
chore: revive project and release 0.1.5 (#1)
- Point project URLs at modelpath-dev/ShieldPrompt (old links 404'd on PyPI) - Add a tests workflow (Python 3.9-3.12) and gate PyPI publish on pytest - Stop tracking vault.json; ignore vault files and .venv - Drop unused span-marker from the ner extra; fix stale install hint and spaCy model name in HybridDetector - Replace deprecated asyncio.get_event_loop() in the async decorator test - Bump version to 0.1.5
1 parent 74ac508 commit 25f87fd

9 files changed

Lines changed: 55 additions & 16 deletions

File tree

‎.github/workflows/pypi-publish.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ jobs:
2323
with:
2424
python-version: '3.11'
2525

26+
- name: Run tests
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e '.[dev]'
30+
pytest -q
31+
2632
- name: Build package
2733
run: |
2834
python -m pip install --upgrade pip build

‎.github/workflows/tests.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
pytest:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ['3.9', '3.10', '3.11', '3.12']
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install package
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -e '.[dev]'
32+
33+
- name: Run tests
34+
run: pytest -q

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.pytest_cache
33
__pycache__
44

5+
vault.json
6+
*.vault.json
7+
.venv

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Under the hood:
3636
1. **Detection** — a hybrid engine combines deterministic regex patterns
3737
(emails, phones, credit cards with Luhn validation, SSNs, IPs, IBANs,
3838
URLs, AWS/API keys) with Microsoft Presidio + spaCy NER for
39-
contextual entities (people, organizations, locations).
39+
contextual entities (people, organizations, locations). If Presidio
40+
can't load, it falls back to a HuggingFace transformer model
41+
(`pip install "shieldprompt[ner]"`).
4042
2. **Masking** — each detected value is stored in an in-memory vault and
4143
replaced with a stable token like `[PERSON_1]` or `[EMAIL_ADDRESS_2]`.
4244
3. **Unmasking** — after the LLM responds, tokens are mapped back to the

‎pyproject.toml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "shieldprompt"
7-
version = "0.1.4"
7+
version = "0.1.5"
88
description = "Privacy bridge for LLMs — mask PII before it leaves your machine."
99
readme = "README.md"
1010
license = {text = "MIT"}
@@ -27,7 +27,7 @@ dependencies = [
2727
]
2828

2929
[project.optional-dependencies]
30-
ner = ["transformers>=4.30.0", "torch>=2.0.0", "span-marker>=1.5.0"]
30+
ner = ["transformers>=4.30.0", "torch>=2.0.0"]
3131
fastapi = ["fastapi>=0.100.0", "starlette>=0.27.0"]
3232
all = ["shieldprompt[ner,fastapi]"]
3333
dev = [
@@ -44,8 +44,9 @@ pii = "shieldprompt.cli:pii_main"
4444
retrace = "shieldprompt.cli:retrace_main"
4545

4646
[project.urls]
47-
Homepage = "https://github.com/shieldprompt/shieldprompt"
48-
Documentation = "https://github.com/shieldprompt/shieldprompt#readme"
47+
Homepage = "https://github.com/modelpath-dev/ShieldPrompt"
48+
Documentation = "https://github.com/modelpath-dev/ShieldPrompt/blob/main/SETUP.md"
49+
Issues = "https://github.com/modelpath-dev/ShieldPrompt/issues"
4950

5051
[tool.hatch.build.targets.wheel]
5152
packages = ["src/shieldprompt"]

‎src/shieldprompt/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .shield import Shield
99
from .vault import Vault, get_vault
1010

11-
__version__ = "0.1.4"
11+
__version__ = "0.1.5"
1212

1313
__all__ = [
1414
"Shield",

‎src/shieldprompt/detector/hybrid.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class HybridDetector:
1515
"""Combines regex (fast, deterministic) and NER (contextual) detection.
1616
1717
NER backend selection order:
18-
1. Presidio (presidio-analyzer + spaCy en_core_web_lg) — preferred
18+
1. Presidio (presidio-analyzer + spaCy en_core_web_sm) — preferred
1919
2. HuggingFace transformer (dslim/bert-base-NER) — fallback
2020
3. Regex only — if neither is installed
2121
"""
@@ -81,7 +81,7 @@ def _init_ner_backend(
8181
except ImportError:
8282
logger.info(
8383
"No NER backend installed — regex-only detection. "
84-
"Install with: pip install shieldprompt[presidio] "
84+
"Reinstall shieldprompt (Presidio is a core dependency) "
8585
"or: pip install shieldprompt[ner]"
8686
)
8787
return None

‎tests/test_decorator.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ async def echo_async(prompt: str) -> str:
2525
assert "bob@test.com" not in prompt
2626
return f"Got: {prompt}"
2727

28-
result = asyncio.get_event_loop().run_until_complete(
29-
echo_async("Send to bob@test.com")
30-
)
28+
result = asyncio.run(echo_async("Send to bob@test.com"))
3129
assert "bob@test.com" in result
3230

3331

‎vault.json‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)