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

Refactor common tasks to a base class #345

Open
gadomski opened this issue Aug 8, 2022 · 0 comments
Open

Refactor common tasks to a base class #345

gadomski opened this issue Aug 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@gadomski
Copy link
Member

gadomski commented Aug 8, 2022

stactools is a swiss-army knife of a software library, where each operation has its own module in stactools.core, e.g. stactools.core.add_raster, stactools.core.copy, as well as a corresponding command line interface in stactools.cli. There are some commonalities in functionality that could be abstracted up into some sort of base class or utility module to reduce the amount of duplication between operations and ensure a common Python and command-line API.

One possibility is a Task class, possibly modeled after a draft implementation in cirrus-lib: https://github.com/cirrus-geo/cirrus-lib/blob/f6a6dd01d4cd647ce87c681ed53d5c15e0c44a58/src/cirrus/lib/task.py. This task class operates in a "STAC in, STAC out" model, where the input is a STAC object augmented with additional metadata to parameterize task execution. The output is a STAC object. This model provides hooks for defining what the task does, and comes "batteries included" with a CLI builder, logging, etc.

By refactoring stactools to use a Task-like base class, we could reduce code duplication, align the APIs for the myraid of functions available in the library, and make it easier for contributors to add new functionality.

@gadomski gadomski added the enhancement New feature or request label Aug 8, 2022
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

No branches or pull requests

1 participant