shellder 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
shellder-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Soorya Prakash R
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: shellder
3
+ Version: 0.1.0
4
+ Summary: Python client for the Shellder prompt API
5
+ Author: Soorya Prakash R
6
+ License: MIT
7
+ Keywords: prompt,prompt-engineering,ai,shellder
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # Shellder
17
+
18
+ Python client for the Shellder prompt API. Optimize prompts, scrub PII and run safety checks in one call.
19
+
20
+ ## Install
21
+
22
+ ```
23
+ pip install shellder
24
+ ```
25
+
26
+ ## Get an API key
27
+
28
+ Sign in at the Shellder website, open **API Management** and generate a key (starts with `shld_`).
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ from shellder import Shellder
34
+
35
+ client = Shellder(api_key="YOUR_API_KEY") # or set the SHELLDER_API_KEY environment variable
36
+
37
+ prompt = client.prompts.create(
38
+ input="Send an email to user@example.com explaining our project timeline.",
39
+ safety_check=True,
40
+ pii_scrubbing=True,
41
+ optimize=True,
42
+ preserve_variables=["user@example.com"],
43
+ )
44
+
45
+ print(prompt.output_text) # optimized prompt (None if blocked by the safety check)
46
+ print(prompt.usage) # e.g. {'remaining': 14, 'daily_count': 1, 'limit': 15, ...}
47
+ ```
48
+
49
+ ## Response
50
+
51
+ | Property | Description |
52
+ |---|---|
53
+ | `output_text` | Optimized prompt, or the PII-sanitized prompt if `optimize=False`. `None` if blocked. |
54
+ | `blocked` | `True` if the safety check blocked the request. |
55
+ | `safety` | Safety result (`is_safe`, `flagged_categories`, ...). |
56
+ | `pii` | PII result (`detected`, `entities_found`, `sanitized_prompt`). |
57
+ | `usage` | Daily usage (`remaining`, `daily_count`, `limit`). |
58
+
59
+ ## Errors
60
+
61
+ ```python
62
+ from shellder import Shellder, ShellderError
63
+
64
+ try:
65
+ Shellder(api_key="bad").prompts.create(input="hi")
66
+ except ShellderError as e:
67
+ print(e.status, e.message) # e.g. 401 Unauthorized: API key is invalid.
68
+ ```
69
+
70
+ | Status | Meaning |
71
+ |---|---|
72
+ | 400 | Bad request (missing or too long `input`). |
73
+ | 401 | Invalid API key. |
74
+ | 403 | API key is paused. |
75
+ | 429 | Daily limit reached (resets at 00:00 UTC). |
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,64 @@
1
+ # Shellder
2
+
3
+ Python client for the Shellder prompt API. Optimize prompts, scrub PII and run safety checks in one call.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ pip install shellder
9
+ ```
10
+
11
+ ## Get an API key
12
+
13
+ Sign in at the Shellder website, open **API Management** and generate a key (starts with `shld_`).
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from shellder import Shellder
19
+
20
+ client = Shellder(api_key="YOUR_API_KEY") # or set the SHELLDER_API_KEY environment variable
21
+
22
+ prompt = client.prompts.create(
23
+ input="Send an email to user@example.com explaining our project timeline.",
24
+ safety_check=True,
25
+ pii_scrubbing=True,
26
+ optimize=True,
27
+ preserve_variables=["user@example.com"],
28
+ )
29
+
30
+ print(prompt.output_text) # optimized prompt (None if blocked by the safety check)
31
+ print(prompt.usage) # e.g. {'remaining': 14, 'daily_count': 1, 'limit': 15, ...}
32
+ ```
33
+
34
+ ## Response
35
+
36
+ | Property | Description |
37
+ |---|---|
38
+ | `output_text` | Optimized prompt, or the PII-sanitized prompt if `optimize=False`. `None` if blocked. |
39
+ | `blocked` | `True` if the safety check blocked the request. |
40
+ | `safety` | Safety result (`is_safe`, `flagged_categories`, ...). |
41
+ | `pii` | PII result (`detected`, `entities_found`, `sanitized_prompt`). |
42
+ | `usage` | Daily usage (`remaining`, `daily_count`, `limit`). |
43
+
44
+ ## Errors
45
+
46
+ ```python
47
+ from shellder import Shellder, ShellderError
48
+
49
+ try:
50
+ Shellder(api_key="bad").prompts.create(input="hi")
51
+ except ShellderError as e:
52
+ print(e.status, e.message) # e.g. 401 Unauthorized: API key is invalid.
53
+ ```
54
+
55
+ | Status | Meaning |
56
+ |---|---|
57
+ | 400 | Bad request (missing or too long `input`). |
58
+ | 401 | Invalid API key. |
59
+ | 403 | API key is paused. |
60
+ | 429 | Daily limit reached (resets at 00:00 UTC). |
61
+
62
+ ## License
63
+
64
+ MIT
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "shellder"
7
+ version = "0.1.0"
8
+ description = "Python client for the Shellder prompt API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Soorya Prakash R" }]
13
+ keywords = ["prompt", "prompt-engineering", "ai", "shellder"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ [tool.setuptools]
21
+ py-modules = ["shellder"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: shellder
3
+ Version: 0.1.0
4
+ Summary: Python client for the Shellder prompt API
5
+ Author: Soorya Prakash R
6
+ License: MIT
7
+ Keywords: prompt,prompt-engineering,ai,shellder
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # Shellder
17
+
18
+ Python client for the Shellder prompt API. Optimize prompts, scrub PII and run safety checks in one call.
19
+
20
+ ## Install
21
+
22
+ ```
23
+ pip install shellder
24
+ ```
25
+
26
+ ## Get an API key
27
+
28
+ Sign in at the Shellder website, open **API Management** and generate a key (starts with `shld_`).
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ from shellder import Shellder
34
+
35
+ client = Shellder(api_key="YOUR_API_KEY") # or set the SHELLDER_API_KEY environment variable
36
+
37
+ prompt = client.prompts.create(
38
+ input="Send an email to user@example.com explaining our project timeline.",
39
+ safety_check=True,
40
+ pii_scrubbing=True,
41
+ optimize=True,
42
+ preserve_variables=["user@example.com"],
43
+ )
44
+
45
+ print(prompt.output_text) # optimized prompt (None if blocked by the safety check)
46
+ print(prompt.usage) # e.g. {'remaining': 14, 'daily_count': 1, 'limit': 15, ...}
47
+ ```
48
+
49
+ ## Response
50
+
51
+ | Property | Description |
52
+ |---|---|
53
+ | `output_text` | Optimized prompt, or the PII-sanitized prompt if `optimize=False`. `None` if blocked. |
54
+ | `blocked` | `True` if the safety check blocked the request. |
55
+ | `safety` | Safety result (`is_safe`, `flagged_categories`, ...). |
56
+ | `pii` | PII result (`detected`, `entities_found`, `sanitized_prompt`). |
57
+ | `usage` | Daily usage (`remaining`, `daily_count`, `limit`). |
58
+
59
+ ## Errors
60
+
61
+ ```python
62
+ from shellder import Shellder, ShellderError
63
+
64
+ try:
65
+ Shellder(api_key="bad").prompts.create(input="hi")
66
+ except ShellderError as e:
67
+ print(e.status, e.message) # e.g. 401 Unauthorized: API key is invalid.
68
+ ```
69
+
70
+ | Status | Meaning |
71
+ |---|---|
72
+ | 400 | Bad request (missing or too long `input`). |
73
+ | 401 | Invalid API key. |
74
+ | 403 | API key is paused. |
75
+ | 429 | Daily limit reached (resets at 00:00 UTC). |
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ shellder.py
5
+ shellder.egg-info/PKG-INFO
6
+ shellder.egg-info/SOURCES.txt
7
+ shellder.egg-info/dependency_links.txt
8
+ shellder.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ shellder
@@ -0,0 +1,83 @@
1
+ """Shellder Python client (standard library only).
2
+
3
+ from shellder import Shellder
4
+ client = Shellder(api_key="YOUR_API_KEY") # or set SHELLDER_API_KEY
5
+ prompt = client.prompts.create(input="Explain how AI works in a few words")
6
+ print(prompt.output_text)
7
+ """
8
+ import json
9
+ import os
10
+ import urllib.error
11
+ import urllib.request
12
+
13
+ DEFAULT_URL = "https://prompt-enhancer-api.shellderbrain.workers.dev/api/v1/optimize"
14
+
15
+
16
+ class ShellderError(Exception):
17
+ def __init__(self, status, message):
18
+ super().__init__(f"[{status}] {message}")
19
+ self.status = status
20
+ self.message = message
21
+
22
+
23
+ class Prompt:
24
+ def __init__(self, data):
25
+ self.raw = data
26
+ self.safety = data.get("safety", {})
27
+ self.pii = data.get("pii_scrubbing", {})
28
+ self.optimization = data.get("optimization", {})
29
+ self.usage = data.get("usage", {})
30
+
31
+ @property
32
+ def blocked(self):
33
+ return self.safety.get("action_taken") == "blocked"
34
+
35
+ @property
36
+ def output_text(self):
37
+ """Optimized prompt, else the PII-sanitized prompt. None if blocked by the safety check."""
38
+ if self.blocked:
39
+ return None
40
+ return self.optimization.get("optimized_prompt") or self.pii.get("sanitized_prompt")
41
+
42
+
43
+ class _Prompts:
44
+ def __init__(self, client):
45
+ self._c = client
46
+
47
+ def create(self, input, *, safety_check=True, pii_scrubbing=True, optimize=True, preserve_variables=None):
48
+ body = {
49
+ "prompt": input,
50
+ "options": {
51
+ "safety_check": safety_check,
52
+ "pii_scrubbing": pii_scrubbing,
53
+ "optimize": optimize,
54
+ "preserve_variables": preserve_variables or [],
55
+ },
56
+ }
57
+ return Prompt(self._c._post(body))
58
+
59
+
60
+ class Shellder:
61
+ def __init__(self, api_key=None, base_url=DEFAULT_URL, timeout=60):
62
+ self.api_key = api_key or os.environ.get("SHELLDER_API_KEY")
63
+ if not self.api_key:
64
+ raise ValueError("Provide api_key or set SHELLDER_API_KEY")
65
+ self.base_url, self.timeout = base_url, timeout
66
+ self.prompts = _Prompts(self)
67
+
68
+ def _post(self, body):
69
+ req = urllib.request.Request(
70
+ self.base_url,
71
+ data=json.dumps(body).encode(),
72
+ headers={"Content-Type": "application/json", "x-api-key": self.api_key, "User-Agent": "shellder-python/0.1"},
73
+ method="POST",
74
+ )
75
+ try:
76
+ with urllib.request.urlopen(req, timeout=self.timeout) as r:
77
+ return json.load(r)
78
+ except urllib.error.HTTPError as e:
79
+ try:
80
+ msg = json.load(e).get("error", e.reason)
81
+ except Exception:
82
+ msg = e.reason
83
+ raise ShellderError(e.code, msg) from None