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

Develop #27

Merged
merged 144 commits into from
Jan 30, 2025
Merged

Develop #27

merged 144 commits into from
Jan 30, 2025

Conversation

wvenialbo
Copy link
Owner

@wvenialbo wvenialbo commented Jan 30, 2025

Summary by Sourcery

Refactor the library and add support for local datasources.

New Features:

  • Add support for local datasources.

Tests:

  • Update tests to use the new API.

wvenialbo and others added 30 commits October 23, 2024 22:52
Remove .pylintrc dependency
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.
Tunning pylint workflow, first try.
Tunning pylint workflow, second try.
Scoping to version 3.12 only before testing bacward compatibitlity.
Update Python version and pylint configuration.
Update Python version and pylint configuration.
Update Develop chore commits
Update settings for GitHub Copilot and file exclusions.
Correct error message formatting in FileRepository, remove unnecessary
string concatenation.
Update test functions to return lists of downloaded files.
Add new class GOESProductLocatorABINSO. Replace GOESProductLocatorABI
with GOESProductLocatorABINSO in locators GOESProductLocatorABIPM and
GOESProductLocatorABIDP as their base class. Remove duplicated code.
Rename product name constants for clarity.
Remove duplicate code in the AWS and HTTP data sources.
Temporarily disable invalid-name and fixme checks.
Add support for Python 3.8 in pylint workflow.
Remove Python 3.8 from the CI matrix.
Add support for Python 3.13 in pylint workflow. Remove Python 3.13 to
the CI matrix.
Update pylint command to use double quotes for consistency.
Rename Pylint workflow to Bandit and update analysis command.
wvenialbo and others added 23 commits January 30, 2025 16:36
The package directory is renamed from `GOES_DL` to `goesdl` to
be compliant with the Python package naming convention.
Copy link

sourcery-ai bot commented Jan 30, 2025

Reviewer's Guide by Sourcery

This pull request refactors the GOES-DL library to improve its modularity and flexibility. It introduces a new local datasource, removes the repository from the datasource, and modifies the downloader to use a repository object. Additionally, it updates the test suite to reflect these changes.

Class diagram showing the updated datasource hierarchy

classDiagram
    class Datasource {
        <<abstract>>
        +base_url: str
        +download_file(file_path: str) bytes
        +list_files(dir_path: str) list[str]
    }
    class DatasourceBase {
        +cache: DatasourceCache
    }
    class DatasourceAWS {
        +bucket_name: str
        +s3_client: S3Client
        +download_file(file_path: str) bytes
        +list_files(dir_path: str) list[str]
    }
    class DatasourceHTTP {
        +download_file(file_path: str) bytes
        +list_files(dir_path: str) list[str]
    }
    class DatasourceLocal {
        +source: FileRepository
        +download_file(file_path: str) bytes
        +list_files(dir_path: str) list[str]
    }
    Datasource <|-- DatasourceBase
    DatasourceBase <|-- DatasourceAWS
    DatasourceBase <|-- DatasourceHTTP
    DatasourceBase <|-- DatasourceLocal
    note for DatasourceBase "Base class with cache support"
    note for DatasourceLocal "New class for local files"
Loading

Class diagram showing the new Downloader structure

classDiagram
    class DownloaderBase {
        +datasource: Datasource
        +locator: ProductLocator
        +repository: FileRepository
        +download_files(start: str, end: str) list[str]
        +list_files(start: str, end: str) list[str]
        +get_files(file_paths: list[str]) list[str]
    }
    class Downloader {
        +__init__(datasource, locator, repository, date_format, time_tolerance, show_progress)
    }
    DownloaderBase <|-- Downloader
    note for Downloader "Repository moved from datasource to downloader"
Loading

File-Level Changes

Change Details Files
Refactor datasources to remove repository dependency
  • Removed the repository parameter from the datasource constructors.
  • Datasources no longer manage the repository.
  • Added a new DatasourceLocal class for local file access.
src/goesdl/datasource/datasource_aws.py
src/goesdl/datasource/datasource_http.py
src/goesdl/datasource/datasource_base.py
src/goesdl/datasource/__init__.py
Modify downloader to use a repository object
  • The downloader now receives a repository object.
  • The downloader is now responsible for managing the repository.
src/goesdl/downloader/downloader_base.py
src/goesdl/downloader/downloader.py
Update test suite to reflect changes
  • Updated test functions to use the new datasource and downloader constructors.
  • Added tests for the new local datasource.
  • Modified test functions to return the list of downloaded files.
test.py
Update documentation and examples
  • Updated the README.md file to reflect the changes in the library.
  • Updated the examples to use the new datasource and downloader constructors.
README.md
examples/Download_GOES-R_dataset_es.ipynb
examples/Download_GridSat_B1_dataset_en.ipynb
General code improvements
  • Added type hints to improve code readability and maintainability.
  • Improved error handling and logging.
  • Refactored code to improve modularity and flexibility.
  • Fixed minor bugs and inconsistencies.
src/goesdl/utils/file_repository.py
src/goesdl/dataset/gridsat/locator.py
src/goesdl/dataset/base/locator_gg.py
src/goesdl/dataset/goes/locator.py
src/goesdl/utils/url.py
src/goesdl/datasource/datasource.py
src/goesdl/downloader/constants.py
src/goesdl/dataset/locator.py
src/goesdl/datasource/datasource_cache.py
src/goesdl/dataset/goes/locator_pp.py
src/goesdl/dataset/goes/locator_dc.py
src/goesdl/dataset/goes/locator_dp.py
src/goesdl/dataset/goes/locator_abi.py
src/goesdl/dataset/goes/locator_glm.py
src/goesdl/dataset/goes/locator_pm.py
src/goesdl/__init__.py
src/goesdl/dataset/goes/locator_nso.py

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 ff34e35..90161d5. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython❌ Failure
❗ 28 occurences introduced
🎯 23 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 merged commit f4717aa into main Jan 30, 2025
41 of 43 checks passed
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 and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 6 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 4 issues found
  • 🟢 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.

src/goesdl/datasource/datasource_aws.py Show resolved Hide resolved
src/goesdl/datasource/datasource_aws.py Show resolved Hide resolved
src/goesdl/datasource/datasource_aws.py Show resolved Hide resolved
src/goesdl/datasource/datasource_http.py Outdated Show resolved Hide resolved
.github/workflows/python-lint.yml Outdated Show resolved Hide resolved
test.py Outdated Show resolved Hide resolved
test.py Outdated Show resolved Hide resolved
test.py Outdated Show resolved Hide resolved
test.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
wvenialbo added a commit that referenced this pull request Jan 30, 2025
Merge pull request #27 from wvenialbo/develop
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