Skip to content

Make singularity run under python3 (in parallel with python2)#169

Merged
nthykier merged 5 commits intosingularity:masterfrom
nthykier:make-singularity-run-under-python3
Aug 12, 2019
Merged

Make singularity run under python3 (in parallel with python2)#169
nthykier merged 5 commits intosingularity:masterfrom
nthykier:make-singularity-run-under-python3

Conversation

@nthykier
Copy link
Member

@nthykier nthykier commented Aug 7, 2019

These 3 commits are the only parts remaining to make singularity run under python3 (in parallel with python2). Note the emphasis on run because it needs testing to ensure that the game works the same in python2 and python3 (notably floating division might be an issue).

@nthykier nthykier force-pushed the make-singularity-run-under-python3 branch from e228619 to 0e5ddbb Compare August 7, 2019 13:00
@codecov-io
Copy link

codecov-io commented Aug 7, 2019

Codecov Report

Merging #169 into master will increase coverage by 0.16%.
The diff coverage is 54%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #169      +/-   ##
========================================
+ Coverage   30.84%    31%   +0.16%     
========================================
  Files          35     36       +1     
  Lines        5032   5057      +25     
========================================
+ Hits         1552   1568      +16     
- Misses       3480   3489       +9
Impacted Files Coverage Δ
code/graphics/text.py 16.42% <ø> (ø) ⬆️
code/stats.py 56% <0%> (ø) ⬆️
code/item.py 44.06% <0%> (ø) ⬆️
code/difficulty.py 88.88% <0%> (ø) ⬆️
code/buyable.py 51.9% <100%> (ø) ⬆️
code/i18n.py 36.36% <100%> (+0.97%) ⬆️
code/data.py 51.04% <100%> (-0.89%) ⬇️
code/graphics/button.py 29.94% <100%> (+0.37%) ⬆️
code/graphics/listbox.py 20.11% <100%> (+0.44%) ⬆️
code/graphics/theme.py 21.53% <16.66%> (+0.6%) ⬆️
... and 5 more

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 ab3be54...1416caf. Read the comment docs.

@nthykier nthykier force-pushed the make-singularity-run-under-python3 branch 2 times, most recently from 8e852a2 to e245c0f Compare August 7, 2019 18:01
@Xenega
Copy link
Member

Xenega commented Aug 9, 2019

For iter, I think we should use from future.utils import iteritems. Otherwise it's inefficient in python2.

For pycompat, I don't see a avantage to add a underscore, just hide the real name (long instead of long_)

Otherwise it's good.

@nthykier
Copy link
Member Author

I can certainly do long_ as long (python refuses to import keywords such long from another module).

As for iteritems. Honestly, I do not think it is worth it. None of our dicts are large enough for this to be human visible. Given python2 compat will live a year or so at most and that python3 can load python2 games, I think we should just say "Please use python3 as it offers the best performance. We will keep python2 on life-support and it may be slower.".

@nthykier nthykier force-pushed the make-singularity-run-under-python3 branch 4 times, most recently from e630421 to 8c6d7b7 Compare August 11, 2019 18:39
This enables us to reference some things (mostly) by their python2
name while still supporting python3 in parallel.  In time, this layer
should be removed again when we stop supporting python2.

Signed-off-by: Niels Thykier <[email protected]>
@nthykier nthykier force-pushed the make-singularity-run-under-python3 branch from 8c6d7b7 to 1416caf Compare August 12, 2019 06:37
@nthykier nthykier merged commit 4b13af6 into singularity:master Aug 12, 2019
@nthykier nthykier deleted the make-singularity-run-under-python3 branch August 12, 2019 06:42
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