Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 16
Add MyPy static Type Checking#89
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2538aac
add mypy static type checking
smcguire-cmu 5a2ed73
fix type checking copier
smcguire-cmu e6b6ba0
add mypy checks to CI
smcguire-cmu 4a3d0d1
composite actions? (probably not gonna work)
smcguire-cmu 8bdebf7
Merge branch 'main' into sean/mypy-type-checking
smcguire-cmu 197c73d
change composite action (probably still not gonna work)
smcguire-cmu 23e3633
change composite action to a string (probably still not gonna work)
smcguire-cmu 6745986
revert composite action changes
smcguire-cmu d1f07c9
fix mypy action name
smcguire-cmu 78f51f9
revert mypy ci checks
smcguire-cmu 2f1f857
Merge remote-tracking branch 'origin/main' into sean/mypy-type-checking
smcguire-cmu 907a430
add type checking documentation
smcguire-cmu 0c6cfb7
Merge branch 'main' into sean/mypy-type-checking
smcguire-cmu d4de792
change if syntax for removing blank lines
smcguire-cmu 7846829
check tests in workflow
smcguire-cmu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35 ....github/workflows/{% if mypy_type_checking != 'none' %}type-checking.yml{% endif %}.jinja
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # This workflow will install Python dependencies, then perform static type checking analysis. | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
| name: mypy Type checking | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.10' | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| python -m pip install --upgrade pip | ||
| pip install . | ||
| pip install .[dev] | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Analyze code with mypy | ||
| {% if mypy_type_checking == 'basic' %} | ||
| run: | | ||
| mypy ./src ./tests --ignore-missing-imports | ||
| {% elif mypy_type_checking == 'strict' %} | ||
| run: | | ||
| mypy ./src ./tests --strict | ||
| {% endif %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -84,6 +84,25 @@ repos: | ||
| # pre-commit's default_language_version, see | ||
| # https://pre-commit.com/#top_level-default_language_version | ||
| language_version: python3.10 | ||
| {% endif %} | ||
| {% if mypy_type_checking != 'none' %} | ||
| # Analyze type hints and report errors. | ||
| - repo: local | ||
| hooks: | ||
| - id: mypy | ||
| name: mypy (python files in src/ and tests/) | ||
| entry: mypy | ||
| language: system | ||
| types: [python] | ||
| files: ^(src|tests)/ | ||
drewoldag marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| args: | ||
| [ | ||
| {% if mypy_type_checking == 'basic' %} | ||
| "--ignore-missing-imports", # Ignore imports without type hints | ||
| {% elif mypy_type_checking == 'strict' %} | ||
| "--strict", # Use mypy strict mode to enforce type hints | ||
| {% endif %} | ||
| ] | ||
| {% endif %} | ||
| - repo: local | ||
| hooks: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.