Skip to content

Commit

Permalink
fix audit and test reqs (#1160)
Browse files Browse the repository at this point in the history
* fix audit and test reqs

* revert sklearn version and ignore vuln
  • Loading branch information
mike0sv authored Jun 19, 2024
1 parent 23f697f commit 5e70d53
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Install package
run: pip install -e .[dev,spark,fsspec]
- name: Run pip-audit
run: pip-audit --ignore-vuln PYSEC-2024-48
run: pip-audit --ignore-vuln PYSEC-2024-48 --ignore-vuln GHSA-jw8x-6495-233v
- name: Run Tests
run: python -m pytest --durations=50
test:
Expand Down
2 changes: 1 addition & 1 deletion requirements.min.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pyarrow==14.0.1
pyspark==3.4.0
fsspec[full]==2024.2.0
certifi==2023.07.22
urllib3==1.26.18
urllib3==1.26.19
ujson==5.4.0

openai==1.16.2
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Distributed under the terms of the Modified BSD License.
import os
from os.path import join as pjoin
from pathlib import Path

from setuptools import setup

Expand Down Expand Up @@ -47,7 +48,7 @@
setup_args = dict(
cmdclass=cmdclass,
author_email="[email protected]",
long_description=open("README.md").read(),
long_description=(Path(__file__).parent / "README.md").read_text("utf8"),
long_description_content_type="text/markdown",
include_package_data=True,
install_requires=[
Expand All @@ -64,13 +65,13 @@
"litestar>=2.8.3",
"typing-inspect>=0.9.0",
"uvicorn[standard]>=0.22.0",
"watchdog>=3",
"watchdog>=3.0.0",
"typer>=0.3",
"rich>=13",
"iterative-telemetry>=0.0.5",
"dynaconf>=3.2.4",
"certifi>=2023.07.22",
"urllib3>=1.26.18",
"urllib3>=1.26.19",
"fsspec>=2024.2.0",
"ujson>=5.4.0",
],
Expand Down
25 changes: 25 additions & 0 deletions tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from pathlib import Path

from setup import setup_args


def test_minimal_requirements():
path = Path(__file__).parent.parent
with open(path / "requirements.min.txt") as f:
lines = {line.strip().split("#")[0] for line in f.readlines()}
min_reqs = {k.split("[")[0]: v for line in lines if line.strip() for k, v in (line.strip().split("=="),)}

install_reqs = {k.split("[")[0]: v for r in setup_args["install_requires"] for k, v in (r.split(">="),)}
extra = []
wrong_version = []
for m, v in install_reqs.items():
if m not in min_reqs:
extra.append(f"{m}>={v}")
continue
if v != min_reqs[m]:
wrong_version.append(f"{m}>={v}")
continue

assert (
len(extra) == 0 and len(wrong_version) == 0
), f"install_requires has extra reqs {extra} and wrong versions of {wrong_version}"

0 comments on commit 5e70d53

Please sign in to comment.