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: finish CarDocs migration to opendbc #1333

Closed
wants to merge 18 commits into from

Conversation

jyoung8607
Copy link
Collaborator

@jyoung8607 jyoung8607 commented Oct 2, 2024

Create opendbc/car/docs, gather docs-related stuff there. Prereq for #1286.

CARS.md will continue to live in the same place in openpilot.

  • comma.ai/vehicles impact understood
  • shop.comma.ai impact understood

@jyoung8607
Copy link
Collaborator Author

  • comma.ai/vehicles impact understood
  • shop.comma.ai impact understood

@sshane At your convenience, can you help make sure this stuff follows? Per our discussion, the API output will be kept stable even with upcoming CARS.md 2.0, but consumers will need to change their import path.

@jyoung8607 jyoung8607 marked this pull request as draft October 2, 2024 22:26
@jyoung8607 jyoung8607 self-assigned this Oct 2, 2024
Comment on lines +17 to +18
# FIXME: make sure we run in a sensible way if not checked out as a submodule, try-except for writing to CARS.md
CARS_MD_OUT = os.path.join(BASEDIR, "../", "../", "../", "docs", "CARS.md")
Copy link
Contributor

@sshane sshane Oct 2, 2024

Choose a reason for hiding this comment

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

The path to the out file should be in openpilot and passed in.

Since we don't write any docs in opendbc, probably best to leave everything in openpilot for now

For example, web4 just needs the opendbc API:

import os
from opendbc.car.docs import generate_cars_md, get_all_car_docs

WEB4_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
OUT_FILE = os.path.join(WEB4_DIR, "src/lib/vehicles.json")

if __name__ == '__main__':
  content = generate_cars_md(get_all_car_docs(), os.path.join(WEB4_DIR, "static/vehicles_template.json"))
  with open(OUT_FILE, "w") as f:
    f.write(content)
  print(f"Generated and written to {OUT_FILE}")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The path to the out file should be in openpilot and passed in.

I can do that.

Since we don't write any docs in opendbc, probably best to leave everything in openpilot for now

We will. The new ALL-CARS.md (or whatever name we bikeshed) will live in opendbc. It needs to run, generate, save, and test in opendbc without having openpilot available.

CARS.md only lives in openpilot because we don't want to change the link until we have a bigger step-change in how it looks and works.

from opendbc.car.docs import generate_cars_md, get_all_car_docs

I'll see if I can juggle things to maintain that import location.

Copy link
Contributor

@sshane sshane Oct 2, 2024

Choose a reason for hiding this comment

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

You can just make docs.py executable and write the opendbc docs by default, then openpilot's docs.py can stay using the APIs in this file

@jyoung8607 jyoung8607 closed this Oct 3, 2024
@jyoung8607 jyoung8607 deleted the doc-gen-migration branch November 2, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants