Skip to content

Commit

Permalink
Support optional pre-commit hooks (#1705)
Browse files Browse the repository at this point in the history
* optional pre-commit hooks

* add args
  • Loading branch information
juanitorduz committed Dec 23, 2023
1 parent f6a628a commit a6693bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: local
hooks:
- id: ruff
name: ruff
entry: ruff
args: ["--fix", "--show-source"]
files: "numpyro/.*|tests/.*"
language: system

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: debug-statements
- id: check-yaml
- id: check-added-large-files
15 changes: 14 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ pytest -vs {path_to_test}::{test_name}
JAX_PLATFORM_NAME=gpu JAX_ENABLE_X64=1 pytest -vs {path_to_test}::{test_name}
```

## Pre-Commit Hooks

For local development we recommend using [pre-commit](https://pre-commit.com/) hooks to automatically format your code before committing.

To install pre-commit hooks, run
```sh
pip install pre-commit
pre-commit install
```

After each commit, pre-commit will run and verify that your code is formatted correctly. The pre-commit hooks can be skipped by adding the `--no-verify` flag to your `git commit` command.


# Profiling

TensorBoard can be used to profile NumPyro following the instructions following [JAX documentation](https://jax.readthedocs.io/en/latest/profiling.html).
Expand All @@ -58,5 +71,5 @@ In your PR, please include:

If you add new files, please run `make license` to automatically add copyright headers.

For speculative changes meant for early-stage review, include `[WIP]` in the PR's title.
For speculative changes meant for early-stage review, include `[WIP]` in the PR's title.
(One of the maintainers will add the `WIP` tag.)

0 comments on commit a6693bb

Please sign in to comment.