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

Docs codegen #3445

Merged
merged 46 commits into from Sep 28, 2023
Merged

Docs codegen #3445

merged 46 commits into from Sep 28, 2023

Conversation

jprochazk
Copy link
Member

@jprochazk jprochazk commented Sep 25, 2023

What

Closes #2775

  • Add docs as a new "language" in codegen
  • Replace old docs with new ones
  • Minor output polish work
    • Components and APIs section should say "Required Components" instead of just "Required" (for all kinds)
    • Use actual headings for example titles
    • Use images even in .rs/.py files

Follow-up work: #3503

Checklist

@jprochazk jprochazk mentioned this pull request Sep 26, 2023
3 tasks
jprochazk added a commit that referenced this pull request Sep 26, 2023
### What

* Fixes #2461

The new link format is
`https://static.rerun.io/{original_image_name_minus_extension}/{content_hash}/{width}.{ext}`

For example,
`https://static.rerun.io/ae4b8970edba8480431cb71e57b8cddd9e1769c7_clock_480w.png`
is now
`https://static.rerun.io/clock/ae4b8970edba8480431cb71e57b8cddd9e1769c7/480w.png`.

What makes this more discoverable:
- For machines, it's the fact that the hash is the same for all sizes.
This means given an image URL, you can retrieve all the other sizes.
This is important for #3445.
- For humans, the top-level directory is the name of the image, which
makes it _much_ easier to browse through GCS looking for that image. You
can compare the `updated at` date of each hash to find the latest one.

`upload_image.py` has been updated to use the new format. We're nowhere
near the point of using too much space on GCS, so all the old links are
preserved.

This PR also fixes some other issues:
- `thumbnails.py` did not handle updating `thumbnail_dimensions`
correctly if the property was already present in the frontmatter
- `upload_image.py` would fail if the user does not have `delete`
permission when uploading the same image twice, because it would attempt
to overwrite the existing image. if the content hash does not change,
then we do not need to upload the image again, so we just skip uploading
to GCS if the object already exists.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3477) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3477)
- [Docs
preview](https://rerun.io/preview/67a25d43432ddf6245f04ca52806fd976a4dac4e/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/67a25d43432ddf6245f04ca52806fd976a4dac4e/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
@jprochazk jprochazk added 📖 documentation Improvements or additions to documentation 🧑‍💻 dev experience developer experience (excluding CI) codegen/idl include in changelog labels Sep 27, 2023
@jprochazk jprochazk marked this pull request as ready for review September 27, 2023 11:24
@jprochazk jprochazk marked this pull request as draft September 27, 2023 12:17
@nikolausWest
Copy link
Member

Screenshot 2023-09-27 at 22 38 37

Should probably just say "Components" in the heading.

Could we make this section tighter? Perhaps using a table or something like

Components

Required: position3d
Recommended: color, radius
Optional: text, class_id, keypoint_id, instance_key

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Awesome!

crates/re_types/build.rs Show resolved Hide resolved
crates/re_types/build.rs Show resolved Hide resolved
crates/re_types/src/lib.rs Outdated Show resolved Hide resolved
crates/re_types/src/lib.rs Show resolved Hide resolved
crates/re_types_builder/src/codegen/common.rs Show resolved Hide resolved
crates/re_types_builder/src/codegen/docs/mod.rs Outdated Show resolved Hide resolved
crates/re_types_builder/src/codegen/docs/mod.rs Outdated Show resolved Hide resolved
crates/re_types_builder/src/codegen/python.rs Outdated Show resolved Hide resolved
if let Some(title) = example.base.title {
lines.push(format!(" ### {title}"));
}
lines.push(" ```ignore".into());
Copy link
Member

Choose a reason for hiding this comment

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

Why ignore? All the code examples should properly parse.

no_run should work just as well

Suggested change
lines.push(" ```ignore".into());
lines.push(" ```no_run".into());

Copy link
Member

Choose a reason for hiding this comment

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

ignore sounds correct to me.

All of these are already compiled and ran as part of the code_examples crate; recompiling them here would only slow down the CI for very little benefit?

Copy link
Member

Choose a reason for hiding this comment

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

fair; I guess we don't need the extra sanity check

@@ -58,6 +58,8 @@
from google.cloud import storage
from PIL.Image import Image, Resampling

# NOTE: We depend on the stack using the exact sizes they do right now in:
# - docs codegen (`image_url_stack`)
Copy link
Member

Choose a reason for hiding this comment

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

very good!

@nikolausWest
Copy link
Member

We also need to remove the old archetype pages and update the index page as well

@jprochazk
Copy link
Member Author

jprochazk commented Sep 28, 2023

I updated the index page, but I think we should do any potential iterations over the docs in a separate PR, because this one is already way too large

I see you already opened #3504 - I'll just merge this then once CI passes

@jprochazk jprochazk merged commit 65bad7e into main Sep 28, 2023
27 checks passed
@jprochazk jprochazk deleted the jan/codegen-docs branch September 28, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen/idl 🧑‍💻 dev experience developer experience (excluding CI) 📖 documentation Improvements or additions to documentation include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate archetype docs
4 participants