Skip to content

Commit

Permalink
[DEVOPS-1591] Install pre-commit, and fix all files (#12)
Browse files Browse the repository at this point in the history
Install pre-commit, and fix all files
  • Loading branch information
robwittman authored Jul 12, 2023
1 parent bbc288b commit ed3b10e
Show file tree
Hide file tree
Showing 50 changed files with 74 additions and 24 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,24 @@ jobs:
VALIDATE_BASH_EXEC: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_YAML: true

run-hooks:
name: Run pre-commit hooks
runs-on: ubuntu-22.04

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Install pre-commit
run: |
pip install --upgrade pip
pip install --upgrade pre-commit
- name: Run pre-commit hooks ✅
run: pre-commit run --all-files --hook-stage manual
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
args: ["-x"]

- repo: https://github.com/hadolint/hadolint.git
rev: v2.12.1-beta
hooks:
- id: hadolint-docker
entry: hadolint/hadolint:v2.12.1-beta hadolint

# Lint: YAML
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint
args: [ "-d {extends: relaxed, rules: {line-length: disable}}", "-s" ]
files: \.(yaml|yml)$
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ We welcome many different types of contributions including:
To begin contributing changes to notebook kernels, you'll need to setup your local environment

### Requirements
- `python`: Version depending on which kernels being built
- `docker`: For building and testing images
- `python`: Version depending on which kernels being built
- `docker`: For building and testing images

### Setup
```shell
### Setup
```shell
git clone [email protected]:noteable-io/kernels
cd kernels/$kernel/
# Make proposed edits as needed
cd kernels/$kernel/
# Make proposed edits as needed
docker buildx bake <target>
```

Expand All @@ -63,4 +63,4 @@ before you submit your code:
- [ ] I am able to build images locally
- [ ] Has the issue it resolves been discussed with maintainers?

**Note**: This checklist is also part of the pull request template for this project
**Note**: This checklist is also part of the pull request template for this project
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Empty file modified R/Aptfile
100755 → 100644
Empty file.
Empty file modified R/base/4.3.0/Dockerfile
100755 → 100644
Empty file.
18 changes: 9 additions & 9 deletions R/noteable/.Rprofile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ library(repr)
library(reticulate)

prepare_dex_content <- function(df) {
#'
#'
#' Create schema and data structure for data frame to be rendered by DEX
#'
#'

# create a schema for a dataframe, which DEX uses to determine column dtypes.
# R data frames don't have this functionality, so we have to use reticulate
# R data frames don't have this functionality, so we have to use reticulate
# to call into the python pandas library
pandas <- import("pandas")

Expand Down Expand Up @@ -41,9 +41,9 @@ prepare_dex_content <- function(df) {
}

prepare_dex_metadata <- function(df) {
#'
#'
#' Create metadata for data frame to be rendered by DEX
#'
#'
list(
default_index_used=TRUE,
dataframe_info = list(
Expand Down Expand Up @@ -72,11 +72,11 @@ repr_dex <- function(obj, ...) {
enable_dex_formatter <- function() {
# Add custom display formatter to newly added mimetype
IRkernel:::replace_in_package('repr', 'mime2repr', c(repr::mime2repr, list(`application/vnd.dataresource+json` = repr_dex)))

# Add dataresource mimetype to list of recognized mimetypes
mimetypes <- c(getOption('jupyter.display_mimetypes'), "application/vnd.dataresource+json")
options(jupyter.display_mimetypes = mimetypes)

# Register custom formatter for matrix and data.frame
registerS3method("repr_html", "matrix", repr_dex)
registerS3method("repr_html", "data.frame", repr_dex)
Expand All @@ -85,11 +85,11 @@ enable_dex_formatter <- function() {
disable_dex_formatter <- function() {
# Remove custom display formatter
IRkernel:::replace_in_package('repr', 'mime2repr', repr::mime2repr)

# Remove dataresource mimetype from list of recognized mimetypes
mimetypes <- setdiff(getOption('jupyter.display_mimetypes'), "application/vnd.dataresource+json")
options(jupyter.display_mimetypes = mimetypes)

# Reset the formatter for matrix and data.frame to the default
registerS3method("repr_html", "matrix", repr:::repr_html.matrix)
registerS3method("repr_html", "data.frame", repr:::repr_html.data.frame)
Expand Down
Empty file modified R/noteable/requirements.R
100755 → 100644
Empty file.
Empty file modified python/Aptfile
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.10/3.10.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.10/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.11/3.11.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.11/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.9/3.9.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base-gpu/3.9/Dockerfile
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion python/base-gpu/environment.txt
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
conda-forge::cudatoolkit=11.7.0
nvidia::cuda-nvcc=11.3.58
nvidia::cuda-nvcc=11.3.58
2 changes: 1 addition & 1 deletion python/base-gpu/initial-condarc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
auto_update_conda: false
show_channel_urls: true
channels:
- conda-forge
- conda-forge
2 changes: 1 addition & 1 deletion python/base-gpu/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ echo "Starting Python kernel"
# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP
export PYTHONSTARTUP=~/.pythonrc

mamba run python -m ipykernel_launcher -f ${connection_file} --debug
mamba run python -m ipykernel_launcher -f ${connection_file} --debug
Empty file modified python/base/3.10/3.10.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base/3.10/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/base/3.11/3.11.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base/3.11/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/base/3.9/3.9.requirements.in
100755 → 100644
Empty file.
Empty file modified python/base/3.9/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/base/Aptfile
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion python/base/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ipykernel==6.23.3
ipykernel==6.23.3
Empty file modified python/datascience/3.10/3.10.gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.10/3.10.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.10/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/datascience/3.11/3.11.gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.11/3.11.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.11/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/datascience/3.9/3.9.gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.9/3.9.requirements.in
100755 → 100644
Empty file.
Empty file modified python/datascience/3.9/Dockerfile
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion python/datascience/gpu.requirements.in
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tensorflow==2.12.*
torch==2.*
torchvision==0.15.*
torchaudio==2.*
fastai
fastai
Empty file modified python/datascience/requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/.pythonrc
100755 → 100644
Empty file.
Empty file modified python/noteable/3.10/3.10.gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/3.10/3.10.requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/3.10/Dockerfile
100755 → 100644
Empty file.
Empty file modified python/noteable/3.9/3.9.gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/3.9/3.9.requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/3.9/Dockerfile
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion python/noteable/git_credential_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def main(stdin=sys.stdin, stdout=sys.stdout):


if __name__ == "__main__":
main()
main()
Empty file modified python/noteable/gpu.requirements.in
100755 → 100644
Empty file.
Empty file modified python/noteable/ipython_config.py
100755 → 100644
Empty file.
Empty file modified python/noteable/requirements.in
100755 → 100644
Empty file.
Empty file modified scripts/secrets_helper.sh
100644 → 100755
Empty file.

0 comments on commit ed3b10e

Please sign in to comment.