Skip to content

Commit

Permalink
Add Precommit Config and Issue Templates
Browse files Browse the repository at this point in the history
Signed-off-by: Kory Watson <[email protected]>
  • Loading branch information
kory committed Feb 28, 2024
1 parent 0959d7d commit 11b9063
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit = */test_*,*/test,*/test/*,build/*,src/customer/*,/private/*,/tmp/*

[report]
ignore_errors = True
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
ignore = E501,W503,E203,E266,E265,F811
# E501 line too long
# W503 clang-formatter can produce line break before binary operator
# E203 False positive "whitespaces before :" especially when slicing list, arrays etc.
# E266 Too many leading '#' for block comment
# E265 Block comment should start with '# '
# F811 A module has been imported twice, but seen when importing functions for fixtures in pytest files.
exclude = **/*_pb2.py
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] File bug report"
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Stack trace**
If applicable, add screenshots to help explain your problem.

**Host configuration:**
- OS and version: [e.g. Linux, Windows, macOS]
- Browser [e.g. chrome, safari]
- QAI-Hub-Models version:
- QAI-Hub client version:

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for QAI-Hub-Models
title: "[Feature Request] New feature request"
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/request-new-model-on-qai-hub-models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Request new model on QAI-Hub-Models
about: Request new model to be added on AI-Models
title: "[MODEL REQUEST] requesting new model"
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem.

**Details of model being requested**
- Model name:
- Source repo link:
- Research paper link [If applicable]:
- Model use case:

**Additional context for requested model**
Add any other context or screenshots about the feature request here.
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
/bench/
build/
dist/
demo_artifacts/
develop-eggs/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version
qaihm-dev

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Environments
.venv
env/
envs/
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

*build/*
*.onnx
*.mlmodelc*
*.pt
*.wav
*.npy
*.csv
*.dylib
*.fpie
*bin/ADSP_Inference_Test
*.DS_Store

# Hub exports
**/*.mlmodel
**/*.tflite

# Zoo Readmes (these are autogenerated)
qai_hub_models/**/README.md
# Hugging Face Model Cards (these are autogenerated)
qai_hub_models/**/HF_MODEL_CARD.md
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
known_first_party=qai_hub_models
79 changes: 79 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# exclude:
# * third_party folders
# * CloudFormation templates don't pass the yaml-check hook (a known issue)

exclude: |
(?x)(
/build/
)
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
files: \.py|\.sh$
args:
- --license-filepath
- .pre-commit-license-header.txt
- --use-current-year
- --allow-past-years
- --no-extra-eol
- id: insert-license
files: \.java$
args:
- --license-filepath
- .pre-commit-license-header.txt
- --comment-style
- //
- --use-current-year
- --allow-past-years
- --no-extra-eol

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: trailing-whitespace
exclude: '\.diff$'
- id: check-added-large-files
args: ['--maxkb=1024']
- id: check-merge-conflict
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: end-of-file-fixer
exclude: |
(?x)(
\.diff$
)
- id: fix-byte-order-marker
- repo: https://github.com/rhysd/actionlint
rev: v1.6.26
hooks:
- id: actionlint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--filter-files"]
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: local
hooks:
- id: mypy
name: mypy
files: \.(py|pyi|ipynb|proto|fbs)$
entry: scripts/util/run_mypy.sh
language: system
4 changes: 4 additions & 0 deletions .pre-commit-license-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---------------------------------------------------------------------
Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
---------------------------------------------------------------------
33 changes: 33 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## How to update these rules
##
## From repo root, `pre-commit run -a shellcheck` to run shellcheck across all files in the repo. By default, the commit hook
## will only run on your patch. However, CI runs it across all files, so if you're going to touch this file, I
## recommend forcing it to run.
##
## To run on and fix a specific file, run:
## shellcheck -x -f diff {filename} | apply
##

external-sources=true

## Issue 7533: [shellcheck] Explore miscellaneous checks
disable=SC2003 # expr is antiquated. Consider rewriting this using `$((..))`, `${}` or `[[ ]]`.
disable=SC2005 # Useless `echo`? Instead of `echo $(cmd)`, just use `cmd`
disable=SC2012 # Use `find` instead of `ls` to better handle non-alphanumeric filenames.
disable=SC2116 # Useless echo? Instead of `cmd $(echo foo)`, just use `cmd foo`.
disable=SC2155 # Declare and assign separately to avoid masking return values.
disable=SC2166 # Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined.


## things we probably don't care about ever fixing.

disable=SC1083 # This `{`/`}` is literal. Check if `;` is missing or quote the expression.

disable=SC2001 # See if you can use `${variable//search/replace}` instead.
disable=SC2064 # Use single quotes, otherwise this expands now rather than when signalled.
disable=SC2129 # Consider using `{ cmd1; cmd2; } >> file` instead of individual redirects.
disable=SC2143 # Use `grep -q` instead of comparing output with `[ -n .. ]`.
disable=SC2148 # Tips depend on target shell and yours is unknown. Add a shebang.
disable=SC2162 # `read` without `-r` will mangle backslashes.
disable=SC2164 # Use `cd ... || exit` in case `cd` fails.
disable=SC2181 # Check exit code directly with e.g. `if mycmd;`, not indirectly with `$?`.

0 comments on commit 11b9063

Please sign in to comment.