Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for wolframalpha 3.0 #11

Merged
merged 5 commits into from
Jun 21, 2017
Merged

Add support for wolframalpha 3.0 #11

merged 5 commits into from
Jun 21, 2017

Conversation

dgw
Copy link
Owner

@dgw dgw commented Dec 22, 2016

Allow pip to satisfy the requirement with any version between 2.0 (inclusive) and 4.0 (exclusive).

Some queries have different output when using 3.0 (vs. when using 2.x), but in most cases it appears that the change is from returning "No text-representable result" to returning some form of usable text, so I won't spend a ton of time trying to figure out why. It's an improvement.

Completes part all (revised May 10, 2017) of #5 (supporting both 2.x and 3.x).

Allow pip to satisfy the requirement with any version between 2.0 (inclusive) and 4.0 (exclusive).

Some queries have different output when using 3.0 (vs. when using 2.x), but in most cases it
appears that the change is from returning "No text-representable result" to returning some form
of usable text, so I won't spend a ton of time trying to figure out why. It's an improvement.
@dgw dgw added this to the v0.4.0 milestone Dec 22, 2016
@dgw dgw self-assigned this Dec 22, 2016
@dgw dgw force-pushed the wolframalpha-3.0 branch 2 times, most recently from 667a573 to 6164cf7 Compare January 2, 2017 00:36
@dgw
Copy link
Owner Author

dgw commented Jan 2, 2017

As of 57d088b, this is working with wolframalpha both 2.4 and 3.0. However, there are some regressions in certain cases that concern me. Under 3.0, for example, .wa dgw returns an error ("No text-representable result"). It should, however, return information about the Converse County Airport in Wyoming.

This should not be merged without first finding and fixing the source of these regressions.

Under wolframalpha 3.0, some queries would show "No text-representable result found"
even though under wolframalpha 2.4 (or lower) they worked fine.

Preliminary tests show that this code change puts this module's output in line with
Rizon's Internets bot again (though the set of test queries was admittedly quite small).

Further testing in production of this code will continue, with further optimizations to
follow if all goes well. The new structure can probably handle both library versions,
so the nasty nested try...except blocks can likely be refactored out. (I see now why the
example usage in wolframalpha 3.0's README shows for-loops being used to process pods...)
@dgw dgw removed the do not merge label May 9, 2017
@dgw
Copy link
Owner Author

dgw commented May 9, 2017

Removing do not merge label, as the regression appears to be fixed by a5c63aa. Still not truly ready to merge because of pending refactoring/cleanup, but nothing should break now.

Other than checking how many pods there are, the same code works for fetching
text from results generated by wolframalpha library both pre-3.0 and 3.0. That
means that the ugly nested try...except blocks and multi-level raises can go.

The new structure is a lot easier to follow, and mostly uses exception-catching
to handle edge cases or tell the user there is a bug that needs reporting.
@dgw dgw mentioned this pull request May 10, 2017
3 tasks
@dgw dgw merged commit b2698f0 into master Jun 21, 2017
dgw added a commit that referenced this pull request Jun 21, 2017
Add support for wolframalpha 3.0
@dgw dgw deleted the wolframalpha-3.0 branch June 21, 2017 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant