Making package compatible with language_level=3 #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey,
I tried installing
phasedibd
on the compute cluster and noticed that there are compilation errors depending on which cython version you use. For example, if I usecython==3.0.2
, I get compilation errors along the line of:In other words, the compiler is not finding the relevant
.pxd
file. This issue does not arise when working withcython==0.29.23
as well as earlier versions ofpython3
. I noticed that what is driving the differences in behavior is the default assignment of thelanguage_level
compiler flag. Earlier versions ofcython
andpython3
uselanguage_level="2"
by default (if not specified). In newer versions, they uselanguage_level="3"
. So, the first change I made was I explicitly set thelanguage_level
in the newsetup.py
file to avoid these issues:However, this raises other issues. In python3, import paths are expected to be absolute (issue and its relevance to
language_level
is discussed here). So, I had to update all the.pxd
and.pyx
files to ensure that the import paths are absolute.Finally, because of the switch to
python3
, there is an additional compiling error that arises when cythonizingtemplated_pbwt_analysis.pyx
. The issue has to do with the integer division being translated to a double on lines 93 and 165:To make this work, I changed the division to
//
. (Not sure if this would preserve the intended behavior; Please confirm).Finally, I added a
requirements.txt
file because a friend noticed that the unit tests fail when using newer versions ofpandas
. Please feel free to modify/update this based on your latest tests.