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

Add an API vs command overview in table form to docs #149

Merged
merged 72 commits into from
Oct 3, 2024
Merged

Add an API vs command overview in table form to docs #149

merged 72 commits into from
Oct 3, 2024

Conversation

JOJ0
Copy link
Owner

@JOJ0 JOJ0 commented Jul 27, 2024

...and on the way, do some minor fixes in our docs layout/TOC.

Preview here: https://synadm.readthedocs.io/en/dev/features.html

  • Adds an API vs CLI command comparision table
  • Uses a CSV file as the source
  • The table ordering follows the Synapse Admin API's documentation chapters order
  • Adds a utility to scrape a given Synapse Admin API docs chapter for chapter hyperlinks
    • pip install beautifulsoup4; ./scrape_docs.py --help
    • Generates RST formatted hyperlinks
    • and outputs a two-column CSV table
    • Must be copy/pasted into existing features.csv manually but still saves some work
  • Adding corresponding synadm commands to CSV (right column) must also be done manually
  • There is a nasty bug in sphinx-click, we can't link to a a command like synadm user detail directly, we only can link to a command like synadm user detail --option or synadm user detail USER_ID, therefore sometimes I linked to arbitrary --options just to get as close as possible to the chapter in the CLI reference.

@JOJ0 JOJ0 marked this pull request as draft July 27, 2024 09:13
JOJ0 added 9 commits August 3, 2024 14:08
Word our links exactly as the chapters/toc links in Synapse docs are!
in rst syntax. Seems like linking to a :ref: is not possible, because
sphinx-click does not generate one, or I don't know what it's called. Linking
to a whole doc is possible, as this commit does. Not what we want but leave for
reference.
in the left column. Use proper rst Syntax in the right column. Unfortunately we
have to work around this bug:
click-contrib/sphinx-click#15

Bug description in short: Only linking to cli-options possible, not to entire
cli-commands. Eg. `synadm room list -i` works but `synadm room list` does not!
and for now leave latest Synapse version in link description. TBD how to handle
deprecated/removed API's.
A first draft. Gets all anchors but only if a direct parent is a header tag.
and fix rst output format (trailing underscore)
JOJ0 added 3 commits August 6, 2024 11:09
fix existing data to use two spaces for indentation of subordinate api docs
links and remove bulletpoints entirely in right column.
and remove "Overview" suffix for main-api-docs-links
@JOJ0 JOJ0 force-pushed the dev branch 2 times, most recently from 0a46a45 to ac122ce Compare August 6, 2024 14:23
with the help of scrape_docs.py.
Note: More than one indentation level in left column does not seem to be
displayed in the final html table...no idea why...ignore!
JOJ0 and others added 5 commits September 24, 2024 07:42
- Shorten slightly: |nbindent| -> |indent|
- Finish placing it in features_*.csv files
containing synadm commands not directly (or not at all) related to a
Synapse Admin API.
1. must be a dict
2. missing comma
Copy link
Collaborator

@JacksonChen666 JacksonChen666 left a comment

Choose a reason for hiding this comment

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

Pushed 2 commits to fix things related to setup.py and prerequisites command in scrape_docs.py.

The 2 review comments I have also has a commit I haven't yet pushed, but I can push if the changes are wanted.

doc/source/features.rst Outdated Show resolved Hide resolved
doc/source/features.csv Outdated Show resolved Hide resolved
@JOJ0
Copy link
Owner Author

JOJ0 commented Sep 25, 2024

Pushed 2 commits to fix things related to setup.py and prerequisites command in scrape_docs.py.

The 2 review comments I have also has a commit I haven't yet pushed, but I can push if the changes are wanted.

Yeah please do! Didn't come around to tidying up yet. Many thanks!

but leave out the fact that it's not an installed script and has to be
called including path ./ or whatever...
- Link to "Synapse Admin API Coverage" page instead of README.md chapter
- Shorten bullet points text in both "Types of Contribution" sections.
- Add "Feature Coverage Documentation" chapter describing the purpose of
  the page, how to maintain using scrape_docs.py
@JOJ0
Copy link
Owner Author

JOJ0 commented Sep 28, 2024

@JacksonChen666 please review my take on CONTRIBUTING.md: 1b5e2c6

Tried to shorten some existing sentences too, all nitpicks welcome!

scrape_docs.py is not finished yet, I want to include |indent| replacement instead of spaces and document that in --help

In CONTRIBUTING.md maybe it would be good to state that linking to synadm commands is not perfect/flawed (options-links-only issues). What do you think?

Copy link
Collaborator

@JacksonChen666 JacksonChen666 left a comment

Choose a reason for hiding this comment

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

I've decided to rename "Synapse Admin API Coverage" to "synadm's API Coverage" since it felt less confusing.

Otherwise, I reworded one point and the rest seems fine to me.

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
doc/source/features.rst Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
@JOJ0
Copy link
Owner Author

JOJ0 commented Sep 29, 2024

I've decided to rename "Synapse Admin API Coverage" to "synadm's API Coverage" since it felt less confusing.

Otherwise, I reworded one point and the rest seems fine to me.

Hmm I see your point that "Synapse Admin API Coverage" might read a bit confusing (as if we would code the Synapse Admin API, which we don't) but now it feels like "synadm's API Coverage" is equally confusing but the other way round. My first impression was that we are talking about an API synadm is providing, which it isn't!

You see my point? I think we need another round of brainstorming about the title!

Some ideas for rethinking:

  • If we take one step back, basically we are simply talking about a "feature coverage" summary
  • We could also call the page as kind of a "mapping between Synapse Admin API and synadm commands" - a "feature map"? an "API vs. CLI mapping"

@JacksonChen666
Copy link
Collaborator

* We could also call the page as kind of a "mapping between Synapse Admin API and synadm commands" - a "feature map"? an "API vs. CLI mapping"

Actually that makes sense as well, I like "API vs. CLI mapping"

@JOJ0
Copy link
Owner Author

JOJ0 commented Sep 30, 2024

* We could also call the page as kind of a "mapping between Synapse Admin API and synadm commands" - a "feature map"? an "API vs. CLI mapping"

Actually that makes sense as well, I like "API vs. CLI mapping"

Yeah I agree that that's the right direction. Decided that the "vs." does not feel perfect when we use "mapping". What do you think about these:

  • API to CLI Map
  • API to CLI Mapping

Which one better in your opinion @JacksonChen666?

@JacksonChen666
Copy link
Collaborator

Yeah I agree that that's the right direction. Decided that the "vs." does not feel perfect when we use "mapping". What do you think about these:

* API to CLI Map

* API to CLI Mapping

Which one better in your opinion @JacksonChen666?

API to CLI Mapping

@JOJ0
Copy link
Owner Author

JOJ0 commented Oct 3, 2024

Ok I'll finally merge it...

In CONTRIBUTING.md maybe it would be good to state that linking to synadm commands is not perfect/flawed (options-links-only issues). What do you think?

I documented this in CONTRIBUTING.md.

What I left out on purpose is describing the spaces to |indent| replacement that is done by the scraper. I did document that in scrape_docs.py --help though. Not sure if that's enough but since this PR took quite a while now already, I think I'll wait until someone steps over it and we see that it really is unclear or even important at all....

Thanks for all the feedback, I hope I didn't mess up anything but I'd like to spare us another round of reviewing...it should be good enough.

@JOJ0 JOJ0 merged commit 4c75e80 into master Oct 3, 2024
2 checks passed
@JacksonChen666
Copy link
Collaborator

What I left out on purpose is describing the spaces to |indent| replacement that is done by the scraper. I did document that in scrape_docs.py --help though. Not sure if that's enough but since this PR took quite a while now already, I think I'll wait until someone steps over it and we see that it really is unclear or even important at all....

Later I'll try to create the things from scratch and let you know... somewhere. Probably here.

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.

2 participants