Skip to content

Commit 4ae0bb9

Browse files
committed
Initial commit
1 parent 58fc131 commit 4ae0bb9

File tree

5 files changed

+199
-10
lines changed

5 files changed

+199
-10
lines changed

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
with:
22+
version: "latest"
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
run: uv python install ${{ matrix.python-version }}
26+
27+
- name: Run linting and type checking
28+
run: make lint

.gitignore

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,41 +85,41 @@ ipython_config.py
8585
# pyenv
8686
# For a library or package, you might want to ignore these files since the code is
8787
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
88+
.python-version
8989

9090
# pipenv
9191
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
9292
# However, in case of collaboration, if having platform-specific dependencies or dependencies
9393
# having no cross-platform support, pipenv may install dependencies that don't work, or not
9494
# install all needed dependencies.
95-
#Pipfile.lock
95+
Pipfile.lock
9696

9797
# UV
9898
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
9999
# This is especially recommended for binary packages to ensure reproducibility, and is more
100100
# commonly ignored for libraries.
101-
#uv.lock
101+
uv.lock
102102

103103
# poetry
104104
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105105
# This is especially recommended for binary packages to ensure reproducibility, and is more
106106
# commonly ignored for libraries.
107107
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
#poetry.toml
108+
poetry.lock
109+
poetry.toml
110110

111111
# pdm
112112
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113113
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114114
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115-
#pdm.lock
116-
#pdm.toml
115+
pdm.lock
116+
pdm.toml
117117
.pdm-python
118118
.pdm-build/
119119

120120
# pixi
121121
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
122+
pixi.lock
123123
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124124
# in the .venv directory. It is recommended not to include this directory in version control.
125125
.pixi
@@ -173,7 +173,7 @@ cython_debug/
173173
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174174
# and can be added to the global gitignore or merged into this file. For a more nuclear
175175
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176-
#.idea/
176+
.idea/
177177

178178
# Abstra
179179
# Abstra is an AI-powered process automation framework.
@@ -186,7 +186,7 @@ cython_debug/
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187187
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
189+
.vscode/
190190

191191
# Ruff stuff:
192192
.ruff_cache/

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Lint
2+
typing:
3+
uv run --isolated --only-group dev mypy --install-types --non-interactive --explicit-package-bases .
4+
5+
lint:
6+
uv run --isolated --only-group dev ruff check
7+
uv run --isolated --only-group dev black --check --diff .
8+
9+
fmt:
10+
uv run --isolated --only-group dev black .
11+
uv run --isolated --only-group dev ruff check --fix --unsafe-fixes
12+
$(MAKE) lint
13+
14+
.PHONY: typing fmt lint

pyproject.toml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
[build-system]
2+
requires = ["uv_build>=0.7.20,<0.8.0"]
3+
build-backend = "uv_build"
4+
5+
[project]
6+
name = "grpo"
7+
version = "0.1.0"
8+
description = 'Group Relative Policy Optimization implementations.'
9+
readme = "README.md"
10+
requires-python = ">=3.10,<=3.12"
11+
license = "MIT"
12+
keywords = []
13+
authors = [
14+
{ name = "Ashwin Mathur", email = "" },
15+
{ name = "Varun Mathur", email = "" },
16+
]
17+
classifiers = [
18+
"License :: OSI Approved :: MIT License",
19+
"Development Status :: 5 - Production/Stable",
20+
"Programming Language :: Python",
21+
]
22+
dependencies = [
23+
"torch",
24+
"transformers",
25+
"accelerate",
26+
"datasets",
27+
"deepspeed",
28+
"wandb",
29+
]
30+
31+
[dependency-groups]
32+
dev = [
33+
"black",
34+
"mypy",
35+
"ruff",
36+
]
37+
38+
[project.urls]
39+
Documentation = "https://github.com/avnlp/grpo#readme"
40+
Issues = "https://github.com/avnlp/grpo/issues"
41+
Source = "https://github.com/avnlp/grpo"
42+
43+
[tool.ruff]
44+
line-length = 120
45+
46+
[tool.ruff.lint]
47+
select = [
48+
"A",
49+
"ARG",
50+
"B",
51+
"C",
52+
"D",
53+
"D401",
54+
"DTZ",
55+
"E",
56+
"EM",
57+
"F",
58+
"I",
59+
"ICN",
60+
"ISC",
61+
"N",
62+
"PLC",
63+
"PLE",
64+
"PLR",
65+
"PLW",
66+
"Q",
67+
"RUF",
68+
"S",
69+
"T",
70+
"TID",
71+
"UP",
72+
"W",
73+
"YTT",
74+
]
75+
ignore = [
76+
"ARG001", # Allow unused kwargs in functions
77+
# Allow non-abstract empty methods in abstract base classes
78+
"A002",
79+
"B027",
80+
"B018",
81+
# Allow boolean positional values in function calls, like `dict.get(... True)`
82+
"FBT003",
83+
# Ignore checks for possible passwords
84+
"S101",
85+
"S104",
86+
"S105",
87+
"S106",
88+
"S107",
89+
"S113",
90+
"S701",
91+
# Ignore complexity
92+
"C901",
93+
"PLR2004", # Allow Magic value used in comparison
94+
"PLR0911",
95+
"PLR0912",
96+
"PLR0913",
97+
"PLR0915",
98+
"PLW2901",
99+
"DTZ005",
100+
# Allow print statements
101+
"T201",
102+
# Ignore missing module docstrings
103+
"D100",
104+
"D101",
105+
"D102",
106+
"D103",
107+
"D104",
108+
"D105",
109+
"D107",
110+
"D205",
111+
"D401",
112+
"D417",
113+
# Ignore Line too long
114+
"E501",
115+
"E722",
116+
"E741",
117+
"N802",
118+
"N806",
119+
"N812",
120+
"N816",
121+
]
122+
unfixable = [
123+
# Don't touch unused imports
124+
"F401",
125+
]
126+
extend-select = ["I"]
127+
128+
129+
[tool.ruff.lint.pydocstyle]
130+
convention = "google"
131+
132+
[tool.ruff.lint.isort]
133+
known-first-party = ["grpo"]
134+
135+
[tool.ruff.lint.flake8-tidy-imports]
136+
ban-relative-imports = "parents"
137+
138+
[tool.ruff.lint.per-file-ignores]
139+
# Tests can use magic values, assertions, and relative imports
140+
"tests/**/*" = ["PLR2004", "S101", "TID252"]
141+
142+
[tool.black]
143+
line-length = 120
144+
145+
[[tool.mypy.overrides]]
146+
module = ["grpo.*", "pytest.*", "numpy.*"]
147+
ignore_missing_imports = true

src/grpo/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)