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: initial directories creating #698

Merged
merged 1 commit into from
Oct 29, 2023

Conversation

nautics889
Copy link
Contributor

@nautics889 nautics889 commented Oct 29, 2023

This PR relates to #654.

  1. Replace an order of calling of .initiliaze() and ._load_config() methods. This allows the config object to be used in a scope of .initialize(), and 'config first' approach looks more correct.
  2. Add clauses in .initialize(): create directories for charts only if "save_charts" is passed as True. Same for cache as well.
  3. Update tests accordingly.

  • (fix): do not create directory for charts exporting if 'save_charts' is False
  • (fix): do not create directory for cache files if 'enable_cache' is False as well
  • (test): update tests accordingly

Summary by CodeRabbit

  • New Feature: Enhanced the SmartDatalake class to conditionally create directories for saving charts and enabling cache based on user preferences. This change provides more flexibility and control to the user.
  • Test: Added a new test case to verify the conditional creation of directories in the SmartDatalake class. This ensures the robustness of the new feature.

* (fix): do not create directory for charts exporting if 'save_charts'
  is False
* (fix): do not create directory for cache files if 'enable_cache' is
  False as well
* (test): update tests accordingly
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2023

Walkthrough

The recent changes primarily focus on enhancing the SmartDatalake class's initialize() method. The modifications make the creation of exports/charts and cache directories conditional, based on save_charts and enable_cache options respectively. Additionally, a new test case test_initialize has been introduced in tests/test_smartdatalake.py to verify these changes.

Changes

File Path Summary
pandasai/.../__init__.py The initialize() method of the SmartDatalake class has been updated. The creation of exports/charts and cache directories is now conditional, based on save_charts and enable_cache options.
tests/.../test_smartdatalake.py A new test case test_initialize has been added. This test case checks the behavior of the initialize method in the SmartDatalake class based on save_charts and enable_cache parameters.

🐇💻

In the land of code, where the smart data lake lies,

Changes have been made, under the cloudless skies.

Directories are born, when conditions are met,

A test case to check, lest we forget.

Celebrate the changes, for they are here,

Making our code, crystal clear. 🎉🥕


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2023

Codecov Report

Merging #698 (8bab687) into main (cbed878) will increase coverage by 0.00%.
The diff coverage is 69.23%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##             main     #698   +/-   ##
=======================================
  Coverage   85.16%   85.17%           
=======================================
  Files          70       70           
  Lines        3552     3554    +2     
=======================================
+ Hits         3025     3027    +2     
  Misses        527      527           
Files Coverage Δ
pandasai/smart_datalake/__init__.py 93.40% <69.23%> (+0.03%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@nautics889 nautics889 marked this pull request as ready for review October 29, 2023 12:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cbed878 and 8bab687.
Files selected for processing (2)
  • pandasai/smart_datalake/init.py (2 hunks)
  • tests/test_smartdatalake.py (1 hunks)
Files skipped from review due to trivial changes (2)
  • pandasai/smart_datalake/init.py
  • tests/test_smartdatalake.py

@gventuri
Copy link
Collaborator

Thanks a lot for the fix @nautics889, merging!

@gventuri gventuri merged commit b91c121 into Sinaptik-AI:main Oct 29, 2023
9 checks passed
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.

Disable to create folders for exports and caches
3 participants