Skip to content

DOC: Explain how our shared_docs system works #16446

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
TomAugspurger opened this issue May 23, 2017 · 5 comments · Fixed by #20016
Closed

DOC: Explain how our shared_docs system works #16446

TomAugspurger opened this issue May 23, 2017 · 5 comments · Fixed by #20016
Labels
Docs good first issue Internals Related to non-user accessible pandas implementation
Milestone

Comments

@TomAugspurger
Copy link
Contributor

Enhance https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst with a discussion of how our _shared_docs system works.

  • Why we do it (reduce duplicate docstrings, while still having some class-specific stuff)
  • How it's done (Appender, _shared_docs dict, _shared_doc_kwargs)
  • How to substitute values
@TomAugspurger TomAugspurger modified the milestones: Interesting Issues, Next Major Release May 23, 2017
@TomAugspurger TomAugspurger added Difficulty Novice Docs Internals Related to non-user accessible pandas implementation labels May 23, 2017
@TheGhostHuCodes
Copy link

I was working with one of our fellow PyCon2017 sprinters figure out this system. I'll take a shot at writing this up in the docs.

@TomAugspurger
Copy link
Contributor Author

Thanks. Post here or on gitter if you have any questions.

@AdamShamlian
Copy link
Contributor

@TomAugspurger is there a "central" location where I can start to self-educate myself here? After a cursory glance through source, I couldn't seem to find a file that would be considered a "best starting place." Should I just start inferring patterns and usage by looking across source as a whole?

@TomAugspurger
Copy link
Contributor Author

@AdamShamlian the best places to start are probably:

  1. The definitions in pandas/core/generic.py:
    # goal is to be able to define the docs close to function, while still being
    where most of these are defined
  2. The uses in pandas/core/frame.py, pandas/core/series.py, etc (search for _shared_docs)
  3. The implementation in pandas/util/_decorators.py:
    class Substitution(object):
    (maybe it'll help you understand whats going on).

Let me know if you have questioons!

@AdamShamlian
Copy link
Contributor

Ok, thanks for the tips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs good first issue Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants