Files
Model-Optimizer/pyproject.toml
T
Keval Morabia ae69d5d9b9 Separate CI job for Megatron GPU tests (#888)
## What does this PR do?

[Short term]: Megatron based tests take a long time often resulting in
CICD timeout. Splitting megatron tests into a dedicated CICD job for
faster overall CI/CD run
[Mid/Long term]: Run all megatron gpu tests using `torchrun` instead of
`pytest` so all dist processes are already created and all individual
tests no longer need to setup and destroy their processes which adds a
lot of overhead per test

## Testing
<!-- Mention how have you tested your change if applicable. -->

- [x] 1-GPU CI/CD passing (on this PR)
- [x] 2-GPU CI/CD passing (on nightly run - manually triggered):
https://github.com/NVIDIA/Model-Optimizer/actions/runs/22000517688

---------

Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
2026-02-13 13:12:39 -08:00

187 lines
5.1 KiB
TOML

####################################################################################################
############################### BUILD CONFIGURATION ##############################################
####################################################################################################
[build-system]
requires = ["cython", "setuptools>=80", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
####################################################################################################
############################### LINTING, FORMATTING AND TESTING CONFIGURATION ####################
####################################################################################################
[tool.ruff]
target-version = "py310"
line-length = 100 # Line length limit for code
fix = true
[tool.ruff.format]
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
docstring-code-format = true
# Set the line length limit used when formatting code snippets in docstrings.
docstring-code-line-length = "dynamic"
[tool.ruff.lint]
# See available rules at https://docs.astral.sh/ruff/rules/
# Flake8 is equivalent to pycodestyle + pyflakes + mccabe.
select = [
"C4", # Flake8 comprehensions
"D", # pydocstyle
"E", # pycodestyle errors
"F", # pyflakes
"FURB", # refurb
"I", # isort
"ISC", # flake8-implicit-str-concat
"N", # pep8 naming
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLE", # pylint errors
"PLR", # pylint refactor
"PT", # flake8-pytest-style
"RUF", # ruff
"SIM", # flake8-simplify
"TC", # flake8-type-checking
"UP", # pyupgrade
"W", # pycodestyle warnings
]
extend-ignore = [
"D105",
"D417",
"N812",
"PLR0402",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR2004",
"PLR0911",
"PT011",
"PT018",
"PT028",
"PT030",
"RUF002",
"RUF012",
"SIM102",
"SIM108",
"SIM115",
"UP032",
"UP038",
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]
"examples/*" = ["D"]
"tests/*" = ["B017", "D", "E402", "PT012"]
"*/_[a-zA-Z]*" = ["D"] # Private packages (_abc/*.py) or modules (_xyz.py)
"*.ipynb" = [
"D",
"E501",
] # Ignore missing docstrings or line length for Jupyter notebooks
"modelopt/torch/quantization/triton/*" = ["N803", "N806", "E731"] # triton style
"examples/deepseek/ds_kernel.py" = ["N803", "N806", "E731"] # triton style
[tool.ruff.lint.pycodestyle]
max-line-length = 120 # Line length limit for comments and docstrings
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["modelopt"]
split-on-trailing-comma = false
[tool.mypy]
files = "."
install_types = true
non_interactive = true
show_error_codes = true
disable_error_code = [
"assignment",
"operator",
"has-type",
"var-annotated",
"override",
]
explicit_package_bases = true
namespace_packages = true
# strict checks
strict = true
disallow_subclassing_any = false
disallow_untyped_decorators = false
disallow_any_generics = false
disallow_untyped_calls = false
disallow_incomplete_defs = false
disallow_untyped_defs = false
warn_return_any = false
[[tool.mypy.overrides]]
module = ["tests.*"]
ignore_errors = true
[[tool.mypy.overrides]]
module = ["examples.*"]
disable_error_code = ["attr-defined"]
[tool.pytest.ini_options]
# Default additional options
# Show a short test summary info for all except passed tests with -ra flag
# print execution time for 50 slowest tests and generate coverage reports
addopts = "-v -ra --instafail --cov-report=term-missing --cov-report=html --cov-report=xml:coverage.xml --cov-config=pyproject.toml --durations=50 --strict-markers"
pythonpath = ["tests/"]
markers = [
"manual: Only run when --run-manual is given",
"release: Regression tests that should be run before every release",
]
[tool.coverage.run]
# measure branch coverage in addition to statement coverage
branch = false
include = ["modelopt/*"]
omit = ["*/plugins/*", "*/export/*"]
[tool.coverage.report]
fail_under = 70
skip_covered = true
ignore_errors = true
exclude_lines = [
"pragma: no cover",
# Don't complain about missing debug or verbose code
"def __repr__",
"if verbose",
# Don't complain if tests don't hit defensive exception handling code
"raise AssertionError",
"raise NotImplementedError",
"raise RuntimeError",
"raise ValueError",
"raise KeyError",
"raise AttributeError",
"except ImportError",
# Don't complain if non-runnable code isn't run
"if __name__ == \"__main__\":",
"if TYPE_CHECKING:",
# Don't complain about abstract methods, they aren't run
"@(abc\\.)?abstractmethod",
]
[tool.bandit]
exclude_dirs = [".github/", "examples/", "tests/"]
# Do not change `skips`. It should be consistent with NVIDIA's Wheel-CI-CD bandit.yml config.
# Use of `# nosec BXXX` requires special approval
skips = [
"B101", # assert_used
"B110", # try_except_pass
"B112", # try_except_continue
"B303", # MD2, MD4, MD5, or SHA1
"B311", # random
]