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

default to python3 on Unix #512

Merged
merged 1 commit into from
Jul 25, 2018
Merged

default to python3 on Unix #512

merged 1 commit into from
Jul 25, 2018

Conversation

stevengj
Copy link
Member

Now that Conda defaults to Python 3 (JuliaPy/Conda.jl#108), to be consistent PyCall should default to python3 on non-Mac Unices.

Python 2 is still supported, you just need to configure PyCall with ENV["PYTHON"]="python2" or similar. Existing installations will not be affected because PyCall remembers what Python you last configured with.

See also #435.

@codecov-io
Copy link

codecov-io commented Jul 25, 2018

Codecov Report

Merging #512 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #512   +/-   ##
=======================================
  Coverage   65.55%   65.55%           
=======================================
  Files          19       19           
  Lines        1504     1504           
=======================================
  Hits          986      986           
  Misses        518      518

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e42d165...3a4abd6. Read the comment docs.

@stevengj stevengj merged commit d737299 into master Jul 25, 2018
@stevengj stevengj deleted the python3 branch July 25, 2018 20:36
@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Aug 9, 2018

I see you took my advice, but only partly (Subject ".. on Unix" [too, not only] threw me off, didn't realize Conda applied for PyCall; UTF-8 stuff still applies here).

Since you did, should Python 3.7 be preferred (and at least tested)? At least this feature:

https://www.python.org/downloads/release/python-370/
"Avoiding the use of ASCII as a default text encoding (PEP 538, legacy C locale coercion and PEP 540, forced UTF-8 runtime mode)", i.e. from PEP 540: "Add the -X utf8 command line option and PYTHONUTF8 environment variable to control UTF-8 Mode."

I'm not sure, but I think this "forced UTF-8 runtime mode" may align better with Julia. At least if Python 3.7 is used, maybe it should be enabled by default?

It may or may not (already) be backported to earlier versions:
https://pythoninsider.blogspot.com/2018/08/python-356-and-python-349-are-now.html

--
I'm a little skeptical of leaving macOS at Python2 (in some cases it may not matter, then could have stayed with Python2 on Linux, but in other cases code will cork on one but not the other platform).

Should at least Windows also default to Python3? It usually has no Python installed, so if conda gets one for you it may as well be Python 3.7.

@stevengj
Copy link
Member Author

stevengj commented Aug 9, 2018

MacOS and Windows default to using Conda, which now defaults to Python 3.

@stevengj
Copy link
Member Author

stevengj commented Aug 9, 2018

It might be reasonable to set UTF-8 I/O in libpython, but not by an environment variable (which would affect child processes too). We need to find an API for this.

(When pyjulia is used, we shouldn't change the I/O mode, however.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants