vibe-coded-decorator 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.
- vibe_coded_decorator-0.1.0/PKG-INFO +106 -0
- vibe_coded_decorator-0.1.0/README.md +82 -0
- vibe_coded_decorator-0.1.0/pyproject.toml +46 -0
- vibe_coded_decorator-0.1.0/setup.cfg +4 -0
- vibe_coded_decorator-0.1.0/tests/test_vibe_coded.py +190 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator/__init__.py +46 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator.egg-info/PKG-INFO +106 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator.egg-info/SOURCES.txt +9 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator.egg-info/dependency_links.txt +1 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator.egg-info/requires.txt +3 -0
- vibe_coded_decorator-0.1.0/vibe_coded_decorator.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vibe-coded-decorator
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A decorator to mark functions as vibe-coded in their docstrings
|
|
5
|
+
Author-email: Sep Keucheni <septimber@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sepkeuchenius/vibe-coded-decorator
|
|
8
|
+
Project-URL: Repository, https://github.com/sepkeuchenius/vibe-coded-decorator
|
|
9
|
+
Keywords: decorator,docstring,vibe-coding,fastapi
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# vibe-coded-decorator
|
|
26
|
+
|
|
27
|
+
A Python decorator that marks functions as "vibe-coded" by adding a notice to their docstrings. This notice will appear in automatic documentation tools like FastAPI's interactive docs.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install vibe-coded-decorator
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install from source:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Simply add the `@vibe_coded` decorator to any function:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from vibe_coded_decorator import vibe_coded
|
|
47
|
+
|
|
48
|
+
@vibe_coded
|
|
49
|
+
def my_function():
|
|
50
|
+
"""This is my function."""
|
|
51
|
+
return "Hello, world!"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The decorator will modify the function's docstring to include a notice at the beginning:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
print(my_function.__doc__)
|
|
58
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
59
|
+
#
|
|
60
|
+
# This is my function.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### With FastAPI
|
|
64
|
+
|
|
65
|
+
The decorator works seamlessly with FastAPI, and the notice will appear in the automatic API documentation:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from fastapi import FastAPI
|
|
69
|
+
from vibe_coded_decorator import vibe_coded
|
|
70
|
+
|
|
71
|
+
app = FastAPI()
|
|
72
|
+
|
|
73
|
+
@app.get("/hello")
|
|
74
|
+
@vibe_coded
|
|
75
|
+
def hello_world():
|
|
76
|
+
"""Returns a greeting message."""
|
|
77
|
+
return {"message": "Hello, world!"}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
When you visit the FastAPI docs at `/docs`, you'll see "**THIS FUNCTION HAS BEEN VIBE CODED**" at the top of the function's description.
|
|
81
|
+
|
|
82
|
+
### Functions Without Docstrings
|
|
83
|
+
|
|
84
|
+
The decorator also works with functions that don't have docstrings:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
@vibe_coded
|
|
88
|
+
def no_docstring():
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
print(no_docstring.__doc__)
|
|
92
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
To install in development mode:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install -e .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
|
106
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# vibe-coded-decorator
|
|
2
|
+
|
|
3
|
+
A Python decorator that marks functions as "vibe-coded" by adding a notice to their docstrings. This notice will appear in automatic documentation tools like FastAPI's interactive docs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install vibe-coded-decorator
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install from source:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Simply add the `@vibe_coded` decorator to any function:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from vibe_coded_decorator import vibe_coded
|
|
23
|
+
|
|
24
|
+
@vibe_coded
|
|
25
|
+
def my_function():
|
|
26
|
+
"""This is my function."""
|
|
27
|
+
return "Hello, world!"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The decorator will modify the function's docstring to include a notice at the beginning:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
print(my_function.__doc__)
|
|
34
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
35
|
+
#
|
|
36
|
+
# This is my function.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### With FastAPI
|
|
40
|
+
|
|
41
|
+
The decorator works seamlessly with FastAPI, and the notice will appear in the automatic API documentation:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from fastapi import FastAPI
|
|
45
|
+
from vibe_coded_decorator import vibe_coded
|
|
46
|
+
|
|
47
|
+
app = FastAPI()
|
|
48
|
+
|
|
49
|
+
@app.get("/hello")
|
|
50
|
+
@vibe_coded
|
|
51
|
+
def hello_world():
|
|
52
|
+
"""Returns a greeting message."""
|
|
53
|
+
return {"message": "Hello, world!"}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
When you visit the FastAPI docs at `/docs`, you'll see "**THIS FUNCTION HAS BEEN VIBE CODED**" at the top of the function's description.
|
|
57
|
+
|
|
58
|
+
### Functions Without Docstrings
|
|
59
|
+
|
|
60
|
+
The decorator also works with functions that don't have docstrings:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
@vibe_coded
|
|
64
|
+
def no_docstring():
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
print(no_docstring.__doc__)
|
|
68
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
To install in development mode:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install -e .
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
|
82
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vibe-coded-decorator"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A decorator to mark functions as vibe-coded in their docstrings"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Sep Keucheni", email = "septimber@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["decorator", "docstring", "vibe-coding", "fastapi"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.7",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/sepkeuchenius/vibe-coded-decorator"
|
|
31
|
+
Repository = "https://github.com/sepkeuchenius/vibe-coded-decorator"
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=7.0.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools]
|
|
39
|
+
packages = ["vibe_coded_decorator"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
testpaths = ["tests"]
|
|
43
|
+
python_files = ["test_*.py"]
|
|
44
|
+
python_classes = ["Test*"]
|
|
45
|
+
python_functions = ["test_*"]
|
|
46
|
+
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""Tests for the vibe_coded decorator."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from vibe_coded_decorator import vibe_coded
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_decorator_with_existing_docstring():
|
|
8
|
+
"""Test that decorator prepends notice to existing docstring."""
|
|
9
|
+
@vibe_coded
|
|
10
|
+
def test_func():
|
|
11
|
+
"""Original docstring."""
|
|
12
|
+
return "test"
|
|
13
|
+
|
|
14
|
+
assert test_func.__doc__ == "**THIS FUNCTION HAS BEEN VIBE CODED**\n\nOriginal docstring."
|
|
15
|
+
assert test_func() == "test"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_decorator_without_docstring():
|
|
19
|
+
"""Test that decorator adds notice when no docstring exists."""
|
|
20
|
+
@vibe_coded
|
|
21
|
+
def test_func():
|
|
22
|
+
return "test"
|
|
23
|
+
|
|
24
|
+
assert test_func.__doc__ == "**THIS FUNCTION HAS BEEN VIBE CODED**"
|
|
25
|
+
assert test_func() == "test"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_decorator_preserves_function_metadata():
|
|
29
|
+
"""Test that decorator preserves function name and other metadata."""
|
|
30
|
+
@vibe_coded
|
|
31
|
+
def original_function_name():
|
|
32
|
+
"""Test function."""
|
|
33
|
+
return "test"
|
|
34
|
+
|
|
35
|
+
assert original_function_name.__name__ == "original_function_name"
|
|
36
|
+
assert callable(original_function_name)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_decorator_with_arguments():
|
|
40
|
+
"""Test that decorator works with functions that have arguments."""
|
|
41
|
+
@vibe_coded
|
|
42
|
+
def test_func(arg1, arg2, kwarg1=None):
|
|
43
|
+
"""Function with arguments."""
|
|
44
|
+
return arg1 + arg2 + (kwarg1 or 0)
|
|
45
|
+
|
|
46
|
+
assert test_func.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
47
|
+
assert test_func(1, 2, kwarg1=3) == 6
|
|
48
|
+
assert test_func(1, 2) == 3
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_decorator_with_multiline_docstring():
|
|
52
|
+
"""Test that decorator works with multiline docstrings."""
|
|
53
|
+
@vibe_coded
|
|
54
|
+
def test_func():
|
|
55
|
+
"""This is a multiline docstring.
|
|
56
|
+
|
|
57
|
+
It has multiple lines.
|
|
58
|
+
And more information here.
|
|
59
|
+
"""
|
|
60
|
+
return "test"
|
|
61
|
+
|
|
62
|
+
docstring = test_func.__doc__
|
|
63
|
+
assert docstring.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
64
|
+
assert "This is a multiline docstring" in docstring
|
|
65
|
+
assert "It has multiple lines" in docstring
|
|
66
|
+
assert "And more information here" in docstring
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_decorator_with_empty_docstring():
|
|
70
|
+
"""Test that decorator handles empty docstring."""
|
|
71
|
+
@vibe_coded
|
|
72
|
+
def test_func():
|
|
73
|
+
""""""
|
|
74
|
+
return "test"
|
|
75
|
+
|
|
76
|
+
# Empty docstring is falsy, so it should just have the notice
|
|
77
|
+
assert test_func.__doc__ == "**THIS FUNCTION HAS BEEN VIBE CODED**"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_decorator_with_whitespace_only_docstring():
|
|
81
|
+
"""Test that decorator handles whitespace-only docstring."""
|
|
82
|
+
@vibe_coded
|
|
83
|
+
def test_func():
|
|
84
|
+
""" """
|
|
85
|
+
return "test"
|
|
86
|
+
|
|
87
|
+
# Whitespace-only docstring is truthy, so it should prepend
|
|
88
|
+
assert test_func.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
89
|
+
assert " " in test_func.__doc__
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_decorator_on_class_method():
|
|
93
|
+
"""Test that decorator works on class methods."""
|
|
94
|
+
class TestClass:
|
|
95
|
+
@vibe_coded
|
|
96
|
+
def method(self):
|
|
97
|
+
"""A class method."""
|
|
98
|
+
return "method_result"
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
@vibe_coded
|
|
102
|
+
def class_method(cls):
|
|
103
|
+
"""A classmethod."""
|
|
104
|
+
return "class_method_result"
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
@vibe_coded
|
|
108
|
+
def static_method():
|
|
109
|
+
"""A static method."""
|
|
110
|
+
return "static_method_result"
|
|
111
|
+
|
|
112
|
+
instance = TestClass()
|
|
113
|
+
|
|
114
|
+
# Test instance method
|
|
115
|
+
assert instance.method.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
116
|
+
assert instance.method() == "method_result"
|
|
117
|
+
|
|
118
|
+
# Test classmethod (decorator order: @classmethod then @vibe_coded)
|
|
119
|
+
assert TestClass.class_method.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
120
|
+
assert TestClass.class_method() == "class_method_result"
|
|
121
|
+
|
|
122
|
+
# Test staticmethod (decorator order: @staticmethod then @vibe_coded)
|
|
123
|
+
assert TestClass.static_method.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
124
|
+
assert TestClass.static_method() == "static_method_result"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_decorator_on_async_function():
|
|
128
|
+
"""Test that decorator works on async functions."""
|
|
129
|
+
@vibe_coded
|
|
130
|
+
async def async_func():
|
|
131
|
+
"""An async function."""
|
|
132
|
+
return "async_result"
|
|
133
|
+
|
|
134
|
+
assert async_func.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
135
|
+
assert "An async function" in async_func.__doc__
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def test_decorator_preserves_function_signature():
|
|
139
|
+
"""Test that decorator preserves function signature for introspection."""
|
|
140
|
+
@vibe_coded
|
|
141
|
+
def test_func(a, b, c=10, *args, **kwargs):
|
|
142
|
+
"""Function with complex signature."""
|
|
143
|
+
return a + b + c
|
|
144
|
+
|
|
145
|
+
import inspect
|
|
146
|
+
sig = inspect.signature(test_func)
|
|
147
|
+
params = list(sig.parameters.keys())
|
|
148
|
+
|
|
149
|
+
assert params == ['a', 'b', 'c', 'args', 'kwargs']
|
|
150
|
+
assert test_func(1, 2) == 13
|
|
151
|
+
assert test_func(1, 2, 3) == 6
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def test_decorator_notice_format():
|
|
155
|
+
"""Test that the notice has the exact expected format."""
|
|
156
|
+
@vibe_coded
|
|
157
|
+
def test_func():
|
|
158
|
+
"""Test."""
|
|
159
|
+
pass
|
|
160
|
+
|
|
161
|
+
expected_notice = "**THIS FUNCTION HAS BEEN VIBE CODED**"
|
|
162
|
+
assert test_func.__doc__.startswith(expected_notice)
|
|
163
|
+
assert test_func.__doc__ == f"{expected_notice}\n\nTest."
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_multiple_decorators():
|
|
167
|
+
"""Test that decorator can be combined with other decorators."""
|
|
168
|
+
def other_decorator(func):
|
|
169
|
+
def wrapper(*args, **kwargs):
|
|
170
|
+
return func(*args, **kwargs) * 2
|
|
171
|
+
return wrapper
|
|
172
|
+
|
|
173
|
+
@vibe_coded
|
|
174
|
+
@other_decorator
|
|
175
|
+
def test_func():
|
|
176
|
+
"""Test function."""
|
|
177
|
+
return 5
|
|
178
|
+
|
|
179
|
+
assert test_func.__doc__.startswith("**THIS FUNCTION HAS BEEN VIBE CODED**")
|
|
180
|
+
assert test_func() == 10
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_decorator_on_lambda():
|
|
184
|
+
"""Test that decorator works on lambda functions (though unusual)."""
|
|
185
|
+
# Note: Lambdas typically don't have docstrings, but we can test the behavior
|
|
186
|
+
test_lambda = vibe_coded(lambda x: x * 2)
|
|
187
|
+
|
|
188
|
+
assert test_lambda.__doc__ == "**THIS FUNCTION HAS BEEN VIBE CODED**"
|
|
189
|
+
assert test_lambda(5) == 10
|
|
190
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""A decorator to mark functions as vibe-coded."""
|
|
2
|
+
|
|
3
|
+
from functools import wraps
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def vibe_coded(func):
|
|
7
|
+
"""
|
|
8
|
+
Decorator that adds a notice to the function's docstring indicating it was vibe-coded.
|
|
9
|
+
|
|
10
|
+
This decorator prepends "**THIS FUNCTION HAS BEEN VIBE CODED**" to the function's
|
|
11
|
+
docstring, which will appear in documentation tools like FastAPI's automatic docs.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
func: The function to be decorated.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
The decorated function with modified docstring.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
@vibe_coded
|
|
21
|
+
def my_function():
|
|
22
|
+
\"\"\"This is my function.\"\"\"
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
# The docstring will become:
|
|
26
|
+
# "**THIS FUNCTION HAS BEEN VIBE CODED**\n\nThis is my function."
|
|
27
|
+
"""
|
|
28
|
+
@wraps(func)
|
|
29
|
+
def wrapper(*args, **kwargs):
|
|
30
|
+
return func(*args, **kwargs)
|
|
31
|
+
|
|
32
|
+
# Modify the docstring
|
|
33
|
+
notice = "**THIS FUNCTION HAS BEEN VIBE CODED**"
|
|
34
|
+
|
|
35
|
+
if func.__doc__:
|
|
36
|
+
# If docstring exists, prepend the notice
|
|
37
|
+
wrapper.__doc__ = f"{notice}\n\n{func.__doc__}"
|
|
38
|
+
else:
|
|
39
|
+
# If no docstring exists, create one with just the notice
|
|
40
|
+
wrapper.__doc__ = notice
|
|
41
|
+
|
|
42
|
+
return wrapper
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
__all__ = ['vibe_coded']
|
|
46
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vibe-coded-decorator
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A decorator to mark functions as vibe-coded in their docstrings
|
|
5
|
+
Author-email: Sep Keucheni <septimber@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sepkeuchenius/vibe-coded-decorator
|
|
8
|
+
Project-URL: Repository, https://github.com/sepkeuchenius/vibe-coded-decorator
|
|
9
|
+
Keywords: decorator,docstring,vibe-coding,fastapi
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# vibe-coded-decorator
|
|
26
|
+
|
|
27
|
+
A Python decorator that marks functions as "vibe-coded" by adding a notice to their docstrings. This notice will appear in automatic documentation tools like FastAPI's interactive docs.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install vibe-coded-decorator
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install from source:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Simply add the `@vibe_coded` decorator to any function:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from vibe_coded_decorator import vibe_coded
|
|
47
|
+
|
|
48
|
+
@vibe_coded
|
|
49
|
+
def my_function():
|
|
50
|
+
"""This is my function."""
|
|
51
|
+
return "Hello, world!"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The decorator will modify the function's docstring to include a notice at the beginning:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
print(my_function.__doc__)
|
|
58
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
59
|
+
#
|
|
60
|
+
# This is my function.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### With FastAPI
|
|
64
|
+
|
|
65
|
+
The decorator works seamlessly with FastAPI, and the notice will appear in the automatic API documentation:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from fastapi import FastAPI
|
|
69
|
+
from vibe_coded_decorator import vibe_coded
|
|
70
|
+
|
|
71
|
+
app = FastAPI()
|
|
72
|
+
|
|
73
|
+
@app.get("/hello")
|
|
74
|
+
@vibe_coded
|
|
75
|
+
def hello_world():
|
|
76
|
+
"""Returns a greeting message."""
|
|
77
|
+
return {"message": "Hello, world!"}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
When you visit the FastAPI docs at `/docs`, you'll see "**THIS FUNCTION HAS BEEN VIBE CODED**" at the top of the function's description.
|
|
81
|
+
|
|
82
|
+
### Functions Without Docstrings
|
|
83
|
+
|
|
84
|
+
The decorator also works with functions that don't have docstrings:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
@vibe_coded
|
|
88
|
+
def no_docstring():
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
print(no_docstring.__doc__)
|
|
92
|
+
# Output: **THIS FUNCTION HAS BEEN VIBE CODED**
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
To install in development mode:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install -e .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
|
106
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
tests/test_vibe_coded.py
|
|
4
|
+
vibe_coded_decorator/__init__.py
|
|
5
|
+
vibe_coded_decorator.egg-info/PKG-INFO
|
|
6
|
+
vibe_coded_decorator.egg-info/SOURCES.txt
|
|
7
|
+
vibe_coded_decorator.egg-info/dependency_links.txt
|
|
8
|
+
vibe_coded_decorator.egg-info/requires.txt
|
|
9
|
+
vibe_coded_decorator.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vibe_coded_decorator
|