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

Improve the docs #972

Closed
hgrecco opened this issue Jan 7, 2020 · 12 comments
Closed

Improve the docs #972

hgrecco opened this issue Jan 7, 2020 · 12 comments
Assignees
Labels
Milestone

Comments

@hgrecco
Copy link
Owner

hgrecco commented Jan 7, 2020

This is just a placeholder issue to obtain feedback about the current state of the docs:

  1. Are the docs clear enough?
  2. Are the examples useful and real?
  3. Is the information there for a newbie?
  4. Is the information there for an advanced user?
  5. Is the organization appropiate?
  6. What can we do to improve it.
@hgrecco hgrecco added the docs label Jan 7, 2020
@toihr
Copy link

toihr commented Jan 8, 2020

There seems to be an issue regarding the Dataframe Integration

df_ = df.pint.quantify(level=-1)
df_

This Code Snippet given by the Docs does not work and returns the error; 'DataFrame' object has no attribute 'pint'

@toihr
Copy link

toihr commented Jan 8, 2020

i just checked more to the Dataframe Integration this part also Produces Errors:

import pandas as pd
import pint
df = pd.DataFrame({
    "torque": pd.Series([1, 2, 2, 3], dtype="pint[lbf ft]"),
    "angular_velocity": pd.Series([1, 2, 2, 3], dtype="pint[rpm]"),
})
df

Produces the error: data type 'pint[lbf ft]' not understood

Im now assuming there is just an import or a setup missing in the Documentation and that fails the Code snippets. Which makes the Pandas Integration part very unintuitive or rather not at all understandable because it is not reproducable.

@jthielen
Copy link
Contributor

jthielen commented Jan 8, 2020

Here are some of the thoughts I had (from a high-level perspective, not getting into finer details of the individual pages):

  • Content coverage
    • I think the breadth and depth of coverage of material in the docs is pretty good!
    • Perhaps a clearer organization of the user guide into sections (or even just a getting started/user guide/help & reference split like xarray) would be worthwhile
  • Navigation
    • I wish there was a better sidebar menu so that you didn't have to jump back to the homepage, click through multiple sections, or use search to navigate and browse the docs
  • Small-screen friendliness
    • Right now, the pages are somewhat hard to use on a mobile device or restricted screen width (lack of good top menu, content overflowing device width, etc.)
    • The "Fork me on GitHub" corner banner gets in the way
    • The search experience is especially poor
  • API Reference
    • The current API reference, the "Developer Reference" page https://pint.readthedocs.io/en/latest/developers_reference.html is somewhat difficult to use (with its current state, I find it easy to just refer to the source code itself than use that portion of the docs)
    • The formatting does not establish a clear separation between components, and the lack of a summary view makes it hard to browse
    • Not sure what is considered public vs. private API?
    • The testsuite seems to be injected into the reference, which I don't think should happen?
    • Ideally, I'd like to see something like xarray or MetPy with clear summary tables that could then be clicked on for more details.
      • While likely tedious, overall improvement of the docstrings would also greatly help here too

I think many of these could be benefited by changing to a new theme, like the very commonly used Sphinx RTD theme (used by xarray, Dask, CuPy, MetPy, and many others). Would that be a reasonable first step?

@toihr
Copy link

toihr commented Jan 9, 2020

i second the sidebar menu that would be a great addition

@hgrecco
Copy link
Owner Author

hgrecco commented Jan 9, 2020

Regarding Navigation and Small-screen friendliness, I think we just need to use another template. This current one has been with us from the very beginning and it has serve us well. But we need to change. My only requirement is that we keep the pint of beer.

Regarding API Reference: 100% agree

Regarding issues raised by @Meistermagier, I think we need to use doctest in combination with travis more extensively. Additionally, it would be good to test the jupyter notebooks that we might upload.

@TomNicholas
Copy link
Contributor

Just echoing what others have said, especially regarding the API reference. The formatting is hard to read, it doesn't have subsections, the [source] links to a copy of the code on the site rather than to the GH, and the test classes shouldn't be listed.

There should also be a better page index on the left of the docs, at the moment you have to scroll to the bottom of the homepage to find anything.

That said I think apart from that the docs are nice, the tutorial sections and descriptions in particular are really good! (Which is the most important part I think).

bors bot added a commit that referenced this issue Jun 17, 2020
1116: Harmonize most doctests with Pint's current behavior r=hgrecco a=clarkgwillison

- [ ] Closes # (no single issue)
- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [x] The change is fully covered by automated unit tests
- [x] Documented in docs/ as appropriate
- [x] Added an entry to the CHANGES file

This PR partially addresses #947, #972, and #990 

After merging, the number of failing doctests in the Sphinx documentation should go from 92 (as mentioned in #947) down to 3:
```
Doctest summary
===============
  335 tests
    3 failures in tests
    0 failures in setup code
    0 failures in cleanup code
build finished with problems.
make: *** [doctest] Error 1
```
Which will put us well in reach of enabling doctests in Travis to prevent documentation regressions in the future.

Most tests were fixed in this PR by deferring to the current behavior of Pint, however `Quantity.__repr__()` was modified to round floating point magnitudes to 9 digits to avoid several test failures that were being caused by floating point ambiguities.

Issue #1115 was opened to track the 3 tests that I could not easily resolve. Once that issue is resolved, we can enable doctests in Travis without breaking CI.

Co-authored-by: Clark Willison <clarkgwillison@gmail.com>
bors bot added a commit that referenced this issue Jul 15, 2020
1132: Some rewriting and rearranging of docs, including more (and fixed) links r=hgrecco a=clarkgwillison

- [x] Addresses (but not closes) #972
- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [x] The change is fully covered by automated unit tests
- [x] Documented in docs/ as appropriate
- [ ] Added an entry to the CHANGES file

This PR started with small fixes to links (small syntax errors that were causing links not to render in Sphinx) and some grammar changes, but ended up redoing much of the tutorial page.

The main commit is 3a1d475, which moves a good portion of the "parsing strings" section of the tutorial to a new page dedicated to explaining all the ways to define a `Quantity()` in Pint. Theory here is a slightly shorter tutorial with good links to more in-depth coverage will be more helpful to new users and old, but that's just a theory.

This PR also removes the testsuite from the developer reference, though it doesn't fix any of the other rendering issues in there.

Feedback humbly solicited.

Co-authored-by: Clark Willison <clarkgwillison@gmail.com>
@jules-ch
Copy link
Collaborator

jules-ch commented Aug 14, 2021

I'm gonna tackle this soon.

I'll probably change the theme for either pydata-sphinx-theme (numpy, pandas, ...) or sphinx_book_theme (xarray) which is based on pydata theme.

It will leverage a better experience & I know a bunch of contributors has experienced with this.

We'll get better side bars to navigate in the docs. I'll also introduce a better API Reference which we lack at the moment.

@jules-ch jules-ch added this to the 0.18 milestone Aug 14, 2021
This was referenced Aug 17, 2021
@keewis
Copy link
Contributor

keewis commented Aug 21, 2021

for some additional reference and help: https://diataxis.fr/ (formerly https://documentation.divio.com)

@keewis
Copy link
Contributor

keewis commented Aug 21, 2021

originally posted in #1375 (comment) by @hgrecco:

How about dividing the index? It seems too crowded. This is a proposal

Getting started
    Installation
    Tutorial

User Guide
    Defining Quantities
    String formatting
    Temperature conversion
    Logarithmic Units

Rolling your own conversions and making a better use of those included (find a short title)
    Defining units
    Different Unit Systems (and default units)
    Contexts

Interaction with other packages
    NumPy Support
    Serialization
    Plotting with Matplotlib
    Pandas support

Other cool stuff (find a title)
    Buckingham Pi Theorem
    Optimizing Performance
    Wrapping and checking functions
    Using Pint for currency conversions
    Using Measurements (I want to extract measurements to another package, and then this will go to Interaction with other packages)

More information
    Command-line script
    Developer reference
    Contributing to Pint
    Frequently asked questions

Edit: Also, I support reorganizing the API reference. I'm not sure whether that's typical usage, but I usually look for the public API in the docs and when working on pint I just look through the source code. In any case, in my experience autosummary (without :recursive:, if that's the right option) has been pretty easy to work with

@dalito
Copy link
Contributor

dalito commented Aug 21, 2021

I like the proposed structure. I would just move the "Wrapping and checking functions" to section 3. As small title for this section I suggest "Adjusting and integrating pint". So section 3 would target the advanced user.

I find the sub-title "Other cool stuff" OK for a section that describes the features that are not part of the core functionality of a unit library.

"Optimizing Performance" could also fit in section 3 (or in "More information"). It does not fit to "Cool stuff".

@hgrecco
Copy link
Owner Author

hgrecco commented Aug 21, 2021

I also think that the tutorial could be rewriten. For example:

  • Localizing, I think it could be moved to another section. Either within String formatting or a new one inside Interaction with other packages
  • The string parsing and formatting subsection sould be more focus and a link to the corresponding expanded section

@jules-ch jules-ch self-assigned this Feb 20, 2022
@jules-ch
Copy link
Collaborator

Closing this after #1474

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants