Skip to content

[MRG+2] ENH/MAINT Check for changes in pxd files too and cleanup the code - #6254

Merged
ogrisel merged 2 commits into
scikit-learn:masterfrom
raghavrv:cythonize_when_pxd_changes
Feb 18, 2016
Merged

ogrisel merged 2 commits into
scikit-learn:masterfrom
raghavrv:cythonize_when_pxd_changes

Conversation

@raghavrv

Copy link
Copy Markdown
Member

The cython code should compile when there is a change in the corresponding pxd file too.

Also cleaned up the variable names and simplified a bit.

Since I am using a try...except block, this should work even with an old cythonize.dat

Please review - @arthurmensch @amueller @ogrisel @MechCoder

Comment thread sklearn/_build_utils/cythonize.py Outdated
rc = subprocess.call(['cython'] +
flags + ["-o", gen_file, cython_file])
if rc != 0:
raise Exception('Cythonizing failed')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please include the name of the cython file in the error message?

@ogrisel

ogrisel commented Feb 4, 2016

Copy link
Copy Markdown
Member

LGTM.

@raghavrv
raghavrv force-pushed the cythonize_when_pxd_changes branch 2 times, most recently from 35ef86a to bc81136 Compare February 4, 2016 17:36
@raghavrv

raghavrv commented Feb 4, 2016

Copy link
Copy Markdown
Member Author

Done. Thanks for the review! Should the 2 commits be squashed? They do 2 different things.

@raghavrv raghavrv changed the title [MRG] ENH/MAINT Check for changes in pxd files too. Cleanup code [MRG+1] ENH/MAINT Check for changes in pxd files too. Cleanup code Feb 4, 2016
@ogrisel

ogrisel commented Feb 4, 2016

Copy link
Copy Markdown
Member

Lets keep them separated.

@raghavrv

raghavrv commented Feb 7, 2016

Copy link
Copy Markdown
Member Author

@arthurmensch Could you take a look at this? :)

@raghavrv

Copy link
Copy Markdown
Member Author

Wait there is yet another cython file format ".pxi"

@raghavrv

Copy link
Copy Markdown
Member Author

Hmm checking that cannot be done cleanly :@

We need to check if a pyx file contains any pxi files included and go back to that pxi file and if there are any changes in that pxi file, this pyx file needs to be cythonized again :@ Arghh @ogrisel Should I skip that for now.

Or maybe raise a warning saying that the file contains pxi files whose changes might not be tracked. And to recompile add some some whitespace changes to this pyx file if they have made any changes in the included pxi file.

@raghavrv

Copy link
Copy Markdown
Member Author

Currently kd_tree.pyx and ball_tree.pyx are the only ones which use the binary_tree.pxi... we could also special case them...

BTW what's wrong with simply putting it in a proper (pyx + pxd) file (sorry if I am dumb, but isn't this actually better than including the code at both the places)

@raghavrv
raghavrv force-pushed the cythonize_when_pxd_changes branch from bc81136 to b93ccb9 Compare February 18, 2016 12:56
@arthurmensch

Copy link
Copy Markdown
Contributor

Neat, the code needed some cleanup.

Use of .pxi files is kind of exotic I reckon (in fact you can always avoid them using a .pxd file), I would be surprised to see new pxi files added to scikit-learn so I would think special casing binary_tree.pxi (if updated, compile kd_tree.pyx and ball_tree.pyx ) is a good idea. LGTM otherwise.

@raghavrv

Copy link
Copy Markdown
Member Author

Thanks for the review!! Let us merge this and raise an issue for binary_tree.pxi?

@raghavrv raghavrv changed the title [MRG+1] ENH/MAINT Check for changes in pxd files too. Cleanup code [MRG+2] ENH/MAINT Check for changes in pxd files too. Cleanup code2 Feb 18, 2016
ogrisel added a commit that referenced this pull request Feb 18, 2016
[MRG+2] ENH/MAINT Check for changes in pxd files too. Cleanup code2
@ogrisel
ogrisel merged commit bf9cd88 into scikit-learn:master Feb 18, 2016
@ogrisel

ogrisel commented Feb 18, 2016

Copy link
Copy Markdown
Member

Merged, please open an issue for binary_tree.pxi.

@raghavrv
raghavrv deleted the cythonize_when_pxd_changes branch February 18, 2016 15:38
@raghavrv raghavrv changed the title [MRG+2] ENH/MAINT Check for changes in pxd files too. Cleanup code2 [MRG+2] ENH/MAINT Check for changes in pxd files too and cleanup the code Mar 10, 2016
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