Skip to content

Commit f262459

Browse files
sandeshittnagorra
authored andcommitted
feat(ci): add ci and pre-commit checks
1 parent 1a37982 commit f262459

File tree

4 files changed

+120
-23
lines changed

4 files changed

+120
-23
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Python check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pre_commit_checks:
8+
name: Pre-Commit checks
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@main
13+
- uses: astral-sh/setup-uv@v5
14+
with:
15+
enable-cache: true
16+
17+
- name: Setup uv python environment
18+
working-directory: ./functions/generated/pyfirebase
19+
run: uv venv
20+
21+
- name: uv lock check
22+
working-directory: ./functions/generated/pyfirebase
23+
run: uv lock --locked --offline
24+
25+
- name: uv sync
26+
working-directory: ./functions/generated/pyfirebase
27+
run: uv sync --all-extras
28+
29+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
default_language_version:
2+
python: python3
3+
4+
files: functions/generated/pyfirebase/
5+
6+
# NOTE: Update in pyproject.toml as well
7+
exclude: |
8+
(?x)^(
9+
\.git|
10+
__pycache__|
11+
.venv
12+
)
13+
14+
repos:
15+
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
rev: v5.0.0
17+
hooks:
18+
- id: trailing-whitespace
19+
- id: end-of-file-fixer
20+
- id: check-json
21+
- id: check-toml
22+
- id: check-xml
23+
- id: check-yaml
24+
args: [--unsafe]
25+
- id: debug-statements
26+
- id: check-builtin-literals
27+
- id: check-case-conflict
28+
- id: detect-private-key
29+
- id: name-tests-test
30+
31+
# Run the Ruff linter.
32+
- repo: https://github.com/astral-sh/ruff-pre-commit
33+
rev: v0.9.8
34+
hooks:
35+
# Linter
36+
- id: ruff
37+
types_or: [python, pyi, jupyter, toml]
38+
args: [--fix, --exit-non-zero-on-fix]
39+
# Formatter
40+
- id: ruff-format
41+
types_or: [python, pyi, jupyter, toml]
42+
43+
- repo: https://github.com/RobertCraigie/pyright-python
44+
rev: v1.1.403
45+
hooks:
46+
- id: pyright
47+
entry: pyright -p functions/generated/pyfirebase/
48+
additional_dependencies:
49+
[
50+
beartype,
51+
einops,
52+
jax,
53+
jaxtyping,
54+
optax,
55+
pytest,
56+
typing_extensions,
57+
wadler_lindig,
58+
]

functions/generated/pyfirebase/pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ build-backend = "hatchling.build"
1818

1919
[tool.hatch.build.targets.wheel]
2020
packages = ["pyfirebase_mapswipe"]
21+
22+
[tool.pyright]
23+
venvPath = "."
24+
venv = ".venv"
25+
26+
[tool.ruff.lint]
27+
flake8-builtins.builtins-strict-checking = false
28+
ignore = [
29+
"TRY004",
30+
]

functions/generated/pyfirebase/uv.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)