Skip to content
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

Docstrings API examples #648

Merged
merged 12 commits into from
Apr 10, 2024
Merged

Docstrings API examples #648

merged 12 commits into from
Apr 10, 2024

Conversation

anopsy
Copy link
Contributor

@anopsy anopsy commented Apr 8, 2024

Description

Added examples to:

  • sklego/preprocessing/formulaictransformer.py
  • sklego/preprocessing/identitytransformer.py
  • sklego/preprocessing/pandastransformers.py
  • sklego/preprocessing/projections.py
  • sklego/preprocessing/repeatingbasis.py

Copy link
Collaborator

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

The difference between the two keywords Example and Examples is subtle but:

  • Examples is a keyword in mkdocstring griffe and has the example as a section, always displayed
  • Example is a keyword in mkdocs material and adopts the boxed colored layout.

I would opt for the first one as it is numpydoc compliant. However I can see why the second option is also nice and appealing.
If we go for that, maybe I would suggest to use the a collapsible blocks

??? example
...

so that it is closed by default and lowers the clutter in the page, yet easy to access for a user.

@koaning thoughts?


Copy link
Collaborator

Choose a reason for hiding this comment

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

How did that survive lint CI/CD in the first place? 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ach so! Thank you for explaining, I also fell for this little test tube in the corner. Just to make sure, the "example" also allows for collapsing, isn't?
Waiting for your decision and will adjust it accordingly

Copy link
Collaborator

@FBruzzesi FBruzzesi Apr 9, 2024

Choose a reason for hiding this comment

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

Yes, for "example" it is just a matter of default (expanded vs collapsed).
Let's wait for Vincent feedback/preference to weight on this 🙃

Copy link
Owner

Choose a reason for hiding this comment

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

Maybe go for usage instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought Usage keyword was google-style specific, but at least from the griffe docs it seems it is neither google or numpy.

At the end of the day I believe the only difference is that keywords get bold-ed (example in screenshot).

I think for now the safest way to proceed is to use Examples keyword as it would have the lowest impact and require less changes.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll do Examples then, if you change your mind, just ping me

@anopsy
Copy link
Contributor Author

anopsy commented Apr 10, 2024

I didn't add preprocessing.intervalencoder.IntervalEncoder because I need to delve more into what is it exactly doing. According to the docs strings it's "bending" / "smoothing" the values in X . I checked what "smoothing" in math is doing, and I have my doubts if you meant IntervalEncoder to do smoothing or you meant a monotonic transformation. If you could give me a hint what to research, I'd be really grateful

Copy link
Collaborator

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Thanks for fixing that everywhere 👌✨

@FBruzzesi FBruzzesi changed the title Examples Docstrings API examples Apr 10, 2024
@FBruzzesi FBruzzesi merged commit 35dd279 into koaning:main Apr 10, 2024
17 checks passed
@FBruzzesi
Copy link
Collaborator

FBruzzesi commented Apr 10, 2024

@anopsy I hope that the Interval Encoders user guide and the examples there help.

If it doesn't, feel free to reach out to me on socials as well, since user guide would also need some improvements.

Disclaimer: I personally never used the feature

@FBruzzesi FBruzzesi mentioned this pull request Apr 10, 2024
33 tasks
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