1
- ## 0.9.0
1
+ # Change Log
2
+
3
+ ## v0.9.1
4
+
5
+ - β¬οΈ Upgrade executing to 1.0
6
+
7
+ ## v0.9.0
2
8
3
9
- β¬οΈ Upgrade executing to 0.9
4
10
- ποΈ Remove deprecated ` argname2 `
5
11
- β¨ Support constants for ` argname ` even when ` vars_only=True `
6
12
- β¨ Support ` __getattr__/__setattr__ ` etc for ` argname `
7
13
8
14
Now you can do:
15
+
9
16
``` python
10
17
from varname import argname
11
18
@@ -50,9 +57,11 @@ This is more of a housekeeping release:
50
57
# # v0.8.2
51
58
52
59
# ## Fixes
60
+
53
61
- π©Ή Use sysconfig instead of distutils.sysconfig to avoid deprecatewarning for python 3.10 +
54
62
55
63
# ## Housekeeping
64
+
56
65
- π· Add python3.10 in CI
57
66
- π Add license back
58
67
@@ -63,13 +72,15 @@ This is more of a housekeeping release:
63
72
# # v0.8.0
64
73
65
74
Compared to `v0.7.3`
75
+
66
76
- Add `UsingExecWarning` when `exec ` is used to retrieve `func` for `argname()` .
67
77
- Remove `NonVariableArgumentError` . Use `ImproperUseError` instead.
68
78
- Add `VarnameError` and `VarnameWarning` as root for varname- related exceptions and warnings, respectively.
69
79
- Default `strict` to `True ` for `varname()` , `helpers.register()` and `helpers.Wrapper()`
70
80
- Limit number of context lines for showing where `ImproperUseError` happens
71
81
72
82
Compared to `v0.7.0`
83
+
73
84
- Add `UsingExecWarning` when `exec ` is used to retrieve `func` for `argname()` .
74
85
- Remove `NonVariableArgumentError` . Use `ImproperUseError` instead.
75
86
- Add `VarnameError` and `VarnameWarning` as root for varname- related exceptions and warnings, respectively.
@@ -81,38 +92,49 @@ Compared to `v0.7.0`
81
92
- Limit `VarnameRetrievingError` to the situations only when the AST node is not able to be retrieved.
82
93
83
94
# # v0.7.3
95
+
84
96
- Indicate where the `ImproperUseError` happens for `varname()` (Close # 60)
85
97
- Add `VarnameException` and `VarnameWarning` as root for all varname- defined exceptions and warnings.
86
98
87
99
# # v0.7.2
100
+
88
101
- Add `strict` mode to `varname()` (# 57)
89
102
- Support the walrus operator (`:= ` ) (# 58)
90
103
91
104
# # v0.7.1
105
+
92
106
- Add `ignore` argument to `argname2()`
93
107
- Fix Fix utils.get_argument_sources() when kwargs is given as `** kwargs` .
94
108
95
109
# # v0.7.0
110
+
96
111
- `ImproperUseError` is now independent of `VarnameRetrievingError`
97
112
- Deprecate `argname` , superseded by `argname2`
113
+
98
114
```python
99
115
>> > argname(a, b, ... ) # before
100
116
>> > argname2(' a' , ' b' , ... ) # after
101
117
```
118
+
102
119
- Add `dispatch` argument to `argname` / `argment2` to be used for single- dispatched functions.
103
120
104
121
# # v0.6.5
122
+
105
123
- Add `sep` argument to `helpers.debug()`
106
124
107
125
# # v0.6.4
126
+
108
127
- Add ImproperUseError to distinguish node retrieving error from improper varname use # 49
109
128
110
129
# # v0.6.3
130
+
111
131
- Fix standard library ignoring ignores 3rd - party libraries under site- packages/
112
132
- Allow pathlib.Path object to be used in ignore items
113
133
114
134
# # v0.6.2
135
+
115
136
- Remove argument `full` for `nameof` , use `vars_only` instead. When `vars_only=False ` , source of the argument returned.
137
+
116
138
```python
117
139
# before:
118
140
nameof(a.b, full = True ) # 'a.b'
@@ -121,12 +143,16 @@ Compared to `v0.7.0`
121
143
nameof(a.b, vars_only = False ) # 'a.b'
122
144
nameof(x[0 ], vars_only = False ) # 'x[0]'
123
145
```
146
+
124
147
- Add argument `frame` to `argname` , so that it can be wrapped.
148
+
125
149
```python
126
150
def argname2(arg, * more_args):
127
151
return argname(arg, * more_args, frame = 2 )
128
152
```
153
+
129
154
- Allow `argname` to fetch the source of variable keyword arguments (`** kwargs` ), which will be an empty dict (`{}` ) when no keyword arguments passed.
155
+
130
156
```python
131
157
def func(a, ** kwargs):
132
158
return argname(a, kwargs)
@@ -135,7 +161,9 @@ Compared to `v0.7.0`
135
161
# after:
136
162
func(x) # returns ('x', {})
137
163
```
164
+
138
165
- Add argument `pos_only` to `argname` to only match the positional arguments
166
+
139
167
```python
140
168
# before
141
169
def func(a, b = 1 ):
@@ -149,7 +177,9 @@ Compared to `v0.7.0`
149
177
func(x) # 'x'
150
178
func(x, b = 2 ) # 'x'
151
179
```
180
+
152
181
- Parse the arguments only if needed
182
+
153
183
```python
154
184
# before
155
185
def func(a, b):
@@ -159,7 +189,9 @@ Compared to `v0.7.0`
159
189
# after
160
190
func(x, 1 ) # 'x'
161
191
```
192
+
162
193
- Allow variable positional arguments for `argname` so that `argname(* args)` is allowed
194
+
163
195
```python
164
196
# before
165
197
def func(arg, * args):
@@ -173,90 +205,112 @@ Compared to `v0.7.0`
173
205
x = y = 1
174
206
func(x, y) # ('x', 'y')
175
207
```
208
+
176
209
- Add `vars_only` (defaults to `False ` ) argument to `helpers.debug` so source of expression becomes available
210
+
177
211
```python
178
212
a = 1
179
213
debug(a+ a) # DEBUG: a+a=2
180
214
```
181
215
182
216
# # v0.6.1
217
+
183
218
- Add `argname` to retrieve argument names/ sources passed to a function
184
219
185
220
# # v0.6.0
221
+
186
222
- Changed:
187
- - `Wrapper` , `register` and `debug` moved to `varname.helpers`
188
- - Argument `caller` changed to `frame` across all APIs
189
- - `ignore` accepting module, filename, function, (function, num_decorators), (module, qualname) and (filename, qualname)
223
+ - `Wrapper` , `register` and `debug` moved to `varname.helpers`
224
+ - Argument `caller` changed to `frame` across all APIs
225
+ - `ignore` accepting module, filename, function, (function, num_decorators), (module, qualname) and (filename, qualname)
190
226
- Removed:
191
- - `inject` (Use `helpers.regiester` instead)
192
- - `inject_varname` (Use `helpers.regiester` instead)
193
- - `namedtuple`
227
+ - `inject` (Use `helpers.regiester` instead)
228
+ - `inject_varname` (Use `helpers.regiester` instead)
229
+ - `namedtuple`
194
230
- Added:
195
- - Arguments `frame` and `ignore` to `Wrapper`
196
- - `helpers.register` as a decorator for functions
231
+ - Arguments `frame` and `ignore` to `Wrapper`
232
+ - `helpers.register` as a decorator for functions
197
233
198
234
# # v0.5.6
235
+
199
236
- Add `ignore` argument to `varname` to ignore frames that are not counted by caller
200
237
- Deprecate `inject_varname` , use `register` instead
201
238
202
239
# # v0.5.5
240
+
203
241
- Deprecate inject and use inject_varname decorator instead
204
242
205
243
# # v0.5.4
244
+
206
245
- Allow `varname.varname` to receive multiple variables on the left- hand side
207
246
208
247
# # v0.5.3
248
+
209
249
- Add `debug` function
210
250
- Deprecate `namedtuple` (will be removed in `0.6 .0` )
211
251
212
252
# # v0.5.2
253
+
213
254
- Move messaging of weird nameof calls from `_bytecode_nameof` to `nameof` .
214
255
- Disallow `full` to be used when `_bytecode_nameof` needs to be invoked.
215
256
216
257
# # v0.5.1
258
+
217
259
- Add better messaging for weird nameof calls
218
260
219
261
# # v0.5.0
262
+
220
263
- Allow `nameof` to retrieve full name of chained attribute calls
221
264
- Add `__all__ ` to the module so that only desired APIs are exposed when `from varname import * `
222
265
- Give more hints on `nameof` being called in a weird way when no soucecode available.
223
266
224
267
# # v0.4.0
268
+
225
269
- Change default of `raise_exc` to `True ` for all related APIs
226
270
- Deprecate `var_0`
227
271
- Get rid of `VarnameRetrievingWarning` .
228
272
229
273
# # v0.3.0
274
+
230
275
- Use sys._getframe instead of inspect.stack for efficiency (# 9)
231
276
- Add alternative way of testing bytecode nameof (# 10)
232
277
- Drop support for pytest, don' t try to find node when executing fails
233
278
- Remodel `will` for better logic
234
279
- Support attributes in varname and nameof (# 14)
235
280
236
281
# # v0.2.0
282
+
237
283
- Fix # 5 and fit nameof in more cases
238
284
239
285
# # v0.1.7
286
+
240
287
- Add `inject` function
241
288
242
289
# # v0.1.6
290
+
243
291
- Fit situations when frames cannot be fetched
244
292
- Add shortcut for `namedtuple`
245
293
246
294
# # v0.1.5
295
+
247
296
- Fix `will` from a property call
248
297
249
298
# # v0.1.4
299
+
250
300
- Add `will` to detect next immediate attribute name
251
301
252
302
# # v0.1.3
303
+
253
304
- Add arugment `raise_exc` for `varname` to raise an exception instead of returning `var_< index> `
254
305
255
306
# # v0.1.2
307
+
256
308
- Add function `nameof`
257
309
258
310
# # v0.1.1
311
+
259
312
- Add a value wrapper `Wrapper` class
260
313
261
314
# # v0.1.0
315
+
262
316
- Implement `varname` function
0 commit comments