Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/hamilton-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ jobs:
activate-environment: true

# It's enough to do it on single OS
- name: Check linting with pre-commit
- name: Check linting with prek
if: ${{ runner.os == 'Linux' }}
run: |
uv sync --dev
uv run pre-commit install
uv run pre-commit run --all-files
uv run prek install
uv run prek run --all-files

- name: Check for missing Apache 2 license headers
if: ${{ runner.os == 'Linux' }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pre-commit hooks require a user to have installed `pre-commit`:
# $ brew install pre-commit
# pre-commit hooks require a user to have installed `prek`:
# $ brew install prek
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
# $ pre-commit install
# $ prek install
exclude: '^docs/code-comparisons/' # skip the code comparisons directory
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand All @@ -16,7 +16,7 @@ repos:
- id: ruff-format
# args: [ --diff ] # Use for previewing changes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
Expand Down
2 changes: 1 addition & 1 deletion dev_tools/language_server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies = [

[project.optional-dependencies]
test = [
"pre-commit",
"prek",
"pytest",
]

Expand Down
12 changes: 6 additions & 6 deletions docs/how-tos/pre-commit-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Note that it's different from testing, which focuses on the behavior of the code
## Add pre-commit hooks to your project
Hooks are a mechanism of the `git` version control system. You can find your project's hooks under the `.git/hooks` directory (it might be hidden by default). There should be many files with the `.sample` extension that serve as example scripts.

The preferred way of working with pre-commit hooks is through the [pre-commit](https://pre-commit.com/) Python library. This library allows you to import and configure hooks for your repository with a `.pre-commit-config.yaml` file.
The preferred way of working with pre-commit hooks is through the [prek](https://github.com/j178/prek/) library. This library allows you to import and configure hooks for your repository with a `.pre-commit-config.yaml` file.

### Steps to get started
1. install the pre-commit library
1. install the prek library
```python
pip install pre-commit
pip install prek
```

2. add a `.pre-commit-config.yaml` to your repository
Expand All @@ -44,7 +44,7 @@ The preferred way of working with pre-commit hooks is through the [pre-commit](h
repos:
# repository with hook definitions
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0 # release version of the repo
rev: v6.0.0 # release version of the repo
hooks: # list of hooks from the repo to include in this project
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -60,13 +60,13 @@ The preferred way of working with pre-commit hooks is through the [pre-commit](h

3. install the hooks defined in `.pre-commit-config.yaml`
```console
pre-commit install
prek install
```
Now, hooks will automatically run on `git commit`

4. to manually run hooks
```console
pre-commit run --all-files
prek run --all-files
```

## Custom Apache Hamilton pre-commit hooks
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ visualization = ["graphviz", "networkx"]

[dependency-groups]
dev = [
"pre-commit",
"prek",
"ruff==0.5.7", # this should match `.pre-commit-config.yaml`
]
test = [
Expand Down Expand Up @@ -157,7 +157,7 @@ docs = [
"pyarrow >= 1.0.0",
"pydantic >=2.0",
"pyspark",
"openlineage-python",
"openlineage-python",
"PyYAML",
"ray",
"readthedocs-sphinx-ext<2.3", # read the docs pins
Expand Down
2 changes: 1 addition & 1 deletion ui/sdk/.github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python -m pip install -r requirements-dev.txt
- name: Run pre-commit hooks
run: |
pre-commit run --all-files
prek run --all-files
- name: Test with pytest
run: |
pip install -r requirements-test.txt
Expand Down
10 changes: 5 additions & 5 deletions ui/sdk/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pre-commit hooks require a user to have installed `pre-commit`:
# $ brew install pre-commit
# pre-commit hooks require a user to have installed `prek`:
# $ brew install prek
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
# $ pre-commit install
# $ prek install

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
Expand All @@ -12,12 +12,12 @@ repos:
- id: ruff
args: [ --fix , --exit-non-zero-on-fix ]
- repo: https://github.com/ambv/black
rev: 23.3.0
rev: 26.1.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
Expand Down
8 changes: 4 additions & 4 deletions ui/sdk/developer_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ pip install \
-r ./requirements-test.txt
```

Set up `pre-commit`, which will run some lightweight formatting and linting tasks on every commit.
Set up `prek`, which will run some lightweight formatting and linting tasks on every commit.

```shell
pre-commit install
prek install
```

### Create a pull request
Expand All @@ -83,10 +83,10 @@ Make changes, commit them, and push them to your fork.
git push origin HEAD
```

Test your changes locally with `pre-commit`...
Test your changes locally with `prek`...

```shell
pre-commit run --all-files
prek run --all-files
```

...and by following the steps in ["How to run unit tests"](#how-to-run-unit-tests).
Expand Down
2 changes: 1 addition & 1 deletion ui/sdk/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
black
openapi-python-client
pandera # for cli examples
pre-commit
prek
ruff
scikit-learn # for cli examples
10 changes: 5 additions & 5 deletions writeups/developer_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ Please be informed to use escape characters or wrap the argument in quote as sho
pip install '.[dev,test]'
```

Set up `pre-commit`, which will run some lightweight formatting and linting tasks on every commit.
Set up `prek`, which will run some lightweight formatting and linting tasks on every commit.

```shell
pre-commit install
prek install
```

### Create a pull request
Expand All @@ -84,10 +84,10 @@ Make changes, commit them, and push them to your fork.
git push origin HEAD
```

Test your changes locally with `pre-commit`...
Test your changes locally with `prek`...

```shell
pre-commit run --all-files
prek run --all-files
```

...and by following the steps in ["How to run unit tests"](#how-to-run-unit-tests).
Expand All @@ -113,7 +113,7 @@ The following values for `TASK` are recognized:
* `async` = unit tests using the async driver
* `dask` = unit tests using the `dask` adapter
* `integrations` = tests on integrations with other frameworks
* `pre-commit` = static analysis (i.e. linting)
* `prek` = static analysis (i.e. linting)
* `pyspark` = unit tests using the `spark` adapter
* `ray` = unit tests using the `ray` adapter
* `tests` = core unit tests with minimal requirements
Expand Down
Loading