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

Feature/load local content #24

Merged
merged 18 commits into from
Jan 30, 2025
Merged

Feature/load local content #24

merged 18 commits into from
Jan 30, 2025

Conversation

wvenialbo
Copy link
Owner

@wvenialbo wvenialbo commented Jan 30, 2025

Summary by Sourcery

Add support for local data sources by introducing the DatasourceLocal class, enabling the handling of local files and directories. Update test functions to include testing for local data sources and adjust the Python version requirement to 3.9. Enhance package configuration to include new package data.

New Features:

  • Introduce the DatasourceLocal class to handle local-based data sources, allowing interaction with local folders and files.

Enhancements:

  • Update the test functions to include a new test for downloading GOES-16 data using the local datasource.

Build:

  • Update the Python version requirement to 3.9 in the pyproject.toml file.
  • Add package data for GOES_DL in the pyproject.toml file.

wvenialbo and others added 18 commits January 11, 2025 18:32
Update file exclusion pattern for egg-info folders.
Clarify error message for existing path in create_directory method of
the FileRepository class.
Correct error message formatting in FileRepository.
Update Python version and pylint configuration.
Update Develop chore commits
Remove redundant type annotations for improved readability. These types
can be inferred by the linters and type checkers.
Change return type of `Downloader.get_files()` to None.
Update Python requirement to 3.9 and add package data for type hints.
Copy link

sourcery-ai bot commented Jan 30, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new feature to support local data sources by adding the DatasourceLocal class. It updates test functions to include local data source testing, refactors downloader methods for clarity, improves error handling in file repository utilities, and updates project configuration to support Python 3.9 and include type information.

Sequence diagram for local file retrieval process

sequenceDiagram
    participant C as Client
    participant DL as DatasourceLocal
    participant FR as FileRepository
    participant R as Repository

    C->>DL: download_file(file_path)
    DL->>FR: read_file(file_path)
    FR-->>DL: file content (bytes)
    DL->>R: add_item(file_path, content)
    DL-->>C: DownloadStatus
Loading

Class diagram showing the new DatasourceLocal and its relationships

classDiagram
    class DatasourceBase {
        +download_file(file_path: str) DownloadStatus
        +listdir(dir_path: str) list[str]
    }
    class DatasourceLocal {
        +source: FileRepository
        +download_file(file_path: str) DownloadStatus
        +listdir(dir_path: str) list[str]
        -_retrieve_file(file_path: str) bytes
    }
    class FileRepository {
        +base_directory: Path
        +create_directory(directory: str|Path)
        +delete_directory(directory: str|Path)
        +list_files(directory: str|Path) list[str]
        +read_file(file_path: str|Path) bytes
    }
    DatasourceBase <|-- DatasourceLocal
    DatasourceLocal *-- FileRepository : uses
    note for DatasourceLocal "New class for handling local data sources"
Loading

File-Level Changes

Change Details Files
Added support for local data sources by introducing the DatasourceLocal class.
  • Created a new class DatasourceLocal to handle local-based data sources.
  • Implemented methods for downloading files and listing directory contents in DatasourceLocal.
  • Added error handling for file retrieval in DatasourceLocal.
src/GOES_DL/datasource/datasource_local.py
src/GOES_DL/datasource/__init__.py
test.py
Updated test functions to include local data source testing.
  • Modified test functions to test the downloader with local data sources.
  • Added a new test function test_goes3 for testing GOES-16 data with local datasource.
test.py
Refactored downloader methods to improve code clarity and remove unnecessary return values.
  • Removed type annotations from local variables in downloader methods.
  • Removed return statement from get_files method as it no longer returns a list of file paths.
src/GOES_DL/downloader/downloader.py
Improved error messages and handling in file repository utilities.
  • Updated error messages in create_directory to reflect object existence rather than directory existence.
  • Separated NotADirectoryError and FileNotFoundError in list_files method for better error specificity.
src/GOES_DL/utils/file_repository.py
Updated project configuration to support Python 3.9 and include type information.
  • Changed the required Python version to 3.9 in pyproject.toml.
  • Included py.typed files in the package data to support type checking.
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

deepsource-io bot commented Jan 30, 2025

Here's the code health analysis summary for commits 5fe3a2d..c936ec8. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython❌ Failure
❗ 1 occurence introduced
🎯 6 occurences resolved
View Check ↗
DeepSource Test coverage LogoTest coverage⚠️ Artifact not reportedTimed out: Artifact was never reportedView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@wvenialbo wvenialbo self-assigned this Jan 30, 2025
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 @wvenialbo - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The docstring for get_files() still indicates it returns list[str] but the function now returns None. Please update the docstring to reflect this breaking change.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 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 and I'll use the feedback to improve your reviews.

@wvenialbo wvenialbo merged commit 78a595d into develop Jan 30, 2025
64 of 66 checks passed
@wvenialbo wvenialbo deleted the feature/load-local-content branch January 30, 2025 14:49
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.

1 participant