Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test to keep requirements in sync #465

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ authors = [
{ name = "Tianhao Li" },
{ name = "Phyllis Poh" },
{ name = "Razvan Dinu" },
{ name = "Zander Mackie" },
]
license = { file = "LICENSE" }
description = "LLM vulnerability scanner"
Expand Down Expand Up @@ -52,7 +53,9 @@ dependencies = [
"cmd2",
"torch>=2.1.0",
"sentencepiece>=0.1.99",
"markdown"
"markdown",
"zalgolib>=0.2.2",
"ecoji>=0.1.0",
]

[project.urls]
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ avidtools==0.1.1.2
stdlibs
langchain>=0.0.300
nemollm>=0.3.0
octoai-sdk
octoai-sdk>=0.8.0
cmd2
torch>=2.1.0
sentencepiece>=0.1.99
markdown
zalgolib>=0.2.2
basest>=0.7.3
ecoji>=0.1.0
26 changes: 26 additions & 0 deletions tests/test_reqs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import tomllib


def test_requirements_txt_pyproject_toml():
with open("requirements.txt", "r", encoding="utf-8") as req_file:
reqtxt_reqs = req_file.readlines()
reqtxt_reqs = list(map(str.strip, reqtxt_reqs))
reqtxt_reqs.sort()
with open("pyproject.toml", "rb") as pyproject_file:
pyproject_reqs = tomllib.load(pyproject_file)["project"]["dependencies"]
pyproject_reqs.sort()
# assert len(reqtxt_reqs) == len(pyproject_reqs) # same number of requirements
assert (
set(reqtxt_reqs) - set(pyproject_reqs) == set()
) # things in reqtxt but not in pyproject
assert (
set(pyproject_reqs) - set(reqtxt_reqs) == set()
) # things in pyproject but not in reqtxt
assert (
reqtxt_reqs == pyproject_reqs
) # final check. this one is actually enough, but let's help us debug by finding which test fails, ok?
Loading