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: Adding CLI functionality and Pre-Commit hook #62

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

stiebels
Copy link
Owner

@stiebels stiebels commented Oct 26, 2023

Fixes #59

Proposed Changes

This change introduces

  • sagemaker-rightline console script
  • A pre-commit hook running the CLI script
  • Improved ReadTheDocs setup & added documentation for CLI script and pre-commit hook

Console Script

The console script accepts a path to a py file that holds a get_configuration function. This function is expected to return a sagemaker_rightline.model.Configuration object. The configuration is then run and exits with 0 if all contained Validation objects show success=True and exits with 1 if at least one shows success=False.

Example usage:

General example:

pip install sagemaker-rightline
cd <your-project-directory>
sagemaker-rightline --configuration <relative-path-to-file-containing-get-configuration-function>.py

Try it out in the context of the sagemaker-rightline project example:

git clone git@github.com:stiebels/sagemaker-rightline.git
cd sagemaker-rightline
pip install -e .
cd sagemaker_rightline/examples/sm_pipeline_project
sagemaker-rightline --configuration sm_rightline_config.py
image

Pre-Commit hook

The pre-commit hook sagemaker-rightline runs the CLI script to validate your Configuration at git commit. Never commit a faulty pipeline again!

Using the pre-commit hook

repos:
- repo: https://github.com/stiebels/sagemaker-rightline@main
  hooks:
  - id: sagemaker-rightline
    name: sagemaker-rightline
    entry: sagemaker-rightline
    language: system
    types: [python]
    pass_filenames: false
    args: ['--configuration', '<relative-path-to-file-containing-get-configuration-function>.py']
image

ToDo's

  • Add documentation for the CLI script
  • Add documentation for the pre-commit hook

Maintenance

  • Updated tests
  • Updated documentation

@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c9c861) 99.53% compared to head (e661db8) 99.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
+ Coverage   99.53%   99.56%   +0.02%     
==========================================
  Files           4        5       +1     
  Lines         428      456      +28     
==========================================
+ Hits          426      454      +28     
  Misses          2        2              

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

@stiebels stiebels changed the title WIP: CLI functionality and precommit hook Feature: Adding CLI functionality and Pre-Commit hook Oct 28, 2023
@stiebels stiebels self-assigned this Oct 28, 2023
@stiebels stiebels added the feature New feature or request label Oct 28, 2023
@stiebels stiebels removed their assignment Oct 28, 2023
@stiebels stiebels marked this pull request as ready for review October 28, 2023 21:06
@stiebels stiebels added python Pull requests that update Python code github_actions Pull requests that update GitHub Actions code labels Oct 28, 2023
@stiebels stiebels self-assigned this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request github_actions Pull requests that update GitHub Actions code python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pre-commit hook for pipeline checks
1 participant