sopel-wolfram 0.6.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.
- sopel_wolfram-0.6.0/COPYING +23 -0
- sopel_wolfram-0.6.0/MANIFEST.in +6 -0
- sopel_wolfram-0.6.0/NEWS +135 -0
- sopel_wolfram-0.6.0/PKG-INFO +225 -0
- sopel_wolfram-0.6.0/README.md +60 -0
- sopel_wolfram-0.6.0/pyproject.toml +62 -0
- sopel_wolfram-0.6.0/setup.cfg +4 -0
- sopel_wolfram-0.6.0/sopel_wolfram/__init__.py +0 -0
- sopel_wolfram-0.6.0/sopel_wolfram/plugin.py +108 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/PKG-INFO +225 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/SOURCES.txt +13 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/dependency_links.txt +1 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/entry_points.txt +2 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/requires.txt +2 -0
- sopel_wolfram-0.6.0/sopel_wolfram.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
Eiffel Forum License, version 2
|
|
3
|
+
|
|
4
|
+
1. Permission is hereby granted to use, copy, modify and/or
|
|
5
|
+
distribute this package, provided that:
|
|
6
|
+
* copyright notices are retained unchanged,
|
|
7
|
+
* any distribution of this package, whether modified or not,
|
|
8
|
+
includes this license text.
|
|
9
|
+
2. Permission is hereby also granted to distribute binary programs
|
|
10
|
+
which depend on this package. If the binary program depends on a
|
|
11
|
+
modified version of this package, you are encouraged to publicly
|
|
12
|
+
release the modified version of this package.
|
|
13
|
+
|
|
14
|
+
***********************
|
|
15
|
+
|
|
16
|
+
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ANY EXPRESS OR
|
|
17
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR ANY
|
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE.
|
|
22
|
+
|
|
23
|
+
***********************
|
sopel_wolfram-0.6.0/NEWS
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
## Changelog
|
|
2
|
+
|
|
3
|
+
Ticket numbers in changelog entries can be looked up by visiting
|
|
4
|
+
`https://github.com/dgw/sopel-wolfram/issue/<number>`
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### 0.6.0 "Bocchi de Skip"
|
|
8
|
+
|
|
9
|
+
First release as `sopel-wolfram`, replacing the old `sopel_modules.wolfram`
|
|
10
|
+
package for Sopel 7 and older.
|
|
11
|
+
|
|
12
|
+
Updated:
|
|
13
|
+
|
|
14
|
+
* Sopel 8.x and Python 3.8+ now required (#25)
|
|
15
|
+
* Upgraded to `wolframalpha` 5.x (#25)
|
|
16
|
+
* Modernized packaging & package metadata (#25)
|
|
17
|
+
* Streamlined documentation (#25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 0.5.0 "ALIVE"
|
|
21
|
+
|
|
22
|
+
That's "ALIVE" as in "This project isn't DEAD" (despite the last release being
|
|
23
|
+
over two years old).
|
|
24
|
+
|
|
25
|
+
Updated:
|
|
26
|
+
|
|
27
|
+
* Sopel 7.x now supported & required (#23)
|
|
28
|
+
* Dropped support for Sopel 6.x (#23)
|
|
29
|
+
* Dropped support for wolframalpha 2.x (#23)
|
|
30
|
+
* Internal refactoring to take advantage of new Sopel features (#23)
|
|
31
|
+
|
|
32
|
+
Meta:
|
|
33
|
+
|
|
34
|
+
* No more ZIP releases; PyPI only allows one file type now (#22)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### 0.4.1 "Kibou ni tsuite"
|
|
38
|
+
|
|
39
|
+
This release named in memory of LuckyNumber78, who changed lives every day simply
|
|
40
|
+
by being her excitable, fun-loving self. She is missed by many.
|
|
41
|
+
|
|
42
|
+
Fixed:
|
|
43
|
+
|
|
44
|
+
* `max_public` setting could cause errors because it was treated as a string (#21)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### 0.4.0 "Mirai no kajitsu"
|
|
48
|
+
|
|
49
|
+
Added:
|
|
50
|
+
|
|
51
|
+
* Support for wolframalpha 3.0 with transitional fallback to 2.4 (#11, #19; see
|
|
52
|
+
README notes)
|
|
53
|
+
* New configuration option `max_public`, a number defining the maximum number of
|
|
54
|
+
lines that can be sent without using NOTICEs. Default: 5 (#13)
|
|
55
|
+
* New configuration option `units`, to specify whether the API should return
|
|
56
|
+
`metric` (default) or `nonmetric` measurements (#18; see #16)
|
|
57
|
+
|
|
58
|
+
Updated:
|
|
59
|
+
|
|
60
|
+
* Threshold for using NOTICEs is now 5 lines, up from the previous default of 3
|
|
61
|
+
|
|
62
|
+
Fixed:
|
|
63
|
+
|
|
64
|
+
* Non-ASCII text in output is no longer `\:encoded` (#15)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### 0.3.1 "Nusumareta kuchibiru"
|
|
68
|
+
|
|
69
|
+
Updates:
|
|
70
|
+
|
|
71
|
+
* Unicode-encode query to avoid UnicodeEncodeError on non-ASCII characters (#10)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### 0.3.0 "So long!"
|
|
75
|
+
|
|
76
|
+
Updates:
|
|
77
|
+
|
|
78
|
+
* Results longer than 3 lines will be sent via NOTICE instead of flooding
|
|
79
|
+
channels (#8)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### 0.2.1 "Mae shika mukanee"
|
|
83
|
+
|
|
84
|
+
Updates:
|
|
85
|
+
|
|
86
|
+
* Output now split into multiple messages when line breaks are present (#4)
|
|
87
|
+
* Tell pip we do not want wolframalpha 3.0 yet (#6)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### 0.2.0 "Miraibashi"
|
|
91
|
+
|
|
92
|
+
Updates:
|
|
93
|
+
|
|
94
|
+
* Try a lot harder to give useful output (#3)
|
|
95
|
+
* Tell user to try again if an unspecified error occurs (empty error message)
|
|
96
|
+
|
|
97
|
+
Meta:
|
|
98
|
+
|
|
99
|
+
* Cleanup: PEP8 & unused imports
|
|
100
|
+
* Refactor to make future addition of integration tests easier
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### 0.1.2 "Switch"
|
|
104
|
+
|
|
105
|
+
Updates:
|
|
106
|
+
|
|
107
|
+
* Shorten some error messages
|
|
108
|
+
* Identify as "[W|A]" instead of "[Wolfram]" in output for brevity
|
|
109
|
+
* Ensure all module output is prefixed
|
|
110
|
+
* Add more examples to help output and README
|
|
111
|
+
|
|
112
|
+
Meta:
|
|
113
|
+
|
|
114
|
+
* README now includes installation instructions and where to get help/report
|
|
115
|
+
bugs
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### 0.1.1 "Already"
|
|
119
|
+
|
|
120
|
+
Updates:
|
|
121
|
+
|
|
122
|
+
* Now outputs error if `app_id` is missing (#1)
|
|
123
|
+
|
|
124
|
+
Meta:
|
|
125
|
+
|
|
126
|
+
* README reformatted (thanks @[maxpowa](https://github.com/maxpowa))
|
|
127
|
+
* Begin maintaining version history in NEWS file
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### 0.1.0 "Beginner"
|
|
131
|
+
-------------------------------
|
|
132
|
+
|
|
133
|
+
* Initial release
|
|
134
|
+
* Adopted with permission from
|
|
135
|
+
https://github.com/maxpowa/inumuta-modules/blob/e0b195c/wolfram.py
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sopel-wolfram
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Wolfram|Alpha plugin for the Sopel IRC bot framework
|
|
5
|
+
Author-email: Max Gurela <maxpowa1@gmail.com>
|
|
6
|
+
Maintainer-email: dgw <dgw@technobabbl.es>
|
|
7
|
+
License: EFL-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/dgw/sopel-wolfram
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/dgw/sopel-wolfram/issues
|
|
10
|
+
Keywords: sopel,plugin,bot,irc
|
|
11
|
+
Platform: Linux x86, x86-64
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: Eiffel Forum License (EFL)
|
|
16
|
+
Classifier: License :: OSI Approved :: Eiffel Forum License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Communications :: Chat :: Internet Relay Chat
|
|
24
|
+
Requires-Python: <4,>=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: COPYING
|
|
27
|
+
Requires-Dist: sopel~=8.0
|
|
28
|
+
Requires-Dist: wolframalpha~=5.0
|
|
29
|
+
|
|
30
|
+
# sopel-wolfram
|
|
31
|
+
|
|
32
|
+
Wolfram|Alpha plugin for the Sopel IRC bot framework
|
|
33
|
+
|
|
34
|
+
## Installing
|
|
35
|
+
|
|
36
|
+
Releases are hosted on PyPI, so after installing Sopel, all you need is `pip`:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
$ pip install sopel-wolfram
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Requirements
|
|
43
|
+
|
|
44
|
+
* Sopel 8.x
|
|
45
|
+
* wolframalpha 5.x
|
|
46
|
+
|
|
47
|
+
You will also need a Wolfram|Alpha App ID; see details below in the
|
|
48
|
+
"Configuring" section.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Configuring
|
|
52
|
+
|
|
53
|
+
The easiest way to configure `sopel-wolfram` is via Sopel's
|
|
54
|
+
configuration wizard—simply run `sopel-plugins configure wolfram`
|
|
55
|
+
and enter the values for which it prompts you.
|
|
56
|
+
|
|
57
|
+
However, you can manually add the following section to your Sopel bot's
|
|
58
|
+
configuration file if desired:
|
|
59
|
+
|
|
60
|
+
```ini
|
|
61
|
+
[wolfram]
|
|
62
|
+
app_id = yourappidgoeshere
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The `app_id` setting is required, and you will need to get your own App ID from
|
|
66
|
+
Wolfram|Alpha at https://developer.wolframalpha.com/
|
|
67
|
+
|
|
68
|
+
Optional settings:
|
|
69
|
+
|
|
70
|
+
* `max_public`: the number of lines over which results will be sent in NOTICE
|
|
71
|
+
instead of to the channel (default: 5)
|
|
72
|
+
* `units`: measurement system displayed in results, either `metric` (the
|
|
73
|
+
default) or `nonmetric`
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Example usage
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
<User> .wa 2+2
|
|
80
|
+
<Sopel> [W|A] 2+2 = 4
|
|
81
|
+
|
|
82
|
+
<User> .wa python language release date
|
|
83
|
+
<Sopel> [W|A] Python | date introduced = 1991
|
|
84
|
+
|
|
85
|
+
<User> .wa airspeed velocity of an unladen swallow
|
|
86
|
+
<Sopel> [W|A] estimated average cruising airspeed of an unladen European
|
|
87
|
+
swallow = 25 mph (miles per hour)(asked, but not answered, about a
|
|
88
|
+
general swallow in the 1975 film Monty Python and the Holy Grail)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Changelog
|
|
92
|
+
|
|
93
|
+
Ticket numbers in changelog entries can be looked up by visiting
|
|
94
|
+
`https://github.com/dgw/sopel-wolfram/issue/<number>`
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### 0.6.0 "Bocchi de Skip"
|
|
98
|
+
|
|
99
|
+
First release as `sopel-wolfram`, replacing the old `sopel_modules.wolfram`
|
|
100
|
+
package for Sopel 7 and older.
|
|
101
|
+
|
|
102
|
+
Updated:
|
|
103
|
+
|
|
104
|
+
* Sopel 8.x and Python 3.8+ now required (#25)
|
|
105
|
+
* Upgraded to `wolframalpha` 5.x (#25)
|
|
106
|
+
* Modernized packaging & package metadata (#25)
|
|
107
|
+
* Streamlined documentation (#25)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### 0.5.0 "ALIVE"
|
|
111
|
+
|
|
112
|
+
That's "ALIVE" as in "This project isn't DEAD" (despite the last release being
|
|
113
|
+
over two years old).
|
|
114
|
+
|
|
115
|
+
Updated:
|
|
116
|
+
|
|
117
|
+
* Sopel 7.x now supported & required (#23)
|
|
118
|
+
* Dropped support for Sopel 6.x (#23)
|
|
119
|
+
* Dropped support for wolframalpha 2.x (#23)
|
|
120
|
+
* Internal refactoring to take advantage of new Sopel features (#23)
|
|
121
|
+
|
|
122
|
+
Meta:
|
|
123
|
+
|
|
124
|
+
* No more ZIP releases; PyPI only allows one file type now (#22)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### 0.4.1 "Kibou ni tsuite"
|
|
128
|
+
|
|
129
|
+
This release named in memory of LuckyNumber78, who changed lives every day simply
|
|
130
|
+
by being her excitable, fun-loving self. She is missed by many.
|
|
131
|
+
|
|
132
|
+
Fixed:
|
|
133
|
+
|
|
134
|
+
* `max_public` setting could cause errors because it was treated as a string (#21)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### 0.4.0 "Mirai no kajitsu"
|
|
138
|
+
|
|
139
|
+
Added:
|
|
140
|
+
|
|
141
|
+
* Support for wolframalpha 3.0 with transitional fallback to 2.4 (#11, #19; see
|
|
142
|
+
README notes)
|
|
143
|
+
* New configuration option `max_public`, a number defining the maximum number of
|
|
144
|
+
lines that can be sent without using NOTICEs. Default: 5 (#13)
|
|
145
|
+
* New configuration option `units`, to specify whether the API should return
|
|
146
|
+
`metric` (default) or `nonmetric` measurements (#18; see #16)
|
|
147
|
+
|
|
148
|
+
Updated:
|
|
149
|
+
|
|
150
|
+
* Threshold for using NOTICEs is now 5 lines, up from the previous default of 3
|
|
151
|
+
|
|
152
|
+
Fixed:
|
|
153
|
+
|
|
154
|
+
* Non-ASCII text in output is no longer `\:encoded` (#15)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### 0.3.1 "Nusumareta kuchibiru"
|
|
158
|
+
|
|
159
|
+
Updates:
|
|
160
|
+
|
|
161
|
+
* Unicode-encode query to avoid UnicodeEncodeError on non-ASCII characters (#10)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### 0.3.0 "So long!"
|
|
165
|
+
|
|
166
|
+
Updates:
|
|
167
|
+
|
|
168
|
+
* Results longer than 3 lines will be sent via NOTICE instead of flooding
|
|
169
|
+
channels (#8)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### 0.2.1 "Mae shika mukanee"
|
|
173
|
+
|
|
174
|
+
Updates:
|
|
175
|
+
|
|
176
|
+
* Output now split into multiple messages when line breaks are present (#4)
|
|
177
|
+
* Tell pip we do not want wolframalpha 3.0 yet (#6)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### 0.2.0 "Miraibashi"
|
|
181
|
+
|
|
182
|
+
Updates:
|
|
183
|
+
|
|
184
|
+
* Try a lot harder to give useful output (#3)
|
|
185
|
+
* Tell user to try again if an unspecified error occurs (empty error message)
|
|
186
|
+
|
|
187
|
+
Meta:
|
|
188
|
+
|
|
189
|
+
* Cleanup: PEP8 & unused imports
|
|
190
|
+
* Refactor to make future addition of integration tests easier
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### 0.1.2 "Switch"
|
|
194
|
+
|
|
195
|
+
Updates:
|
|
196
|
+
|
|
197
|
+
* Shorten some error messages
|
|
198
|
+
* Identify as "[W|A]" instead of "[Wolfram]" in output for brevity
|
|
199
|
+
* Ensure all module output is prefixed
|
|
200
|
+
* Add more examples to help output and README
|
|
201
|
+
|
|
202
|
+
Meta:
|
|
203
|
+
|
|
204
|
+
* README now includes installation instructions and where to get help/report
|
|
205
|
+
bugs
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
### 0.1.1 "Already"
|
|
209
|
+
|
|
210
|
+
Updates:
|
|
211
|
+
|
|
212
|
+
* Now outputs error if `app_id` is missing (#1)
|
|
213
|
+
|
|
214
|
+
Meta:
|
|
215
|
+
|
|
216
|
+
* README reformatted (thanks @[maxpowa](https://github.com/maxpowa))
|
|
217
|
+
* Begin maintaining version history in NEWS file
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### 0.1.0 "Beginner"
|
|
221
|
+
-------------------------------
|
|
222
|
+
|
|
223
|
+
* Initial release
|
|
224
|
+
* Adopted with permission from
|
|
225
|
+
https://github.com/maxpowa/inumuta-modules/blob/e0b195c/wolfram.py
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# sopel-wolfram
|
|
2
|
+
|
|
3
|
+
Wolfram|Alpha plugin for the Sopel IRC bot framework
|
|
4
|
+
|
|
5
|
+
## Installing
|
|
6
|
+
|
|
7
|
+
Releases are hosted on PyPI, so after installing Sopel, all you need is `pip`:
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
$ pip install sopel-wolfram
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Requirements
|
|
14
|
+
|
|
15
|
+
* Sopel 8.x
|
|
16
|
+
* wolframalpha 5.x
|
|
17
|
+
|
|
18
|
+
You will also need a Wolfram|Alpha App ID; see details below in the
|
|
19
|
+
"Configuring" section.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Configuring
|
|
23
|
+
|
|
24
|
+
The easiest way to configure `sopel-wolfram` is via Sopel's
|
|
25
|
+
configuration wizard—simply run `sopel-plugins configure wolfram`
|
|
26
|
+
and enter the values for which it prompts you.
|
|
27
|
+
|
|
28
|
+
However, you can manually add the following section to your Sopel bot's
|
|
29
|
+
configuration file if desired:
|
|
30
|
+
|
|
31
|
+
```ini
|
|
32
|
+
[wolfram]
|
|
33
|
+
app_id = yourappidgoeshere
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The `app_id` setting is required, and you will need to get your own App ID from
|
|
37
|
+
Wolfram|Alpha at https://developer.wolframalpha.com/
|
|
38
|
+
|
|
39
|
+
Optional settings:
|
|
40
|
+
|
|
41
|
+
* `max_public`: the number of lines over which results will be sent in NOTICE
|
|
42
|
+
instead of to the channel (default: 5)
|
|
43
|
+
* `units`: measurement system displayed in results, either `metric` (the
|
|
44
|
+
default) or `nonmetric`
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Example usage
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
<User> .wa 2+2
|
|
51
|
+
<Sopel> [W|A] 2+2 = 4
|
|
52
|
+
|
|
53
|
+
<User> .wa python language release date
|
|
54
|
+
<Sopel> [W|A] Python | date introduced = 1991
|
|
55
|
+
|
|
56
|
+
<User> .wa airspeed velocity of an unladen swallow
|
|
57
|
+
<Sopel> [W|A] estimated average cruising airspeed of an unladen European
|
|
58
|
+
swallow = 25 mph (miles per hour)(asked, but not answered, about a
|
|
59
|
+
general swallow in the 1975 film Monty Python and the Holy Grail)
|
|
60
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=63.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[tool.setuptools]
|
|
6
|
+
platforms = ["Linux x86, x86-64"]
|
|
7
|
+
|
|
8
|
+
[tool.setuptools.packages.find]
|
|
9
|
+
include = ["sopel_wolfram", "sopel_wolfram.*"]
|
|
10
|
+
namespaces = false
|
|
11
|
+
|
|
12
|
+
[tool.setuptools.dynamic]
|
|
13
|
+
readme = { file=["README.md", "NEWS"], content-type="text/markdown" }
|
|
14
|
+
|
|
15
|
+
[project]
|
|
16
|
+
name = "sopel-wolfram"
|
|
17
|
+
version = "0.6.0"
|
|
18
|
+
description = "Wolfram|Alpha plugin for the Sopel IRC bot framework"
|
|
19
|
+
|
|
20
|
+
authors = [
|
|
21
|
+
{ name="Max Gurela", email="maxpowa1@gmail.com" },
|
|
22
|
+
]
|
|
23
|
+
maintainers = [
|
|
24
|
+
{ name="dgw", email="dgw@technobabbl.es" },
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
license = { text="EFL-2.0" }
|
|
28
|
+
dynamic = ["readme"]
|
|
29
|
+
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 5 - Production/Stable",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Intended Audience :: System Administrators",
|
|
34
|
+
"License :: Eiffel Forum License (EFL)",
|
|
35
|
+
"License :: OSI Approved :: Eiffel Forum License",
|
|
36
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
37
|
+
"Programming Language :: Python :: 3.8",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Topic :: Communications :: Chat :: Internet Relay Chat",
|
|
43
|
+
]
|
|
44
|
+
keywords = [
|
|
45
|
+
"sopel",
|
|
46
|
+
"plugin",
|
|
47
|
+
"bot",
|
|
48
|
+
"irc",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
requires-python = ">=3.8, <4"
|
|
52
|
+
dependencies = [
|
|
53
|
+
"sopel~=8.0",
|
|
54
|
+
"wolframalpha~=5.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
"Homepage" = "https://github.com/dgw/sopel-wolfram"
|
|
59
|
+
"Bug Tracker" = "https://github.com/dgw/sopel-wolfram/issues"
|
|
60
|
+
|
|
61
|
+
[project.entry-points."sopel.plugins"]
|
|
62
|
+
"wolfram" = "sopel_wolfram.plugin"
|
|
File without changes
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Wolfram|Alpha plugin for Sopel IRC bot framework
|
|
3
|
+
|
|
4
|
+
Forked from code by Max Gurela (@maxpowa):
|
|
5
|
+
https://github.com/maxpowa/inumuta-modules/blob/e0b195c4f1e1b788fa77ec2144d39c4748886a6a/wolfram.py
|
|
6
|
+
Updated and packaged for PyPI by dgw (@dgw)
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import wolframalpha
|
|
11
|
+
|
|
12
|
+
from sopel.config.types import (
|
|
13
|
+
ChoiceAttribute,
|
|
14
|
+
SecretAttribute,
|
|
15
|
+
StaticSection,
|
|
16
|
+
ValidatedAttribute,
|
|
17
|
+
)
|
|
18
|
+
from sopel.plugin import commands, example, output_prefix
|
|
19
|
+
from sopel.tools import web
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
UNITS = ('metric', 'nonmetric')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class WolframSection(StaticSection):
|
|
26
|
+
app_id = SecretAttribute('app_id', default=None)
|
|
27
|
+
max_public = ValidatedAttribute('max_public', parse=int, default=5)
|
|
28
|
+
units = ChoiceAttribute('units', choices=UNITS, default=UNITS[0])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def configure(config):
|
|
32
|
+
config.define_section('wolfram', WolframSection, validate=False)
|
|
33
|
+
config.wolfram.configure_setting('app_id', 'Wolfram|Alpha App ID:')
|
|
34
|
+
config.wolfram.configure_setting('max_public', 'Maximum lines before sending answer in NOTICE:')
|
|
35
|
+
config.wolfram.configure_setting(
|
|
36
|
+
'units',
|
|
37
|
+
'Unit system to use in output ({}):'.format(', '.join(UNITS)),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def setup(bot):
|
|
42
|
+
bot.config.define_section('wolfram', WolframSection)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@commands('wa', 'wolfram')
|
|
46
|
+
@example('.wa 2+2', '2 + 2 = 4')
|
|
47
|
+
@example('.wa python language release date', 'Python | date introduced = 1991')
|
|
48
|
+
@output_prefix('[W|A] ')
|
|
49
|
+
def wa_command(bot, trigger):
|
|
50
|
+
msg = None
|
|
51
|
+
if not trigger.group(2):
|
|
52
|
+
msg = 'You must provide a query.'
|
|
53
|
+
if not bot.config.wolfram.app_id:
|
|
54
|
+
msg = 'Wolfram|Alpha API app ID not configured.'
|
|
55
|
+
|
|
56
|
+
lines = (msg or wa_query(bot.config.wolfram.app_id, trigger.group(2), bot.config.wolfram.units)).splitlines()
|
|
57
|
+
|
|
58
|
+
if len(lines) <= bot.config.wolfram.max_public:
|
|
59
|
+
for line in lines:
|
|
60
|
+
bot.say(line)
|
|
61
|
+
else:
|
|
62
|
+
for line in lines:
|
|
63
|
+
bot.notice(line, trigger.nick)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def wa_query(app_id, query, units='metric'):
|
|
67
|
+
if not app_id:
|
|
68
|
+
return 'Wolfram|Alpha API app ID not provided.'
|
|
69
|
+
|
|
70
|
+
client = wolframalpha.Client(app_id)
|
|
71
|
+
query = query.strip()
|
|
72
|
+
params = (
|
|
73
|
+
('format', 'plaintext'),
|
|
74
|
+
('units', units),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
result = client.query(input=query, params=params)
|
|
79
|
+
except AssertionError:
|
|
80
|
+
return 'Temporary API issue. Try again in a moment.'
|
|
81
|
+
except Exception as e:
|
|
82
|
+
return 'Query failed: {} ({})'.format(type(e).__name__, str(e) or 'Unknown error, try again!')
|
|
83
|
+
|
|
84
|
+
if int(result['@numpods']) == 0:
|
|
85
|
+
return 'No results found.'
|
|
86
|
+
|
|
87
|
+
texts = []
|
|
88
|
+
try:
|
|
89
|
+
for pod in result.pods:
|
|
90
|
+
try:
|
|
91
|
+
texts.append(pod.text)
|
|
92
|
+
except AttributeError:
|
|
93
|
+
pass # pod with no text; skip it
|
|
94
|
+
except Exception:
|
|
95
|
+
raise # raise unexpected exceptions to outer try for bug reports
|
|
96
|
+
if len(texts) >= 2:
|
|
97
|
+
break # len() is O(1); this cheaply avoids copying more strings than needed
|
|
98
|
+
except Exception as e:
|
|
99
|
+
return 'Unhandled {}; please report this query ("{}") at https://git.io/wabug'.format(type(e).__name__, query)
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
input, output = texts[0], texts[1]
|
|
103
|
+
except IndexError:
|
|
104
|
+
return 'No text-representable result found; see https://wolframalpha.com/input/?i={}'.format(web.quote(query))
|
|
105
|
+
|
|
106
|
+
if not output:
|
|
107
|
+
return input
|
|
108
|
+
return '{} = {}'.format(input, output)
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sopel-wolfram
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Wolfram|Alpha plugin for the Sopel IRC bot framework
|
|
5
|
+
Author-email: Max Gurela <maxpowa1@gmail.com>
|
|
6
|
+
Maintainer-email: dgw <dgw@technobabbl.es>
|
|
7
|
+
License: EFL-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/dgw/sopel-wolfram
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/dgw/sopel-wolfram/issues
|
|
10
|
+
Keywords: sopel,plugin,bot,irc
|
|
11
|
+
Platform: Linux x86, x86-64
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: Eiffel Forum License (EFL)
|
|
16
|
+
Classifier: License :: OSI Approved :: Eiffel Forum License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Communications :: Chat :: Internet Relay Chat
|
|
24
|
+
Requires-Python: <4,>=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: COPYING
|
|
27
|
+
Requires-Dist: sopel~=8.0
|
|
28
|
+
Requires-Dist: wolframalpha~=5.0
|
|
29
|
+
|
|
30
|
+
# sopel-wolfram
|
|
31
|
+
|
|
32
|
+
Wolfram|Alpha plugin for the Sopel IRC bot framework
|
|
33
|
+
|
|
34
|
+
## Installing
|
|
35
|
+
|
|
36
|
+
Releases are hosted on PyPI, so after installing Sopel, all you need is `pip`:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
$ pip install sopel-wolfram
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Requirements
|
|
43
|
+
|
|
44
|
+
* Sopel 8.x
|
|
45
|
+
* wolframalpha 5.x
|
|
46
|
+
|
|
47
|
+
You will also need a Wolfram|Alpha App ID; see details below in the
|
|
48
|
+
"Configuring" section.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Configuring
|
|
52
|
+
|
|
53
|
+
The easiest way to configure `sopel-wolfram` is via Sopel's
|
|
54
|
+
configuration wizard—simply run `sopel-plugins configure wolfram`
|
|
55
|
+
and enter the values for which it prompts you.
|
|
56
|
+
|
|
57
|
+
However, you can manually add the following section to your Sopel bot's
|
|
58
|
+
configuration file if desired:
|
|
59
|
+
|
|
60
|
+
```ini
|
|
61
|
+
[wolfram]
|
|
62
|
+
app_id = yourappidgoeshere
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The `app_id` setting is required, and you will need to get your own App ID from
|
|
66
|
+
Wolfram|Alpha at https://developer.wolframalpha.com/
|
|
67
|
+
|
|
68
|
+
Optional settings:
|
|
69
|
+
|
|
70
|
+
* `max_public`: the number of lines over which results will be sent in NOTICE
|
|
71
|
+
instead of to the channel (default: 5)
|
|
72
|
+
* `units`: measurement system displayed in results, either `metric` (the
|
|
73
|
+
default) or `nonmetric`
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Example usage
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
<User> .wa 2+2
|
|
80
|
+
<Sopel> [W|A] 2+2 = 4
|
|
81
|
+
|
|
82
|
+
<User> .wa python language release date
|
|
83
|
+
<Sopel> [W|A] Python | date introduced = 1991
|
|
84
|
+
|
|
85
|
+
<User> .wa airspeed velocity of an unladen swallow
|
|
86
|
+
<Sopel> [W|A] estimated average cruising airspeed of an unladen European
|
|
87
|
+
swallow = 25 mph (miles per hour)(asked, but not answered, about a
|
|
88
|
+
general swallow in the 1975 film Monty Python and the Holy Grail)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Changelog
|
|
92
|
+
|
|
93
|
+
Ticket numbers in changelog entries can be looked up by visiting
|
|
94
|
+
`https://github.com/dgw/sopel-wolfram/issue/<number>`
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### 0.6.0 "Bocchi de Skip"
|
|
98
|
+
|
|
99
|
+
First release as `sopel-wolfram`, replacing the old `sopel_modules.wolfram`
|
|
100
|
+
package for Sopel 7 and older.
|
|
101
|
+
|
|
102
|
+
Updated:
|
|
103
|
+
|
|
104
|
+
* Sopel 8.x and Python 3.8+ now required (#25)
|
|
105
|
+
* Upgraded to `wolframalpha` 5.x (#25)
|
|
106
|
+
* Modernized packaging & package metadata (#25)
|
|
107
|
+
* Streamlined documentation (#25)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### 0.5.0 "ALIVE"
|
|
111
|
+
|
|
112
|
+
That's "ALIVE" as in "This project isn't DEAD" (despite the last release being
|
|
113
|
+
over two years old).
|
|
114
|
+
|
|
115
|
+
Updated:
|
|
116
|
+
|
|
117
|
+
* Sopel 7.x now supported & required (#23)
|
|
118
|
+
* Dropped support for Sopel 6.x (#23)
|
|
119
|
+
* Dropped support for wolframalpha 2.x (#23)
|
|
120
|
+
* Internal refactoring to take advantage of new Sopel features (#23)
|
|
121
|
+
|
|
122
|
+
Meta:
|
|
123
|
+
|
|
124
|
+
* No more ZIP releases; PyPI only allows one file type now (#22)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### 0.4.1 "Kibou ni tsuite"
|
|
128
|
+
|
|
129
|
+
This release named in memory of LuckyNumber78, who changed lives every day simply
|
|
130
|
+
by being her excitable, fun-loving self. She is missed by many.
|
|
131
|
+
|
|
132
|
+
Fixed:
|
|
133
|
+
|
|
134
|
+
* `max_public` setting could cause errors because it was treated as a string (#21)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### 0.4.0 "Mirai no kajitsu"
|
|
138
|
+
|
|
139
|
+
Added:
|
|
140
|
+
|
|
141
|
+
* Support for wolframalpha 3.0 with transitional fallback to 2.4 (#11, #19; see
|
|
142
|
+
README notes)
|
|
143
|
+
* New configuration option `max_public`, a number defining the maximum number of
|
|
144
|
+
lines that can be sent without using NOTICEs. Default: 5 (#13)
|
|
145
|
+
* New configuration option `units`, to specify whether the API should return
|
|
146
|
+
`metric` (default) or `nonmetric` measurements (#18; see #16)
|
|
147
|
+
|
|
148
|
+
Updated:
|
|
149
|
+
|
|
150
|
+
* Threshold for using NOTICEs is now 5 lines, up from the previous default of 3
|
|
151
|
+
|
|
152
|
+
Fixed:
|
|
153
|
+
|
|
154
|
+
* Non-ASCII text in output is no longer `\:encoded` (#15)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### 0.3.1 "Nusumareta kuchibiru"
|
|
158
|
+
|
|
159
|
+
Updates:
|
|
160
|
+
|
|
161
|
+
* Unicode-encode query to avoid UnicodeEncodeError on non-ASCII characters (#10)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### 0.3.0 "So long!"
|
|
165
|
+
|
|
166
|
+
Updates:
|
|
167
|
+
|
|
168
|
+
* Results longer than 3 lines will be sent via NOTICE instead of flooding
|
|
169
|
+
channels (#8)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### 0.2.1 "Mae shika mukanee"
|
|
173
|
+
|
|
174
|
+
Updates:
|
|
175
|
+
|
|
176
|
+
* Output now split into multiple messages when line breaks are present (#4)
|
|
177
|
+
* Tell pip we do not want wolframalpha 3.0 yet (#6)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### 0.2.0 "Miraibashi"
|
|
181
|
+
|
|
182
|
+
Updates:
|
|
183
|
+
|
|
184
|
+
* Try a lot harder to give useful output (#3)
|
|
185
|
+
* Tell user to try again if an unspecified error occurs (empty error message)
|
|
186
|
+
|
|
187
|
+
Meta:
|
|
188
|
+
|
|
189
|
+
* Cleanup: PEP8 & unused imports
|
|
190
|
+
* Refactor to make future addition of integration tests easier
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### 0.1.2 "Switch"
|
|
194
|
+
|
|
195
|
+
Updates:
|
|
196
|
+
|
|
197
|
+
* Shorten some error messages
|
|
198
|
+
* Identify as "[W|A]" instead of "[Wolfram]" in output for brevity
|
|
199
|
+
* Ensure all module output is prefixed
|
|
200
|
+
* Add more examples to help output and README
|
|
201
|
+
|
|
202
|
+
Meta:
|
|
203
|
+
|
|
204
|
+
* README now includes installation instructions and where to get help/report
|
|
205
|
+
bugs
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
### 0.1.1 "Already"
|
|
209
|
+
|
|
210
|
+
Updates:
|
|
211
|
+
|
|
212
|
+
* Now outputs error if `app_id` is missing (#1)
|
|
213
|
+
|
|
214
|
+
Meta:
|
|
215
|
+
|
|
216
|
+
* README reformatted (thanks @[maxpowa](https://github.com/maxpowa))
|
|
217
|
+
* Begin maintaining version history in NEWS file
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### 0.1.0 "Beginner"
|
|
221
|
+
-------------------------------
|
|
222
|
+
|
|
223
|
+
* Initial release
|
|
224
|
+
* Adopted with permission from
|
|
225
|
+
https://github.com/maxpowa/inumuta-modules/blob/e0b195c/wolfram.py
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
COPYING
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
NEWS
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
sopel_wolfram/__init__.py
|
|
7
|
+
sopel_wolfram/plugin.py
|
|
8
|
+
sopel_wolfram.egg-info/PKG-INFO
|
|
9
|
+
sopel_wolfram.egg-info/SOURCES.txt
|
|
10
|
+
sopel_wolfram.egg-info/dependency_links.txt
|
|
11
|
+
sopel_wolfram.egg-info/entry_points.txt
|
|
12
|
+
sopel_wolfram.egg-info/requires.txt
|
|
13
|
+
sopel_wolfram.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sopel_wolfram
|