Skip to content

Build documentation with mkdocs#38

Merged
peytondmurray merged 22 commits intogoogle:masterfrom
smokestacklightnin:ci/docs/use-mkdocs
Aug 12, 2025
Merged

Build documentation with mkdocs#38
peytondmurray merged 22 commits intogoogle:masterfrom
smokestacklightnin:ci/docs/use-mkdocs

Conversation

@smokestacklightnin
Copy link
Collaborator

@smokestacklightnin smokestacklightnin commented Sep 25, 2024

This PR builds the documentation using mkdocs.

The following is included in this PR:

  • Add mkdocs.yml configuration along with associated javascript and stylesheets
  • Automatically render API docs using mkdocstrings
  • Remove deprecated API docs stored as markdown files in favor of automatically generated API docs. This is advantageous for several reasons, including that developers no longer need to update both docstrings and separate markdown files to document their code.
  • Add modules that should be included to __all__ list in appropriate __init__.py files
  • Move example notebooks to documentation directory so they are rendered in docs
  • Add a deployment workflow for the repository
  • Fix formatting of code and buttons
  • Fix some broken links
  • Use README.md as homepage by creating a softlink to it from the documentation folder

In order to deploy the documentation, a maintainer will need to enable publishing from a branch on this repo for the gh-pages branch after this PR is merged.

Here is a preview of the new documentation

Copy link
Collaborator

@peytondmurray peytondmurray left a comment

Choose a reason for hiding this comment

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

A few changes mentioned below, but also:

Can we have a workflow that also builds (but doesn't deploy) the docs trigger when a PR is made? With the way it currently is currently building on push to master, contributors can easily break documentation without knowing it.

mkdocs-material-

- name: Install Dependencies
run: pip install mkdocs mkdocs-material mkdocstrings[python] griffe-inherited-docstrings mkdocs-autorefs mkdocs-jupyter mkdocs-caption markdown-grid-tables
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can these be moved into a dedicated optional dependency? pip install '.[docs]' or similar so that the dependencies can actually be tracked.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@smokestacklightnin
Copy link
Collaborator Author

Can we have a workflow that also builds (but doesn't deploy) the docs trigger when a PR is made? With the way it currently is currently building on push to master, contributors can easily break documentation without knowing it.

Made this change, mirroring what we've done for the other repos we're working on.

@peytondmurray
Copy link
Collaborator

Hi @hassler-google, is there anything else I can do to help push this forward? It would be great to get this merged.

Copy link
Collaborator

@peytondmurray peytondmurray left a comment

Choose a reason for hiding this comment

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

Wow, this one was a lot of work. Thanks for this!

One request: can the docs_dir be the default docs/? Or is there some reason to have them be under g3doc?

@smokestacklightnin
Copy link
Collaborator Author

One request: can the docs_dir be the default docs/?

@peytondmurray Done

@peytondmurray peytondmurray merged commit 83f9b1f into google:master Aug 12, 2025
2 checks passed
vkarampudi added a commit that referenced this pull request Feb 11, 2026
* Struct2Tensor 0.48.0 Release

PiperOrigin-RevId: 743712449

* Build documentation with `mkdocs` (#38)

* Add minimum viable mkdocs configuration

* Add examples section

* Add links to api docs and overviews

* Get api docs up and running

* Add `__all__` to `__init__.py` files to include correct classes

This is just a first step to including the correct items in the api docs

* Exclude test modules from docs

* Use correct module

* Add docs deployment workflow

* Include all correct modules/classes/functions

* Fix button rendering

* Fix formatting, including admonitions

* Fix broken link

* Use README.md as homepage for docs

* Fix links

* Remove debug triggers from docs deployment workflow

* Remove deprecated api docs

* Fix triggers

* Move docs requirements to common location

* Only trigger on pushes to master

* Remove unnecessary newline characters

* Move docs location to default `docs` directory

* only internal visibility change, no external change

PiperOrigin-RevId: 755419474

* Automated Code Change

PiperOrigin-RevId: 796979132

* Automated Code Change

PiperOrigin-RevId: 803375108

* no-op

PiperOrigin-RevId: 809038483

* Added pytype None checks to calculate.py

PiperOrigin-RevId: 845226580

* Replace unicode escaped characters in ipynb files

PiperOrigin-RevId: 856192266

* Fixes that needs to be available in the main branch in order to cherry-pick into Release branch (#49)

* Update WORKSPACE

* Update workspace.bzl

* Migrate to Protobuf 4.23.4: custom Bazel rule for Python proto generation

Protobuf 4.x removed py_proto_library and changed proto_library behavior. This commit:

- Creates _py_proto_library_rule: a custom Bazel rule that accepts ProtoInfo or PyInfo,
  runs protoc to generate Python _pb2.py files, and provides PyInfo for Python deps
- Replaces deprecated py_proto_library calls with custom rule implementation
- Configures protoc proto_path to include workspace dirs and external dependencies
- Adds local any.proto copies to bypass sandbox limitations in proto imports
- Applies compatibility patches to TensorFlow and TensorFlow Metadata dependencies
- Updates all s2t_proto_library_py calls to work with new implementation

Fixes: Protobuf 4.23.4 compatibility for struct2tensor build system

* Add compatibility patches for older Abseil and Protobuf 4.x

This patch extends tensorflow.patch with changes to support:

1. Abseil backward compatibility:
   - Add absl_base_prefetch.h compatibility shim for older Abseil
     versions that lack absl/base/prefetch.h
   - Update prefetch includes across TensorFlow/TSL to use the shim
   - Add inline implementation of NullTerminatedMessage for older
     Abseil versions without StatusMessageAsCStr

2. Protobuf 4.x support:
   - Refactor cc_proto_library to use native proto_library and
     cc_proto_library rules instead of custom proto_gen
   - Implement custom _tsl_py_proto_library_rule to replace the
     built-in py_proto_library removed in Protobuf 4.x
   - Update proto library generation to depend on generated
     cc_proto_library targets

3. Build cleanup:
   - Remove unused absl/strings:string_view dependency
   - Update BUILD files to reflect new dependency structure

These changes enable building struct2tensor with older Abseil versions
while supporting Protobuf 4.x, improving compatibility across different
dependency versions.

* chore: upgrade Protobuf dependency from 4.23.4 to 4.25.6

* Move TFMD patch to tfmd.patch; Protobuf 4.x compatibility

Remove vendored google/protobuf/any.proto and obsolete third_party/README.md

* fix: Use native prefix for Bazel rules in macros

Prefix cc_binary and cc_library with native. in struct2tensor.bzl

* Update Dockerfile

* Fix struct2tensor integration in TensorFlow Serving Docker build

Apply rules_cc patch before adding struct2tensor local repository to ensure proper Bazel configuration.

* Update RELEASE.md to sync with main branch

* Update version.py

---------

Co-authored-by: Gagandeep Singh <gdp.1807@gmail.com>

* docs(release): Update RELEASE.md and version for 0.48.0

* Update Dockerfile to build with serving version 2.17.1

* Build and stage dynamic op libraries before wheel creation (#51)

Add explicit build and copy steps for dynamic op libraries (.so files) in
build_common.sh. This ensures all six dynamic library targets are built and
copied to struct2tensor/ops/ before the wheel is packaged.

Previously, the stamp_wheel step in build_manylinux.sh would fail with
patchelf errors ("No such file or directory") because the .so files were
expected in struct2tensor/ops/ but were not being copied from bazel-bin.

This fix:
- Explicitly builds each dynamic library target
- Copies the built .so files from bazel-bin to the staging directory
- Runs before bazel run :build_pip_package to ensure files are present

Fixes the missing _decode_proto_map_op.so, _decode_proto_sparse_op.so and
related dynamic library warnings during wheel packaging.

* Enable OSS Bazel builds by fixing dependencies and proto paths (#50)

- Add py_proto_library macro for OSS compatibility
- Replace gunit_main with googletest gtest_main
- Comment out Google-internal dependencies and missing test files
- Fix proto import to use workspace-relative path
- Remove invalid third_party load statements

Fixes build errors when running `bazel build //...` in OSS environment.

Co-authored-by: Madhur Karampudi <142544288+vkarampudi@users.noreply.github.com>

---------

Co-authored-by: struct2tensor-team <tensorflow-extended-nonhuman@googlegroups.com>
Co-authored-by: Gagandeep Singh <gdp.1807@gmail.com>
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