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

✨ Allow the cli to be imported as module #55

Merged
merged 1 commit into from
Aug 18, 2024
Merged

✨ Allow the cli to be imported as module #55

merged 1 commit into from
Aug 18, 2024

Conversation

nikhilbadyal
Copy link
Owner

@nikhilbadyal nikhilbadyal commented Aug 18, 2024

Summary by Sourcery

Allow the CLI to be imported as a module by refactoring the EsXport class to handle ElasticsearchClient instantiation internally and updating import statements to use relative paths. Adjust test fixtures to accommodate these changes.

Enhancements:

  • Refactor the EsXport class to instantiate the ElasticsearchClient internally, simplifying the initialization process.
  • Update import statements to use relative imports for better modularity and maintainability.

Tests:

  • Modify test fixtures to patch the ElasticsearchClient within the EsXport class, ensuring tests are isolated from actual Elasticsearch connections.

@nikhilbadyal nikhilbadyal added the enhancement New feature or request label Aug 18, 2024
@nikhilbadyal nikhilbadyal self-assigned this Aug 18, 2024
Copy link

sourcery-ai bot commented Aug 18, 2024

Reviewer's Guide by Sourcery

This pull request modifies the esxport package to allow it to be imported as a module. The changes include restructuring imports, modifying the EsXport class initialization, updating the CLI implementation, and adjusting test fixtures. The main goal is to improve the package's modularity and make it easier to use as a library.

File-Level Changes

Files Changes
esxport/esxport.py
esxport/cli.py
esxport/elastic.py
esxport/click_opt/cli_options.py
esxport/click_opt/click_custom.py
Restructured imports to use relative imports within the package
esxport/esxport.py
esxport/cli.py
test/conftest.py
Modified EsXport class initialization to create ElasticsearchClient internally
esxport/__init__.py Updated init.py to expose CliOptions and EsXport classes
esxport/cli.py Adjusted CLI implementation to use the new EsXport initialization
test/conftest.py Updated test fixtures to patch ElasticsearchClient creation
esxport/esxport.py
esxport/elastic.py
esxport/click_opt/cli_options.py
esxport/click_opt/click_custom.py
Moved typing imports to runtime
test/click/cli_test.py Updated import path for cli in test file

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @nikhilbadyal - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

esxport/esxport.py Outdated Show resolved Hide resolved
@nikhilbadyal nikhilbadyal force-pushed the module branch 4 times, most recently from 39d5eeb to 2ea87a0 Compare August 18, 2024 17:26
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0809dfa) to head (f9a85d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #55   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          318       325    +7     
=========================================
+ Hits           318       325    +7     

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

@nikhilbadyal nikhilbadyal merged commit d93c96c into main Aug 18, 2024
9 checks passed
@nikhilbadyal nikhilbadyal deleted the module branch August 18, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant