-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add warning for newbs not to edit auto-generated file #10456
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
"""This file generates `generated.pyx` which is then included in `../algos.pyx` | ||
during building. To regenerate `generated.pyx`, just run: | ||
|
||
`python generate_code.py`. | ||
|
||
""" | ||
|
||
from __future__ import print_function | ||
# we only need to be able to run this file on 2.7 | ||
# don't introduce a pandas/pandas.compat import | ||
# or we get a bootstrapping problem | ||
from StringIO import StringIO | ||
import os | ||
from pandas.compat import StringIO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I made it 2/3 compatible. I didn't understand this warning here and the original commit had no more information about this. I tested this on Py2 and Py3 and it seemed to work fine... |
||
import numpy as np | ||
|
||
_int64_max = np.iinfo(np.int64).max | ||
|
||
warning_to_new_contributors = """ | ||
# DO NOT EDIT THIS FILE: This file was autogenerated from generate_code.py, so | ||
# please edit that file and then run `python2 generate_code.py` to re-generate | ||
# this file. | ||
""" | ||
|
||
header = """ | ||
cimport numpy as np | ||
cimport cython | ||
|
@@ -2526,8 +2537,14 @@ def generate_from_template(template, exclude=None): | |
take_2d_multi_template] | ||
|
||
|
||
def generate_take_cython_file(path='generated.pyx'): | ||
def generate_take_cython_file(): | ||
# Put `generated.pyx` in the same directory as this file | ||
directory = os.path.dirname(os.path.realpath(__file__)) | ||
filename = 'generated.pyx' | ||
path = os.path.join(directory, filename) | ||
|
||
with open(path, 'w') as f: | ||
print(warning_to_new_contributors, file=f) | ||
print(header, file=f) | ||
|
||
print(generate_ensure_dtypes(), file=f) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 actually has to be run from
pandas/src
(so thatgenerated.pyx
is in the correct place), so either we need to fix this (e.g. the output path should be relative to the pandas tree), or provide this in the instructions.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.
Right, I fixed it so it can now be run from anywhere.