Skip to content

Commit 9b57b30

Browse files
Move to uv and pyproject.toml (#23)
* Move to uv and pyproject.toml Signed-off-by: Hemil Desai <[email protected]> * Dependency update (#35) * update required deps Signed-off-by: Maanu Grover <[email protected]> * add optional groups for docs and test Signed-off-by: Maanu Grover <[email protected]> * install deps from uv in ci Signed-off-by: Maanu Grover <[email protected]> * try again Signed-off-by: Maanu Grover <[email protected]> * update ci dockerfile Signed-off-by: Maanu Grover <[email protected]> --------- Signed-off-by: Maanu Grover <[email protected]> --------- Signed-off-by: Hemil Desai <[email protected]> Signed-off-by: Maanu Grover <[email protected]> Co-authored-by: Maanu Grover <[email protected]>
1 parent a90f6d4 commit 9b57b30

File tree

11 files changed

+60
-366
lines changed

11 files changed

+60
-366
lines changed

.github/workflows/code-linting.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ jobs:
2525
- name: Checkout
2626
uses: actions/checkout@v4
2727

28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
30+
with:
31+
version: "0.7.10"
32+
2833
- name: Install dependencies
2934
run: |
30-
pip install -r requirements/requirements_test.txt
35+
uv sync --only-group test
3136
3237
- name: Get changed files
3338
id: changed-files
@@ -60,7 +65,7 @@ jobs:
6065
fi
6166
6267
set +e
63-
pylint $ADDITIONAL_PYLINT_ARGS --output "pylintrc.txt" --rcfile ".pylintrc" ${CHANGED_FILES[@]}
68+
uv run --only-group test pylint $ADDITIONAL_PYLINT_ARGS --output "pylintrc.txt" --rcfile ".pylintrc" ${CHANGED_FILES[@]}
6469
echo "exit-code=$?" | tee -a "$GITHUB_OUTPUT"
6570
6671
- name: Run flake8
@@ -82,7 +87,7 @@ jobs:
8287
fi
8388
8489
set +e
85-
flake8 $ADDITIONAL_FLAKE8_ARGS --output "flake8.txt" --config ".flake8" ${CHANGED_FILES[@]}
90+
uv run --only-group test flake8 $ADDITIONAL_FLAKE8_ARGS --output "flake8.txt" --config ".flake8" ${CHANGED_FILES[@]}
8691
echo "exit-code=$?" | tee -a "$GITHUB_OUTPUT"
8792
8893
- name: Run isort
@@ -98,7 +103,7 @@ jobs:
98103
fi
99104
100105
set +e
101-
isort --check-only --diff ${CHANGED_FILES[@]} > isort.txt
106+
uv run --only-group test isort --check-only --diff ${CHANGED_FILES[@]} > isort.txt
102107
ISORT_EXIT_CODE=$?
103108
104109
if [[ $SKIP_LINTING == true ]]; then
@@ -120,7 +125,7 @@ jobs:
120125
fi
121126
122127
set +e
123-
black --check --diff ${CHANGED_FILES[@]} > black.txt
128+
uv run --only-group test black --check --diff ${CHANGED_FILES[@]} > black.txt
124129
BLACK_EXIT_CODE=$?
125130
126131
if [[ $SKIP_LINTING == true ]]; then

docker/Dockerfile.ci

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ ENV PIP_CONSTRAINT=""
1717

1818
# Install all
1919
WORKDIR /workspace
20-
RUN --mount=type=bind,source=setup.py,target=/workspace/setup.py \
20+
RUN --mount=type=bind,source=pyproject.toml,target=/workspace/pyproject.toml \
2121
--mount=type=bind,source=nemo_lm/__init__.py,target=/workspace/nemo_lm/__init__.py \
2222
--mount=type=bind,source=nemo_lm/package_info.py,target=/workspace/nemo_lm/package_info.py \
2323
--mount=type=bind,source=README.md,target=/workspace/README.md \
24-
--mount=type=bind,source=requirements,target=/workspace/requirements \
2524
pip install --no-build-isolation --no-cache-dir '.[all]'
2625

2726
# Install development versions

pyproject.toml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
[build-system]
16-
requires = ["setuptools >= 61.0"]
17-
build-backend = "setuptools.build_meta"
18-
1915
[project]
2016
name = "nemo-lm"
21-
dynamic = ["dependencies", "optional-dependencies", "version"]
17+
dynamic = ["version"]
2218
description = "NeMo - a toolkit for Conversational AI"
2319
readme = "README.md"
2420
license = {file = "LICENSE"}
@@ -59,6 +55,54 @@ classifiers = [
5955
"Topic :: Software Development :: Libraries",
6056
"Topic :: Utilities",
6157
]
58+
dependencies = [
59+
"accelerate>=1.6.0",
60+
"datasets>=3.5.1",
61+
"numpy>=2.2.5",
62+
"omegaconf>=2.3.0",
63+
"packaging>=25.0",
64+
"tensorboard>=2.19.0",
65+
"torch>=2.7.0",
66+
"transformers>=4.51.3",
67+
"wandb>=0.19.10",
68+
"megatron-core",
69+
"six>=1.17.0",
70+
"regex>=2024.11.6",
71+
"pyyaml>=6.0.2",
72+
"einops>=0.8.1",
73+
"sentencepiece>=0.2.0",
74+
"tiktoken>=0.9.0",
75+
"tqdm>=4.67.1",
76+
"nvidia-modelopt[torch]>=0.25.0,<=0.29.0 ; sys_platform != 'darwin'",
77+
"nvidia-resiliency-ext>=0.3.0,<1.0.0 ; sys_platform != 'darwin'",
78+
]
79+
80+
[tool.uv.sources]
81+
megatron-core = { git = "https://github.com/NVIDIA/Megatron-LM.git" }
82+
83+
[build-system]
84+
requires = ["setuptools>=61"]
85+
build-backend = "setuptools.build_meta"
86+
87+
[dependency-groups]
88+
docs = [
89+
"myst-parser>=4.0.1",
90+
"nvidia-sphinx-theme>=0.0.8",
91+
"sphinx>=8.1.3",
92+
"sphinx-autobuild>=2024.10.3",
93+
"sphinx-autodoc2>=0.5.0",
94+
"sphinx-copybutton>=0.5.2",
95+
]
96+
test = [
97+
"black>=25.1.0",
98+
"coverage>=7.8.1",
99+
"flake8>=7.2.0",
100+
"isort>=6.0.1",
101+
"pylint>=3.3.7",
102+
"pytest>=8.3.5",
103+
"pytest-mock>=3.14.0",
104+
"pytest-runner>=6.0.1",
105+
]
62106

63107
[tool.setuptools]
64108
py-modules = ["nemo_lm"]
@@ -81,7 +125,6 @@ sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
81125
default_section = "THIRDPARTY"
82126
extend_skip = ["setup.py", "docs/source/conf.py"]
83127

84-
85128
[tool.black]
86129
line_length = 119
87130
skip_string_normalization = true

requirements/requirements.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

requirements/requirements_common.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

requirements/requirements_docs.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

requirements/requirements_multimodal.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

requirements/requirements_nlp.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

requirements/requirements_run.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/requirements_test.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)