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

Chore/refactor wes models #26

Merged
merged 3 commits into from
Sep 10, 2024
Merged

Conversation

SalihuDickson
Copy link

@SalihuDickson SalihuDickson commented Sep 10, 2024

Summary by Sourcery

Refactor TES and WES converters to utilize Pydantic models for improved validation and conversion. Enhance the CLI and CI workflow for better consistency and coverage. Introduce unit tests for WRROC models and validators, and add a Lefthook configuration for pre-push linting automation.

Enhancements:

  • Refactor TES and WES converters to use Pydantic models for data validation and conversion, improving code readability and error handling.
  • Update the CLI to use double quotes for consistency and improve readability.
  • Add a new utility function to convert datetime objects to RFC 3339 format.
  • Refactor the CI workflow to use the latest versions of GitHub Actions and ensure tests are run on all branches.

CI:

  • Modify the CI workflow to run on all branches instead of just the main branch, and update the GitHub Actions versions to the latest.

Tests:

  • Add unit tests for WRROC models and validators to ensure data validation and conversion processes are functioning correctly.

Chores:

  • Add a Lefthook configuration file to automate pre-push checks using Ruff for linting.

Copy link

sourcery-ai bot commented Sep 10, 2024

Reviewer's Guide by Sourcery

This pull request refactors the WES and TES models, introduces new WRROC models, and updates the converters and validators accordingly. It also includes improvements to the CI workflow and adds a pre-push hook for linting.

File-Level Changes

Change Details Files
Refactored and expanded TES and WES models
  • Created new TES models with detailed attributes and validations
  • Created new WES models with detailed attributes and validations
  • Added type hints and docstrings to model classes
crategen/models/tes_models.py
crategen/models/wes_models.py
Introduced new WRROC models
  • Created base WRROC model and specific models for TES and WES conversions
  • Added WRROC Process, Workflow, and Provenance models
  • Implemented Pydantic models with field validations
crategen/models/wrroc_models.py
Updated TES and WES converters
  • Refactored convert_to_wrroc and convert_from_wrroc methods
  • Implemented stricter type checking and error handling
  • Updated converters to use new model classes
crategen/converters/tes_converter.py
crategen/converters/wes_converter.py
Added new validators for WRROC data
  • Implemented validate_wrroc function to determine WRROC profile
  • Created specific validators for TES and WES conversions
  • Added URL validation for WES conversion
crategen/validators.py
Updated CI workflow
  • Updated Python and action versions
  • Added test running step
  • Improved conditional execution of steps
.github/workflows/ci.yml
Added pre-push hook for linting
  • Configured Lefthook to run Ruff linter before push
  • Set up linting only for changed Python files
lefthook.yml
Minor updates to utility functions and CLI
  • Added convert_to_rfc3339_format function
  • Updated imports and formatting in CLI file
crategen/utils.py
crategen/cli.py
Added unit tests for WRROC models
  • Implemented tests for WRROCProcess, WRROCWorkflow, and WRROCProvenance models
  • Added tests for WRROC validators
tests/unit/test_wrroc_models.py

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.

@SalihuDickson SalihuDickson changed the base branch from main to models September 10, 2024 22:59
@SalihuDickson SalihuDickson merged commit 71b1143 into models Sep 10, 2024
1 check failed
@SalihuDickson SalihuDickson deleted the chore/refactor-wes-models branch September 10, 2024 22:59
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