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

CICD: Add set -e -o pipefail to ruff and mypy. #399

Merged
merged 8 commits into from
Feb 5, 2024

Conversation

gao-hongnan
Copy link
Contributor

@gao-hongnan gao-hongnan commented Feb 5, 2024

Fixes a bug I've missed out earlier that shows failure in logs but does not fail the full CI check in GitHub action because of not adding pipefail. So if a chain of command cmd1 | cmd 2 | cmd3 fails at cmd1, the full command may still pass.

Now with adding the set -e -o pipefail, if any command in a pipeline fails, the pipeline will return a failure status.

I also synced up remote CI with local pre-commit hooks, in particular on mypy since @savarin is actively introducing gradual typing to the instructor library.

In addition, I fixed a few small linting errors. Some are suppressed using noqa, for instance in line 117 in partialjson.py, e is unused but was not removed to keep the interface consistent with other parsing (design choice).

    def parse_string(self, s, e):

Ellipsis 🚀 This PR description was created by Ellipsis for commit e77c5f6.

Summary:

This PR enhances the CI/CD pipeline by ensuring pipeline failure upon any command failure and includes minor linting fixes.

Key points:

  • Added set -e -o pipefail to mypy and ruff workflows in /.github/workflows/mypy.yml and /.github/workflows/ruff.yml.
  • Fixed minor linting issues in /examples/partial_streaming/benchmark.py, /instructor/dsl/iterable.py, /instructor/dsl/partialjson.py, and /instructor/patch.py.

Generated with ❤️ by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested.


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

@@ -36,10 +36,12 @@ jobs:
python3 -m pip install -r requirements.txt
- name: Run Continuous Integration Action
run: |
set -e -o pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on adding set -e -o pipefail to ensure the script fails if any command fails. However, please avoid suppressing linting errors using # noqa: ARG002, # noqa: ARG003, or # noqa: B007 in the code. Instead, please fix these linting errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SMOKED

@jxnl jxnl enabled auto-merge (squash) February 5, 2024 16:09
@jxnl jxnl merged commit 14ecf49 into instructor-ai:main Feb 5, 2024
6 of 7 checks passed
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.

2 participants