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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
make init-uv
make install

- name: Type checking with ty
- name: Type checking with Pyrefly
run: make type

test:
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ repos:
- id: ruff-format
- id: ruff

# ty
# Note: ty pre-commit hook not yet available (see https://github.com/astral-sh/ty/issues/269)
# Type checking is handled via prek or make type
# pyrefly
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 1.2.0 # pre-commit hook version, not the pyrefly version (that comes from pyproject.toml)
hooks:
- id: pyrefly-check
name: pyrefly
pass_filenames: false
language: system # use the project's own pyrefly install so versions stay in sync with pyproject.toml

# sqlfluff
- repo: https://github.com/sqlfluff/sqlfluff
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ lint-sql:
uv run sqlfluff lint .

type:
uv run ty check
uv run pyrefly check

test:
uv run pytest -vv -m "not df"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ uv run prek run
# uv run prek run <hook>
uv run prek run ruff-format
uv run prek run ruff
uv run prek run ty
uv run prek run pyrefly-check

# To run a particular prek hook against all files (staged and unstaged, before committing):
uv run prek run ruff --all-files

# run checks regardless of git status
uv run ruff format --check src
uv run ty src
uv run pyrefly check
uv run ruff src
```

Expand Down Expand Up @@ -99,16 +99,16 @@ The checks contained in this repo include (in the order in which they run):
* Various checkers and formatters to verify valid file types, file size, and end of line and end of file whitespace/newlines
* `ruff format` applies standard code style formatting (just like `black`, but faster)
* `ruff` checks code for "lint"
* `ty` is used for static type checking
* `pyrefly` is used for static type checking
* `sqlfluff` checks and fixes sql formatting and linting
* `uv` checks on valid and aligned pyproject.toml and uv.lock files
* `commitlint` enforces commit message conforms to [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format

If you want `ruff format` to ignore a particular section of code, you can add the comments `# fmt: off` and `# fmt: on` before and after the respective block of code (same as you would if using `black`).
* https://stackoverflow.com/a/58584557

If you want `ty` to ignore a particular line of code, you can add the comment `# type: ignore` to the end of that line.
If `# type: ignore` is added to the very top of a file, `ty` will ignore the entire file.
If you want `pyrefly` to ignore a particular line of code, you can add the comment `# pyrefly: ignore` to the end of
that line (`# type: ignore` is also respected).

If you absolutely must commit without adhering to the prek hooks, then you can use `git commit -n ...` where `-n` is shorthand for `--no-verify`.

Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ dev = [
"mkdocstrings[python] >=0.25.2,<1",
"nox >=2024.4.15,<2025",
"prek >=0.1.0,<1",
"pyrefly >=1.2.0,<2",
"pytest >=8.3.2,<9",
"pytest-cov >=5.0.0,<6",
"python-semantic-release >=10.0.0,<11",
"ruff >=0.6.2,<1",
"sqlfluff >=3.1.1,<4",
"ty >=0.0.11,<1",
]


Expand All @@ -53,10 +53,11 @@ fail_under = 70
show_missing = true


####
# Ty
####
[tool.ty]
#########
# Pyrefly
#########
[tool.pyrefly]
project-includes = ["src", "tests", "noxfile.py"]


######
Expand Down
2 changes: 1 addition & 1 deletion src/sample/placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import sample

MODULE_DIR = Path(sample.__file__).resolve().parent # type: ignore
MODULE_DIR = Path(sample.__file__).resolve().parent
SQL_DIR = MODULE_DIR / "sql"


Expand Down
48 changes: 21 additions & 27 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading