You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`Twyn` also supports being used as 3rd party library for you project. To install it, run:
95
+
96
+
97
+
```sh
98
+
pip install twyn
99
+
```
100
+
101
+
Example usage in your code:
102
+
103
+
```python
104
+
from twyn import check_dependencies
105
+
106
+
typos = check_dependencies()
107
+
108
+
for typo in typos.errors:
109
+
print(f"Dependency:{typo.dependency}")
110
+
print(f"Did you mean any of [{','.join(typo.similars)}]")
111
+
112
+
```
113
+
114
+
#### Logging level
115
+
By default, logging is disabled when running as a 3rd party library. To override this behaviour, you can:
116
+
117
+
```python
118
+
logging.basicConfig(level=logging.INFO)
119
+
logging.getLogger("twyn").setLevel(logging.INFO)
120
+
```
121
+
87
122
## Configuration
88
123
89
124
### Allowlist
90
125
91
-
It can happen that a legitimate package known by the user raises an error because is too similar to one of the most trusted ones.
92
-
You can then add this packages to the `allowlist`, so it will be skipped:
126
+
It can happen that a legitimate package known by the user raises an error because it is too similar to one of the most trusted ones. Imagine that you are using internally a package that you developed called `reqests`. You can then add this packages to the `allowlist`, so it will not be reported as a typo:
93
127
94
128
```sh
95
129
twyn allowlist add <package>
@@ -201,24 +235,3 @@ To clear the cache, run:
201
235
```
202
236
203
237
204
-
### Using Twyn as a library
205
-
206
-
`Twyn` also supports being used as 3rd party library for you project.
207
-
208
-
```python
209
-
from twyn import check_dependencies
210
-
211
-
typos = check_dependencies()
212
-
213
-
for typo in typos.errors:
214
-
print(f"Dependency:{typo.dependency}")
215
-
print(f"Did you mean any of [{','.join(typo.similars)}]")
216
-
217
-
```
218
-
### Logging level
219
-
To override the logging level when using `Twyn` as a 3rd party library, simply override it like:
0 commit comments