Skip to content

Commit 7ae73f1

Browse files
committed
Initial commit
0 parents  commit 7ae73f1

File tree

175 files changed

+30168
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+30168
-0
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.py]
10+
indent_style = space
11+
indent_size = 4
12+
max_line_length = 100
13+
14+
[*.{yml,yaml}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
[*.{toml,json}]
19+
indent_style = space
20+
indent_size = 2
21+
22+
[*.md]
23+
trim_trailing_whitespace = false
24+
25+
[Makefile]
26+
indent_style = tab

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pdf filter=lfs diff=lfs merge=lfs -text

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Summary
2+
3+
<!-- Brief description of what this PR does -->
4+
5+
## Changes
6+
7+
-
8+
9+
## Type of Change
10+
11+
- [ ] Bug fix
12+
- [ ] New feature
13+
- [ ] Refactoring
14+
- [ ] Documentation
15+
- [ ] Tests
16+
- [ ] CI/CD
17+
18+
## Checklist
19+
20+
- [ ] Tests pass (`uv run pytest`)
21+
- [ ] Linting passes (`uv run ruff check src/`)
22+
- [ ] Type checking passes (`uv run pyright src/`)
23+
- [ ] Pre-commit hooks pass (`uv run pre-commit run --all-files`)
24+
- [ ] Coverage >= 80% on new code
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build Verification
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
name: Build (${{ matrix.os }}, Python ${{ matrix.python-version }})
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-14]
21+
python-version: ["3.11", "3.12"]
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up uv
26+
uses: astral-sh/setup-uv@v4
27+
with:
28+
enable-cache: true
29+
30+
- name: Set up Python
31+
run: uv python install ${{ matrix.python-version }}
32+
33+
- name: Create virtual environment
34+
run: uv venv
35+
36+
- name: Build wheel
37+
run: uv build
38+
39+
- name: Check distribution
40+
run: |
41+
uv pip install twine
42+
uv run twine check dist/*
43+
44+
- name: Pyright
45+
run: |
46+
uv pip install -e ".[dev]"
47+
uv run pyright --warnings src/
48+
49+
- name: Install in clean venv and verify import
50+
run: |
51+
uv venv /tmp/test-env
52+
VIRTUAL_ENV=/tmp/test-env uv pip install dist/*.whl
53+
/tmp/test-env/bin/python -c "import calibrax; print(calibrax.__version__)"

.github/workflows/ci.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
enable-cache: true
24+
25+
- name: Set up Python
26+
run: uv python install 3.11
27+
28+
- name: Create virtual environment
29+
run: uv venv
30+
31+
- name: Install dependencies
32+
run: uv pip install -e ".[dev]"
33+
34+
- name: Ruff check
35+
run: uv run ruff check src/ tests/
36+
37+
- name: Ruff format check
38+
run: uv run ruff format --check src/ tests/
39+
40+
- name: Pyright
41+
run: uv run pyright --warnings src/
42+
43+
test:
44+
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
45+
runs-on: ${{ matrix.os }}
46+
needs: lint
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
os: [ubuntu-latest, macos-14]
51+
python-version: ["3.11"]
52+
env:
53+
JAX_PLATFORMS: cpu
54+
WANDB_DIR: /tmp/calibrax-test-wandb
55+
WANDB_MODE: offline
56+
XLA_PYTHON_CLIENT_PREALLOCATE: "false"
57+
TF_CPP_MIN_LOG_LEVEL: "1"
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Set up uv
62+
uses: astral-sh/setup-uv@v4
63+
with:
64+
enable-cache: true
65+
66+
- name: Set up Python
67+
run: uv python install ${{ matrix.python-version }}
68+
69+
- name: Create virtual environment
70+
run: uv venv
71+
72+
- name: Install dependencies
73+
run: uv pip install -e ".[dev,test,stats,changepoint,mlflow]"
74+
75+
- name: Create temp directory
76+
run: mkdir -p temp
77+
78+
- name: Run tests
79+
run: |
80+
uv run pytest tests/ \
81+
--cov=calibrax \
82+
--cov-report=term-missing \
83+
--cov-report=xml:coverage.xml \
84+
--cov-fail-under=80 \
85+
--timeout=300 \
86+
-v
87+
88+
- name: Upload coverage
89+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
90+
uses: codecov/codecov-action@v4
91+
with:
92+
file: coverage.xml
93+
fail_ci_if_error: false
94+
95+
build:
96+
name: Build
97+
runs-on: ubuntu-latest
98+
needs: test
99+
steps:
100+
- uses: actions/checkout@v4
101+
102+
- name: Set up uv
103+
uses: astral-sh/setup-uv@v4
104+
with:
105+
enable-cache: true
106+
107+
- name: Set up Python
108+
run: uv python install 3.11
109+
110+
- name: Create virtual environment
111+
run: uv venv
112+
113+
- name: Build package
114+
run: uv build
115+
116+
- name: Check distribution
117+
run: |
118+
uv pip install twine
119+
uv run twine check dist/*

.github/workflows/docs.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
- "mkdocs.yml"
9+
- "src/calibrax/**"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
deploy:
17+
name: Deploy Docs
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@v4
26+
with:
27+
enable-cache: true
28+
29+
- name: Set up Python
30+
run: uv python install 3.11
31+
32+
- name: Create virtual environment
33+
run: uv venv
34+
35+
- name: Install dependencies
36+
run: uv pip install -e ".[docs]"
37+
38+
- name: Build docs
39+
run: uv run mkdocs build --clean
40+
41+
- name: Deploy to GitHub Pages
42+
uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./site
46+
destination_dir: deploy/calibrax
47+
cname: docs.avitai.bio
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Quality Checks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
quality:
15+
name: Quality (${{ matrix.python-version }})
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.11", "3.12"]
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@v4
26+
with:
27+
enable-cache: true
28+
29+
- name: Set up Python
30+
run: uv python install ${{ matrix.python-version }}
31+
32+
- name: Create virtual environment
33+
run: uv venv
34+
35+
- name: Install dependencies
36+
run: uv pip install -e ".[dev]"
37+
38+
- name: Pre-commit
39+
run: uv run pre-commit run --all-files
40+
41+
- name: Pyright
42+
run: uv run pyright --warnings src/
43+
44+
- name: Ruff check
45+
run: uv run ruff check src/ tests/
46+
47+
- name: Ruff format check
48+
run: uv run ruff format --check src/ tests/
49+
50+
- name: Ruff isort check
51+
run: uv run ruff check --select I --diff src/ tests/
52+
53+
- name: Pip audit
54+
run: |
55+
uv pip install pip-audit
56+
uv run pip-audit --ignore-vuln PYSEC-2022-42969

.github/workflows/security.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 0 * * 1"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
security:
17+
name: Security Scan
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up uv
23+
uses: astral-sh/setup-uv@v4
24+
with:
25+
enable-cache: true
26+
27+
- name: Set up Python
28+
run: uv python install 3.11
29+
30+
- name: Create virtual environment
31+
run: uv venv
32+
33+
- name: Install dependencies
34+
run: |
35+
uv pip install -e ".[dev]"
36+
uv pip install pip-audit bandit
37+
38+
- name: Pip audit
39+
run: uv run pip-audit --ignore-vuln PYSEC-2022-42969
40+
41+
- name: Bandit
42+
run: uv run bandit -r src/calibrax/ -c pyproject.toml -f json -o bandit-report.json
43+
44+
- name: Upload Bandit report
45+
if: always()
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: bandit-report
49+
path: bandit-report.json

0 commit comments

Comments
 (0)