Skip to content

API: rename pandas/core/generic.py -> pandas/core.ndframe.py #51171

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

Conversation

topper-123
Copy link
Contributor

IMO generic.py is a very anonymous name and it would be better to have the more descriptive name ndframe.py.

core/generic.py will still exist, but will emits a deprecation warning if used/imported from. I've added a deprecation test in pandas/tests/ndframe/test_frame_and_series.py.

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Feb 4, 2023

is pandas.core.generic user-facing? if not, then this will complicate looking through histories of lines (e.g. with git log -G)

@phofl
Copy link
Member

phofl commented Feb 4, 2023

We can't do this right now, core is only semi private.

If we want to change things here, we have to deprecate and make it private first

@topper-123
Copy link
Contributor Author

Hm, yeah, I thought renamed files maintain their git history, but it looks like they don't (at least git log -p -- pandas/core/ndframe.py doesn't), so I guess this PR has a bigger trade-off than I thought when I made it.

I guess unless there is agreement to the cost of this change (losing git history) is worth it, I'll have to close the PR again. I'll leave this open for a while for discussion just in case.

@phofl
Copy link
Member

phofl commented Feb 4, 2023

Independent of the git history, we can't do this right now.

We would have to deprecate core first before we can move stuff around

@topper-123
Copy link
Contributor Author

topper-123 commented Feb 4, 2023

Actually as I suspected, git history is actually preserved and you can see the git history by using the --followparameter, e.g. git log -p --follow HEAD~100..HEAD -- pandas/core/ndframe.py. OF course, people may forget/not know about --follow, so there's that negative aspect.

@phofl, my plan is to make two PRs in order to maintain git history AND go through a proper deprecation cycle, so this change could be backward compatible as per our normal rules. I've upload the second PR in order to show what I planned (see #51173). If you look at these two PRs as a whole, you'll see it is backward compatible (i.e. the pandas.core.generic is deprecated) and git history is preserved (using --follow).

@phofl
Copy link
Member

phofl commented Feb 4, 2023

I am -1 as is.

The general idea is to deprecate core as a whole, technically it is already considered private (https://pandas.pydata.org/docs/reference/index.html)

There is already an open issue about it with lots of discussion:
#27522

Renaming the file and pointing downstream libraries/users to another file when we might want to deprecate the whole module is not a good idea. A bad name is not a strong enough reason to cause all these disturbances and confusing side effects imo.

@topper-123
Copy link
Contributor Author

Ok no worries, I'll close the PRs. I can see that the core` discussion superceeds this issue.

@topper-123
Copy link
Contributor Author

Closing based on comments.

@topper-123 topper-123 closed this Feb 4, 2023
@phofl
Copy link
Member

phofl commented Feb 4, 2023

Happy to rename generally, but we have to make a decision for the core deprecation first

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