Skip to content

Commit 126ba8b

Browse files
Initial commit
fbshipit-source-id: a8702f92841444d8f32740b75f6b16edc2330846
0 parents  commit 126ba8b

Some content is hidden

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

65 files changed

+36051
-0
lines changed

.flake8

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[flake8]
2+
select = B,C,E,F,P,W,B9
3+
max-line-length = 80
4+
max-complexity = 12
5+
6+
# Main Explanation Docs: https://github.com/grantmcconnaughey/Flake8Rules
7+
# Added C901 as we don't currently satisfy the complexity rules, we should fix this
8+
# Added E116 because ShipIt sometimes generates lines that violate this, which we can't do anything about
9+
ignore =
10+
C901,
11+
E116,
12+
B950,
13+
E111,
14+
E115,
15+
E117,
16+
E121,
17+
E122,
18+
E123,
19+
E124,
20+
E125,
21+
E126,
22+
E127,
23+
E128,
24+
E129,
25+
E131,
26+
E201,
27+
E202,
28+
E203,
29+
E221,
30+
E222,
31+
E225,
32+
E226,
33+
E227,
34+
E231,
35+
E241,
36+
E251,
37+
E252,
38+
E261,
39+
E262,
40+
E265,
41+
E266,
42+
E271,
43+
E272,
44+
E301,
45+
E302,
46+
E303,
47+
E305,
48+
E306,
49+
E402,
50+
E501,
51+
E502,
52+
E701,
53+
E702,
54+
E703,
55+
E704,
56+
E722,
57+
F722,
58+
P207,
59+
P208,
60+
W291,
61+
W292,
62+
W293,
63+
W391,
64+
W503,
65+
W504,
66+
B904,
67+
B905,
68+
B906,
69+
B907,

.github/workflows/main.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.12'
18+
19+
- name: Install flake8
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install flake8==7.3.0 flake8-bugbear>=24.0.0
23+
24+
- name: Run flake8
25+
run: |
26+
flake8 src/ tests/
27+
28+
test:
29+
runs-on: 4-core-ubuntu
30+
strategy:
31+
matrix:
32+
python-version: ['3.10', '3.11', '3.12']
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Cache pip packages
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.cache/pip
46+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pip-
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install -e ".[dev]"
54+
55+
- name: Run pytest
56+
run: |
57+
pytest tests/ -v
58+
59+
- name: Generate coverage report
60+
run: |
61+
pytest tests/ --cov=src/multicalibration --cov-report=term --cov-report=html --cov-report=xml
62+
continue-on-error: true
63+
64+
- name: Upload coverage report
65+
uses: actions/upload-artifact@v4
66+
if: always()
67+
with:
68+
name: coverage-report-${{ matrix.python-version }}
69+
path: |
70+
htmlcov/
71+
coverage.xml
72+
retention-days: 30
73+
74+
docs:
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Set up Node.js
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: '20'
83+
cache: 'npm'
84+
cache-dependency-path: website/package-lock.json
85+
86+
- name: Install dependencies
87+
working-directory: ./website
88+
run: npm ci
89+
90+
- name: Build website
91+
working-directory: ./website
92+
run: npm run build
93+
94+
- name: Upload documentation artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: documentation
98+
path: website/build/
99+
100+
sphinx:
101+
runs-on: 4-core-ubuntu
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Set up Python
106+
uses: actions/setup-python@v5
107+
with:
108+
python-version: '3.11'
109+
110+
- name: Cache pip packages
111+
uses: actions/cache@v4
112+
with:
113+
path: ~/.cache/pip
114+
key: ${{ runner.os }}-sphinx-${{ hashFiles('sphinx/requirements.txt', 'pyproject.toml') }}
115+
restore-keys: |
116+
${{ runner.os }}-sphinx-
117+
118+
- name: Install dependencies
119+
run: |
120+
python -m pip install --upgrade pip
121+
pip install -e .
122+
pip install -r sphinx/requirements.txt
123+
124+
- name: Build Sphinx documentation
125+
working-directory: ./sphinx
126+
run: |
127+
sphinx-build -b html source build/html
128+
129+
- name: Upload Sphinx documentation
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: sphinx-documentation
133+
path: sphinx/build/html/

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Byte-compiled
2+
*.py[cod]
3+
4+
# Distribution / packaging
5+
*.egg-info/
6+
7+
# Node modules
8+
node_modules/
9+
10+
# Docusaurus build
11+
website/build/
12+
website/.docusaurus/
13+
website/node_modules/
14+
15+
# Sphinx build and artifacts
16+
sphinx/build/
17+
sphinx/source/_build/
18+
*.doctrees
19+
.buildinfo
20+
21+
# Test coverage
22+
htmlcov/
23+
.coverage
24+
.coverage.*
25+
coverage.xml
26+
*.cover
27+
.pytest_cache/
28+
29+
# Metadata
30+
**/.DS_Store

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pycqa/flake8
3+
rev: 7.3.0
4+
hooks:
5+
- id: flake8
6+
additional_dependencies:
7+
- flake8-bugbear>=24.0.0
8+
9+
# Run tests on push (not every commit)
10+
- repo: local
11+
hooks:
12+
- id: pytest
13+
name: Run pytest
14+
entry: pytest
15+
language: system
16+
pass_filenames: false
17+
always_run: true
18+
stages: [pre-push]

.readthedocs.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the version of Python and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.11"
12+
jobs:
13+
post_install:
14+
# Install the package in editable mode
15+
- pip install -e .
16+
17+
# Build documentation in the docs/ directory with Sphinx
18+
sphinx:
19+
configuration: sphinx/source/conf.py
20+
fail_on_warning: false
21+
22+
# Optionally declare the Python requirements required to build your docs
23+
python:
24+
install:
25+
- method: pip
26+
path: .
27+
extra_requirements:
28+
- docs
29+
- requirements: sphinx/requirements.txt
30+
31+
# Additional formats
32+
formats:
33+
- pdf
34+
- epub

CITATION.cff

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
cff-version: 1.2.0
7+
message: If you use this software, please cite it as below.
8+
title: MCGrad
9+
authors:
10+
- name: MCGrad Team
11+
url: https://github.com/facebookincubator/MCGrad
12+
repository-code: https://github.com/facebookincubator/MCGrad
13+
license: MIT
14+
version: 0.1.0
15+
preferred-citation:
16+
type: article
17+
title: "MCGrad: Multicalibration at Web Scale"
18+
authors:
19+
- family-names: Perini
20+
given-names: Lorenzo
21+
- family-names: Haimovich
22+
given-names: Daniel
23+
- family-names: Linder
24+
given-names: Fridolin
25+
- family-names: Tax
26+
given-names: Niek
27+
- family-names: Karamshuk
28+
given-names: Dima
29+
- family-names: Vojnovic
30+
given-names: Milan
31+
- family-names: Okati
32+
given-names: Nastaran
33+
- family-names: Apostolopoulos
34+
given-names: Pavlos Athanasios
35+
journal: "arXiv preprint arXiv:2509.19884"
36+
year: 2026
37+
url: "https://arxiv.org/abs/2509.19884"
38+
notes: "To appear in KDD 2026"

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @danielha1 @flinder @Lorenzo-Perini @TaXxER

0 commit comments

Comments
 (0)