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

fix: make seaborn as an optional dependency #1500

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

ArslanSaleem
Copy link
Collaborator

@ArslanSaleem ArslanSaleem commented Jan 2, 2025

Important

Make seaborn and yaml optional dependencies by conditionally importing them in optional.py and dataframe_serializer.py.

  • Dependencies:
    • Make seaborn optional by moving RestrictedSeaborn import inside a conditional block in optional.py.
    • Make yaml optional by moving its import inside convert_df_to_yml() in dataframe_serializer.py.
  • Environment Setup:
    • Update get_environment() in optional.py to import RestrictedSeaborn only if seaborn is in additional_deps.

This description was created by Ellipsis for 97ed179. It will automatically update as commits are pushed.

@ArslanSaleem ArslanSaleem requested a review from gventuri January 2, 2025 14:05
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 2, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 06b8fbc in 15 seconds

More details
  • Looked at 46 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. pandasai/helpers/dataframe_serializer.py:162
  • Draft comment:
    Move the import statement to the top of the function to follow the convention of placing imports at the beginning of the file or function.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import of the 'yaml' module inside the function 'convert_df_to_yml' is correct for making it an optional dependency. However, the import statement should be at the top of the function to follow the convention of placing imports at the beginning of the file or function.
2. pandasai/helpers/dataframe_serializer.py:162
  • Draft comment:
    Consider moving the import yaml statement to the top of the file for consistency and clarity, unless there's a specific reason to import it locally. This applies to other similar cases in the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for yaml in convert_df_to_yml should be at the top of the file for consistency and clarity, unless there's a specific reason to import it locally.

Workflow ID: wflow_zX7ZIV38avuK5KMU


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 97ed179 in 10 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_FMnzAmY5xDMuwuTq


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.62%. Comparing base (daf5696) to head (97ed179).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pandasai/helpers/optional.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1500      +/-   ##
==========================================
+ Coverage   78.57%   78.62%   +0.05%     
==========================================
  Files         158      157       -1     
  Lines        6323     6311      -12     
==========================================
- Hits         4968     4962       -6     
+ Misses       1355     1349       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gventuri gventuri merged commit 63df017 into main Jan 2, 2025
10 of 11 checks passed
gventuri added a commit that referenced this pull request Jan 8, 2025
* fix: fixed duplicate export dynamics (#1399)

* chore: minor updates in the README (#1400)

* docs: update library.mdx (#1406)

Add 's' in the end of keyword "clarification_question"

agent.clarification_question('What is the GDP of the United States?')

* fix[#1415]: using torch 2.2.0 in macOS x86_64 (#1417)

* Add /app to PYTHONPATH

* fix for issue #1415

---------

Co-authored-by: Giuseppe Coco <giuseppe.coco@besharp.it>

* chore: add /app to PYTHONPATH (#1416)

Co-authored-by: Giuseppe Coco <giuseppe.coco@besharp.it>

* docs: update llms.mdx (#1410)

Add documentation of how to use pandasai.json file

* fix[output_format]: accept dataframe dict as output and secure sql qu… (#1432)

* fix[output_format]: accept dataframe dict as output and secure sql query execution

* fix: ruff errors

* chore[Security]: restrict libs to allow specific functionalities (#1429)

* chore[Security]: restrict libs to allow specific functionalities

* remove: extra lib handling

* fix: ruff errors

* fix: error message for bad import

* fix: add io library in the blacklist

* docs: update docs about customer whitelisted dependencies

* Release v2.4.0

* fix: update last_code_generated in smart_dataframe's __init__.py (#1484)

In SmartDataframe class the last_code_generated property returned _agent.last_code_executed instead of _agent.last_code_generated. In SmartDatalake it is implemented properly.

Co-authored-by: Bence Kecskés <bence.public@outlook.hu>

* Release v2.4.1

* fix: docker-compose-npm-error (#1486)

-Simplified the type of children to just React.ReactNode, which is the standard type for React components' children prop.

* fix: remove plt.show if exists in the generated code (#1501)

* fix: make seaborn as an optional dependency (#1500)

* fix: make seaborn as an optional dependency

* fix: linting errors

* fix: check if whitelisted lib is actually exists in the additional deps (#1499)

* feat(security): add security config to disable it (#1498)

* feat(security): add security config to disable it

* fix: linting errors

* fix(safety): push exact match for get attributes

* add additional test case

* fix: test case

* fix:  linting errors

* fix: linting errors

* docs(config): update config doc to add new config attribute

* Release v2.4.2

* fix(test_cases): handle and clean test cases of pandasai

* ruff changes

* add poetry lock file

* fix github ci workflow

* fix: extension deps installation

* fix: github workflows

* fix: unnecessary comments

* fix: ruff errors

* fix: ruff errors

* fix: typos

* fix ci yml file

* fix: ci

* fix make file for hardcoded env

* fix make file for hardcoded env

* fix make file for hardcoded env

* fix make file for hardcoded env

* fix: imports in extensions

* fix(testcases): extension test cases fixed

* fix: ci clear cache and suggested improvements

* clean up before running CI

* fix ci pipeline

* fix ci pipeline

* fix ci pipeline

* fix ci pipeline

* fix ci pipeline

* fix: ci

* fix: ci

* fix: ci

* fix github bug

* fix: CI

* fix: CI

* fix: test case on windows

* fix: test case on windows

* fix: test case on windows

* fix: test case on windows

* fix: CI

* feat(biqquery): add test cases for big query connector

* fix env issue of pandas not found

* fix: ci use pyproject

* fix: lock file

---------

Co-authored-by: AlessandroMarc <52158784+AlessandroMarc@users.noreply.github.com>
Co-authored-by: Smoothengineer <160827599+Smoothengineer@users.noreply.github.com>
Co-authored-by: Muhammad Adam <118662764+Muhammad-Adam1@users.noreply.github.com>
Co-authored-by: giuseppe-coco <76009241+giuseppe-coco@users.noreply.github.com>
Co-authored-by: Giuseppe Coco <giuseppe.coco@besharp.it>
Co-authored-by: Gabriele Venturi <lele.venturi@gmail.com>
Co-authored-by: bencekecskes <bence.most@outlook.hu>
Co-authored-by: Bence Kecskés <bence.public@outlook.hu>
Co-authored-by: Charis Nikolaidis <Ncharis97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants