-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Install isympy using setuptools console_scripts when available #13193
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
Install isympy using setuptools console_scripts when available #13193
Conversation
This makes isympy available on Windows. And isympy is now also accessible as `python -m sympy`. Fixes sympy#13008
|
diff --git a/sympy/utilities/tests/test_code_quality.py b/sympy/utilities/tests/test_code_quality.py
index b3641ea06..f73fcd401 100644
--- a/sympy/utilities/tests/test_code_quality.py
+++ b/sympy/utilities/tests/test_code_quality.py
@@ -213,8 +213,8 @@ def test_this_file(fname, test_file):
"%(sep)spolys%(sep)sdomains%(sep)s__init__.py" % sepd,
# interactive sympy executes ``from sympy import *``:
"%(sep)sinteractive%(sep)ssession.py" % sepd,
- # isympy executes ``from sympy import *``:
- "%(sep)sbin%(sep)sisympy" % sepd,
+ # __main__(was isympy) executes ``from sympy import *``:
+ "%(sep)ssympy%(sep)s__main__.py" % sepd,
# these two are import timing tests:
"%(sep)sbin%(sep)ssympy_time.py" % sepd,
"%(sep)sbin%(sep)ssympy_time_cache.py" % sepd, |
sympy/__main__.py
Outdated
| @@ -0,0 +1,357 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should not be here. The __main__.py file shouldn't be executed directly (it generally won't work).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also add a comment to the top of this file indicating that this is the isympy script.
|
This looks fine. Just the one comment. We'll have to see at release time if this breaks our release process. |
|
The local isympy script doesn't work |
| sympy_dir = os.path.join(sympy_top, 'sympy') | ||
|
|
||
| if os.path.isdir(sympy_dir): | ||
| sys.path.insert(0, sympy_top) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to keep these lines in here (and conversely, they shouldn't be in __main__.py). They let ./bin/isympy import from the local version.
| if os.path.isdir(sympy_dir): | ||
| sys.path.insert(0, sympy_top) | ||
|
|
||
| # DO NOT IMPORT SYMPY HERE! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the original reason for this comment #7048. Let's double check that the -t python flag works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and it doesn't work (the ground types are set to gmpy). I think it is not possible to make this work with python -m sympy, because Python already imports sympy first when that is run. So we might have to do some hacks to make the -t flag work.
|
OK, I didn't notice this breaks the -t flag (same issue as #7048). Not sure how we can continue to make that work, as it has to be set before sympy is imported. |
|
One suggestion would be to package |
|
@asmeurer I pushed some commits some time ago to try and handle the issues, just in case you missed them 😉. |
ylemkimon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Windows 10 64-bit, Python 2.7/3.6, with/without setuptools. It successfully installs isympy.exe with setuptools.
|
Thank you! |
|
Did you test that the |
|
Great. |

This makes
isympyavailable on Windows. Andisympyis now also accessible aspython -m sympy.Fixes #13008