Skip to content

Commit

Permalink
fix: make bs4 an optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
gventuri committed Oct 10, 2023
1 parent 720811f commit 89b6a1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pandasai/helpers/from_google_sheets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re

Expand All @@ -15,6 +14,14 @@ def get_google_sheet(src) -> list:
list: A 2D array representing content of the Google Sheet.
"""

try:
from bs4 import BeautifulSoup
except ImportError:
raise ImportError(
"Could not import beautifulsoup4 python package. "
"Please install it with `pip install beautifulsoup4`."
)

# The size of the Google sheet that can be read is limited
raw_html = requests.get(src).text

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ matplotlib = "^3.7.1"
pydantic = "^1"
sqlalchemy = "^1.4.49"
duckdb = "^0.8.1"
beautifulsoup4 = "^4.12.2"
beautifulsoup4 = {version="^4.12.2", optional = true}
google-generativeai = {version = "^0.1.0rc2", optional = true}
google-cloud-aiplatform = {version = "^1.26.1", optional = true}
langchain = {version = "^0.0.199", optional = true}
Expand Down

0 comments on commit 89b6a1a

Please sign in to comment.