Make python3 the default for `.py`
Closed this issue · 1 comments
RagnarGrootKoerkamp commented
python 2 is dead now. Can we change the default language for the .py
extension to python3?
Obviously this is not backwards compatible, but when needed it can easily be solved by putting #!/usr/bin/env python2
at the top of a python2 .py
file.
For BAPCtools, I'm using the following in languages.yaml
:
# Python2 with shebang comes before default python3.
python2_with_shebang:
name: 'Python 2'
priority: 860
files: '*.py *.py2'
shebang: '^#!.*python2\b'
compile: '/usr/bin/python2 -m py_compile {files}'
run: '/usr/bin/python2 {mainfile}'
python3:
name: 'Python 3'
priority: 850
files: '*.py *.py3'
compile: '/usr/bin/python3 -m py_compile {files}'
run: '/usr/bin/python3 {mainfile}'
# Python2 without shebang comes after python3.
python2:
name: 'Python 2'
priority: 840
files: '*.py2'
compile: '/usr/bin/python2 -m py_compile {files}'
run: '/usr/bin/python2 {mainfile}'
(side question: I don't think problemtools
supports overriding languages.yaml
by a repository/contest-level languages.yaml
, right? Otherwise one could just add this snippet to the contest specific configuration.)
mpsijm commented
Something else I've just noticed: apparently, Kattis uses PyPy (https://open.kattis.com/help/python3), but Problemtools does not. I guess that should also be changed?