8000 [MRG+2] ENH/MAINT Check for changes in pxd files too and cleanup the code by raghavrv · Pull Request #6254 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

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

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

Merged
merged 2 commits into from
Feb 18, 2016

Conversation

raghavrv
Copy link
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

rc = subprocess.call(['cython'] +
flags + ["-o", gen_file, cython_file])
if rc != 0:
raise Exception('Cythonizing failed')
Copy link
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
Copy link
Member
ogrisel commented Feb 4, 2016

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
Copy link
Member Author
raghavrv commented Feb 4, 2016

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
Copy link
Member
ogrisel commented Feb 4, 2016

Lets keep them separated.

@raghavrv
Copy link
Member Author
raghavrv commented Feb 7, 2016

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

@raghavrv
Copy link
Member Author

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

@raghavrv
Copy link
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
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
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
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
Copy link
Member
ogrisel commented Feb 18, 2016

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
0