-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implemented Nested Docs. #3597
Implemented Nested Docs. #3597
Conversation
boto3/docs/base.py
Outdated
self._resource_sub_path = self._resource_name.lower() | ||
if self._resource_name == self._service_name: | ||
self._resource_sub_path = 'ServiceResource' | ||
self._resource_sub_path = 'service-resource' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What prompted the name changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the reasons in my previous response, this had to be 'serviceresource' or 'service-resource'. I thought the latter looked better and also correlated with how the Service Resource section fragment looks #service-resource
. Either one can be supported.
boto3/docs/resource.py
Outdated
def _add_feature_freeze_note(self, section): | ||
section = section.add_new_section('feature-freeze') | ||
section.style.start_note() | ||
section.write( | ||
("The AWS Python SDK team does not intend to add new features to the resources " | ||
"interface in boto3. Existing interfaces will continue to operate during " | ||
"boto3's lifecycle. Customers can find access to newer service features through " | ||
f"the :doc:`client interface <../../{self._service_name}>`.") | ||
) | ||
section.style.end_note() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this generated for every resource? I've forgotten if we've discussed this previously. We may want to link back to the main resource page with that message rather than adding it everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is generated at the top of every resource page. Not sure what you mean by:
link back to the main resource page with that message rather than adding it everywhere.
Would we alter the message saying something like "Please see for the current guidance on using boto3 Resources"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, something like that would be good.
boto3/docs/service.py
Outdated
def _document_service_resource(self, section): | ||
# Create a new DocumentStructure for each Service Resource and add contents. | ||
service_resource_doc = DocumentStructure('ServiceResource', target='html') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we've converted ServiceResource
to service-resource
everywhere else. Is there a reason it's still CamelCase here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong but dont think the value of DocumentStructure name or path affects much. I can update for consistency once we come to a conclusion on how paths should be handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think that's fine with the explanation above. Let's make it all consistent with what you have and we can call it good.
tests/functional/docs/test_s3.py
Outdated
self.assert_contains_lines_in_order( | ||
[ | ||
'.. py:class:: S3.Client', | ||
' s3/Client/download_file', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the naming changes are losing the casing that distinguishes classes from methods. Was that change prompted by a technical requirement or just to enforce path consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lowercasing of sub-paths was prompted by the fact that resources are now in their own sub-pages, the fragments of section headers are lowercased, and CloudFront path patterns are case-sensitive. If a user was previously linking to the following resource section headers .../s3.html#service-resource
or .../s3.html#bucketlifecycleconfiguration
, we would (without the lowercasing) want to reroute to .../s3/ServiceResource/index.html
which is mappable but we'd have to do the same for .../s3/BucketLifeCycleConfiguration/index.html
and all other resources (93 across 10 services). However, we can redirect to .../s3/bucketlifecycleconfiguration/index.html
without a mapping.
These are the options I see:
- Leave as is and sacrifice casing.
- Create a huge mapping of lowercased resource names to correctly cased names.
- Don't support service resource section header redirections. Note: Resource class/method links will still be rerouted as normal since their fragments provide the correct casing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's probably ok, as long as you'll reach the same location with the old link, I don't think casing is the end of the world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple small notes we can try to address in a follow up. Otherwise, I think we're looking good. Thanks @jonathan343!
def _add_overview_of_member_type(self, section, resource_member_type): | ||
section.style.new_line() | ||
section.write( | ||
f'These are the resource\'s available {resource_member_type}:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; we can fix this in a follow up, but I think this is supposed to be "resources" plural rather than possessive?
section.style.start_note() | ||
section.write( | ||
"Before using anything on this page, please refer to the resources " | ||
":doc:`user guide <../../../../guide/resources>` for the most recent " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; can we do this as an absolute path relative than relative to the resource page?
Merging this now to make boto3 |
* release-1.26.81: Bumping version to 1.26.81 Add changelog entries from botocore Added changelog for nested docs Implemented Nested Docs. (#3597)
Issue
Our current documentation structure creates one file for each service along with its client methods, exceptions, paginators, and waiters. Having all this content on one page has cased some performance issues on some browsers for large services. This will continue to be an issue as services continue to grow and we need a way to break up service documentation into multiple pages.
Summary
This PR implements the changes that adapt boto3 docs to changes that were made to the botocore doc structure. It also implements boto3 specific nested docs for service resources. In other words, the main page for each service (
<service_name>.html
) will now have the main client information along with sub-sections for each of the categories (if applicable e.g. a service may not have waiters), each which contain a list of links to the corresponding sub-pages. A new section called "Resources" has been added to the top-level service page and looks similar to the others such as "Client". It simply lists to the nested resource pages.Note:
<service_name>.html
files remain in their original location to preserve pre-existing pages. There will also be new folders for each service containing the corresponding sub-pages as shown below.Old Structure:
New Structure:
Redirects
In order to allow previously existing links to continue to work, a client side fix has been added which parses the URL fragment using
window.location.hash.substring(1)
and reroutes to the corresponding sup page.For Example:
will redirect to:
Preview Changes
I've attached a zip file (boto3_docs.zip) which includes a preview for the described changes. The best way to view this is using a local server to host the files. Here are some quick steps to get view the changes:
cd <path_to_zip>
unzip -d boto3_docs boto3_docs.zip
cd boto3_docs/html
python -m http.server