ai-disclosure-magic 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.
@@ -0,0 +1,3 @@
1
+ dist/
2
+ __pycache__/
3
+ *.egg-info/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marcus Garcia
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,67 @@
1
+ Metadata-Version: 2.5
2
+ Name: ai-disclosure-magic
3
+ Version: 0.1.0
4
+ Summary: Magic de célula para Jupyter/IPython que sinaliza código gerado por IA e registra o prompt usado.
5
+ Author: Marcus Garcia
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: ai,disclosure,ipython,jupyter,magic,notebook
9
+ Classifier: Framework :: IPython
10
+ Classifier: Framework :: Jupyter
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.8
14
+ Requires-Dist: ipython>=7
15
+ Description-Content-Type: text/markdown
16
+
17
+ # ai-disclosure-magic
18
+
19
+ Magic de célula para Jupyter/IPython que sinaliza, na saída da célula, que o
20
+ código foi gerado com auxílio de IA e registra o prompt usado. O código da
21
+ célula é executado normalmente em seguida.
22
+
23
+ ## Instalação
24
+
25
+ ```bash
26
+ pip install ai-disclosure-magic
27
+ ```
28
+
29
+ ## Uso
30
+
31
+ Carregue a extensão uma vez no notebook:
32
+
33
+ ```python
34
+ %load_ext ai_disclosure_magic
35
+ ```
36
+
37
+ Prompt curto, na própria linha da magic (`ferramenta | prompt`):
38
+
39
+ ```python
40
+ %%ai_generated Claude Code | gere um histograma da coluna idade
41
+ df["idade"].hist()
42
+ ```
43
+
44
+ Prompt longo, em um bloco de comentários no início da célula:
45
+
46
+ ```python
47
+ %%ai_generated Claude Code
48
+ # prompt: gere um histograma da coluna idade
49
+ # com 20 bins e título em português
50
+ df["idade"].hist(bins=20)
51
+ ```
52
+
53
+ A saída da célula passa a exibir:
54
+
55
+ > 🤖 **Gerado por IA** Claude Code
56
+ >
57
+ > **Prompt:**
58
+ >
59
+ > > gere um histograma da coluna idade
60
+ > > com 20 bins e título em português
61
+
62
+ Se nenhum prompt for informado, a célula exibe o aviso
63
+ "⚠️ *Prompt não informado.*".
64
+
65
+ ## Licença
66
+
67
+ MIT
@@ -0,0 +1,51 @@
1
+ # ai-disclosure-magic
2
+
3
+ Magic de célula para Jupyter/IPython que sinaliza, na saída da célula, que o
4
+ código foi gerado com auxílio de IA e registra o prompt usado. O código da
5
+ célula é executado normalmente em seguida.
6
+
7
+ ## Instalação
8
+
9
+ ```bash
10
+ pip install ai-disclosure-magic
11
+ ```
12
+
13
+ ## Uso
14
+
15
+ Carregue a extensão uma vez no notebook:
16
+
17
+ ```python
18
+ %load_ext ai_disclosure_magic
19
+ ```
20
+
21
+ Prompt curto, na própria linha da magic (`ferramenta | prompt`):
22
+
23
+ ```python
24
+ %%ai_generated Claude Code | gere um histograma da coluna idade
25
+ df["idade"].hist()
26
+ ```
27
+
28
+ Prompt longo, em um bloco de comentários no início da célula:
29
+
30
+ ```python
31
+ %%ai_generated Claude Code
32
+ # prompt: gere um histograma da coluna idade
33
+ # com 20 bins e título em português
34
+ df["idade"].hist(bins=20)
35
+ ```
36
+
37
+ A saída da célula passa a exibir:
38
+
39
+ > 🤖 **Gerado por IA** Claude Code
40
+ >
41
+ > **Prompt:**
42
+ >
43
+ > > gere um histograma da coluna idade
44
+ > > com 20 bins e título em português
45
+
46
+ Se nenhum prompt for informado, a célula exibe o aviso
47
+ "⚠️ *Prompt não informado.*".
48
+
49
+ ## Licença
50
+
51
+ MIT
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "ai-disclosure-magic"
7
+ version = "0.1.0"
8
+ description = "Magic de célula para Jupyter/IPython que sinaliza código gerado por IA e registra o prompt usado."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Marcus Garcia" }]
14
+ keywords = ["jupyter", "ipython", "magic", "ai", "disclosure", "notebook"]
15
+ classifiers = [
16
+ "Framework :: IPython",
17
+ "Framework :: Jupyter",
18
+ "Programming Language :: Python :: 3",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dependencies = ["ipython>=7"]
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["src/ai_disclosure_magic"]
@@ -0,0 +1,53 @@
1
+ """Magic de célula `%%ai_generated` para sinalizar código gerado por IA.
2
+
3
+ Carregue no notebook com `%load_ext ai_disclosure_magic`.
4
+ """
5
+
6
+ from IPython import get_ipython
7
+ from IPython.display import Markdown, display
8
+
9
+ __version__ = "0.1.0"
10
+ __all__ = ["ai_generated", "load_ipython_extension"]
11
+
12
+ PROMPT_PREFIX = "# prompt:"
13
+
14
+
15
+ def _split_prompt_block(cell):
16
+ """Separa um bloco inicial `# prompt: ...` (com linhas `#` de continuação) do código."""
17
+ lines = cell.splitlines()
18
+ if not lines or not lines[0].lower().startswith(PROMPT_PREFIX):
19
+ return "", cell
20
+ prompt = [lines[0][len(PROMPT_PREFIX):].strip()]
21
+ i = 1
22
+ while i < len(lines) and lines[i].startswith("#"):
23
+ prompt.append(lines[i][1:].strip())
24
+ i += 1
25
+ return "\n".join(prompt).strip(), "\n".join(lines[i:])
26
+
27
+
28
+ def ai_generated(line, cell):
29
+ """Uso:
30
+ %%ai_generated [ferramenta/observação] | prompt usado
31
+
32
+ Para prompts longos, use um bloco de comentários no início da célula:
33
+ %%ai_generated Claude Code
34
+ # prompt: primeira linha do prompt
35
+ # continuação do prompt
36
+ <código>
37
+ """
38
+ tool, _, line_prompt = line.partition("|")
39
+ block_prompt, code = _split_prompt_block(cell)
40
+ prompt = "\n".join(p for p in (line_prompt.strip(), block_prompt) if p)
41
+
42
+ md = f"🤖 **Gerado por IA** {tool.strip()}".strip()
43
+ if prompt:
44
+ quoted = "\n".join(f"> {l}" for l in prompt.splitlines())
45
+ md += f"\n\n**Prompt:**\n\n{quoted}"
46
+ else:
47
+ md += "\n\n⚠️ *Prompt não informado.*"
48
+ display(Markdown(md))
49
+ get_ipython().run_cell(code)
50
+
51
+
52
+ def load_ipython_extension(ipython):
53
+ ipython.register_magic_function(ai_generated, magic_kind="cell")