Skip to content

Conversation

ngrayluna
Copy link
Contributor

@ngrayluna ngrayluna commented Mar 17, 2025

  • Removes code from markdown file and moves it to code_examples/source.
  • Uses Blue Hawk to parse the script into snippets using code snippets and Blue Hawk CLI. Those snippets are then injected into markdown files. For example, suppose you have a file called quickstart.py:
{{< code language="python" source="/code_examples/snippets/quickstart.snippet.all.py" >}}

Where quickstart refers to the file name and all refers to the code block comment + title

  # :snippet-start: all
  import wandb
  import random
  # :snippet-end: all

This PR also adds a GitHub Action that checks:

  1. You can install libraries used in scripts successfully check_dependencies.sh
  2. Files stored in code_examples/source run successfully. It uses matrix to check files in parallel.

This is a WIP PR. Not ready for reviews just yet while I still demo, configure.

Known to-dos:

  1. Configure wandb API key for checks. See this line in error message.

📄 View preview links for changed pages

johndmulhausen and others added 2 commits March 17, 2025 16:56
Suggestions are drifting from the originating lines; added more logic to
ensure the suggestions line up properly
@ngrayluna ngrayluna added WIP DO-NOT-MERGE For PRs that should not be merged yet labels Mar 17, 2025
@ngrayluna ngrayluna requested a review from a team as a code owner March 17, 2025 23:37
Copy link

socket-security bot commented Mar 17, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​wandb@​0.21.375100100100100

View full report

Copy link

socket-security bot commented Mar 17, 2025

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
pypi/[email protected] has Native code.

Location: Package overview

From: ?pypi/[email protected]pypi/[email protected]

ℹ Read more on: This package | This alert | Why is native code a concern?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Verify that the inclusion of native code is expected and necessary for this package's functionality. If it is unnecessary or unexpected, consider using alternative packages without native code to mitigate potential risks.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore pypi/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
pypi/[email protected] has Native code.

Location: Package overview

From: ?pypi/[email protected]pypi/[email protected]

ℹ Read more on: This package | This alert | Why is native code a concern?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Verify that the inclusion of native code is expected and necessary for this package's functionality. If it is unnecessary or unexpected, consider using alternative packages without native code to mitigate potential risks.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore pypi/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
pypi/[email protected] has Native code.

Location: Package overview

From: code_examples/requirements.txtpypi/[email protected]

ℹ Read more on: This package | This alert | Why is native code a concern?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Verify that the inclusion of native code is expected and necessary for this package's functionality. If it is unnecessary or unexpected, consider using alternative packages without native code to mitigate potential risks.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore pypi/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e368b54
Status: ✅  Deploy successful!
Preview URL: https://c33a93b4.docodile.pages.dev
Branch Preview URL: https://blue-hawk-demo.docodile.pages.dev

View logs

id: list-scripts
run: |
SCRIPTS=$(find scripts -name "*.py" | jq -R -s -c 'split("\n")[:-1]')
SCRIPTS=$(find code_examples/source -name "*.py" | jq -R -s -c 'split("\n")[:-1]')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit greedy. At a minimum I'd add -type f so you don't find directories that end in .py. I'm also confused why you have to take something that is going to be multi-line input with one result per line, join it up, and then split it again right away?

Suggested change
SCRIPTS=$(find code_examples/source -name "*.py" | jq -R -s -c 'split("\n")[:-1]')
SCRIPTS=$(find 'code_examples/source' -type f -name "*.py" | jq -R -s -c 'split("\n")[:-1]')

Copy link
Contributor

github-actions bot commented Sep 3, 2025

PR Preview: Changed content

Base preview: https://blue-hawk-demo.docodile.pages.dev

Added

Title Path
Code.Html layouts/shortcodes/code.html

Modified

Title Path
W&B Quickstart content/en/guides/quickstart.md

@ngrayluna
Copy link
Contributor Author

Closing in favor of: #1668

@ngrayluna ngrayluna closed this Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGE For PRs that should not be merged yet WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants