Skip to content

Commit

Permalink
Exclude test data
Browse files Browse the repository at this point in the history
Fixes onnx#5925 in a minimally invasive way.

onnx/backend/test/data contains large test files which should not be
included in the PyPI package. This PR simply excludes them when
building the package. This reduces the size of the `onnx`
package (uncompressed) from 51MB to 12MB.

Signed-off-by: Christian Bourjau <christian.bourjau@quantco.com>
  • Loading branch information
cbourjau committed Feb 27, 2024
1 parent ff60ddc commit 7d0c3ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion onnx/backend/test/stat_coverage.py
Expand Up @@ -6,6 +6,7 @@

import os
from typing import IO, Any, Dict, List, Sequence
from pathlib import Path

from onnx import AttributeProto, defs, load
from onnx.backend.test.case import collect_snippets
Expand Down Expand Up @@ -157,7 +158,7 @@ def gen_model_test_coverage(
# Need to grab associated nodes
attrs: Dict[str, Dict[str, List[Any]]] = {}
model_paths: List[Any] = []
for rt in load_model_tests(kind="real"):
for rt in load_model_tests(data_dir=str(Path(__file__).parent / "data"), kind="real"):
if rt.url.startswith("onnx/backend/test/data/light/"):
# testing local files
model_name = os.path.normpath(
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Expand Up @@ -43,10 +43,14 @@ onnx = [
"**/*.h",
"**/*.proto",
"**/*.pyi",
"backend/test/data/**/*",
"py.typed",
]

[tool.setuptools.exclude-package-data]
onnx = [
"backend/test/data/**/*",
]

[tool.pytest.ini_options]

addopts = "--nbval --nbval-current-env --tb=short --color=yes"
Expand Down

0 comments on commit 7d0c3ad

Please sign in to comment.