-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BLD: Use tempita for cython templating #13716
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
Conversation
""" | ||
Template for each `dtype` helper function for join | ||
|
||
WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in |
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 warning should only be on the .pxi right?
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.
actually I see, maybe make sure this warning is in all of the .pxi.in files.....
does this change build time? you might need to change the manifest (to not include the .pxi files) |
Current coverage is 84.56% (diff: 100%)@@ master #13716 diff @@
==========================================
Files 141 141
Lines 51195 51195
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 43295 43295
Misses 7900 7900
Partials 0 0
|
For build time, tempita looks little slower. It may caused by include files are split to 4... (both after on current master:
tempita:
|
this looks fine to me. @jorisvandenbossche @wesm ? |
Nice! (@sinhrks you're quite on speed lately! :-)) No further comment from me |
LGTM - nice, @sinhrks ! |
77c4d7e
to
d955b70
Compare
added |
|
||
for name, c_type, dtype, can_hold_na, nogil in dtypes: | ||
|
||
nogil = 'with nogil:' if nogil else '' |
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.
use a different variable name here (e.g., nogil_str
)
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.
done. also, removed unnecessary gil
kw not used in templates.
can you make sure this is lintable (and add on as well), see here not a big deal, but if you manually lint pyx files these will be as well |
@sinhrks ping when ready |
@@ -23,14 +23,26 @@ if [ "$LINT" ]; then | |||
for path in 'window.pyx' | |||
do | |||
echo "linting -> pandas/$path" | |||
flake8 pandas/$path --filename '*.pyx' --select=E501,E302,E203,E226,E111,E114,E221,E303,E128,E231,E126,E128 | |||
flake8 pandas/$path --filename '*.pyx' --select=E501,E302,E203,E226,E111,E114,E221,E303,E128,E231,E126 |
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.
E128 is duplicated, thus removed.
6cc47c9
to
fa307af
Compare
@@ -80,6 +80,7 @@ scikits | |||
!np_datetime_strings.c | |||
*.c | |||
*.cpp | |||
*.pxi |
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.
It's not that important for now, but in general those files should not necessarily be ignored, as we could also have non-generated .pxi
files. Eg scipy includes the actual names of the generated file in the gitignore (because the generated files can also be eg .pyx
files).
So maybe as good practice already include the actual names?
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.
no, by-definition .pxi
are auto-generated, we never want to add them to the repo, while .pxi.in
we always do.
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.
AFAIK .pxi
are just 'include' files, so they are not auto-generated by definition.
http://docs.cython.org/src/reference/language_basics.html#cython-file-types
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.
but WE are using them as auto-generated files (from .pxi.in)
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.
further we DON't want to include an auto-generated file in git. So yes maybe should specifically exclude them in .gitignore (or rather the auto-gen ones)
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 think we want to use .pxi
for the auto-generated ones. while .pxd
is much more like a c include file (e.g. its done by hand). .pyx
is also 'hand-generated'
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.
Reconsidered this, and now I think we should include .pxi
under git actually. Otherwise, Travis cache can't work because .pxi
is always newly generated?
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.
ahh ok - that will still reflect changes so that sounds fine
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.
Will change:
- remove
pxi
from excluding rules - change
setup.py
to overwritepxi
if required comparing its timestamp.
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.
slightly related question: is there a reason you use pxi
/pxi.in
files in this case, while we use pyx
extension in other cases for included files? (would be nice to do this consistently within pandas)
I don't have a strong opinion about it, the name "pxi.in" is derived from @gfyoung 's PR. whichever looks consistent:
|
This link here should help clarify the file extensions. |
@gfyoung that link doesn't seem to work, can you update. |
Corrected. So from that link, But given that we currenlty use |
I actually like that |
thanks @sinhrks can always think about the |
git diff upstream/master | flake8 --diff
not sure what the
setup.py
's best practice be...CC: @gfyoung