Skip to content

add python docs #787

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

add python docs #787

wants to merge 6 commits into from

Conversation

filip-michalsky
Copy link
Collaborator

why

its about time!

what changed

added python docs to mintlify

test plan

n/a

Copy link

changeset-bot bot commented May 31, 2025

⚠️ No Changeset found

Latest commit: 640922d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@filip-michalsky filip-michalsky requested a review from kamath June 14, 2025 01:38
@filip-michalsky filip-michalsky marked this pull request as ready for review June 14, 2025 01:38
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Comprehensive addition of Python SDK documentation across Stagehand's documentation, including quickstart guides, examples, and integration patterns.

  • Added new docs/examples/python.mdx with complete Python SDK usage, Pydantic integration, and data science workflows
  • Updated docs/get_started/quickstart.mdx with Python installation and basic setup instructions
  • Enhanced docs/get_started/introduction.mdx with parallel Python code examples alongside TypeScript
  • Added Python section to docs/integrations/guides.mdx with CrewAI integration details
  • Updated navigation structure in docs.json to include Python documentation under Playbooks

5 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile

import asyncio
import os
from stagehand import Stagehand, StagehandConfig
from dotenv import load_dotenv
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: python-dotenv is not listed in prerequisites or installation steps but is used in the example

Suggested change
from dotenv import load_dotenv
```bash
pip install stagehand python-dotenv

Comment on lines +275 to +276
if __name__ == "__main__":
main()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: main() is called without asyncio.run(), unlike other examples

Suggested change
if __name__ == "__main__":
main()
if __name__ == "__main__":
asyncio.run(main())

Copy link
Contributor

Choose a reason for hiding this comment

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

can you run agent async ?

Comment on lines +313 to +318

```python
import asyncio
from stagehand import Stagehand, StagehandConfig

async def robust_automation():
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: missing os import in error handling example but os.getenv is used

Suggested change
```python
import asyncio
from stagehand import Stagehand, StagehandConfig
async def robust_automation():
```python
import asyncio
import os
from stagehand import Stagehand, StagehandConfig
async def robust_automation():

Copy link
Contributor

Choose a reason for hiding this comment

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

ya needs this

await stagehand.close()

# Usage
df = await scrape_to_dataframe()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: calling scrape_to_dataframe() directly without asyncio.run()

Suggested change
df = await scrape_to_dataframe()
# Usage
# df = await scrape_to_dataframe() # This should be called within an async function
# Or use: df = asyncio.run(scrape_to_dataframe())

page = stagehand.page
await page.goto("https://github.com/browserbase/stagehand")

await page.get_by_role("link", name=r"Contributors \d+").click()
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: page.get_by_role expects parameter 'name' but the regex pattern uses raw string prefix r. Remove the r prefix

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