# Python dependencies required for unit tests

#awscli==1.6 #this breaks some platforms
#Description: AWS command line interface
#Pinned versions: 1.6
#test that import:

boto3==1.35.42
#Description: AWS SDK for python
#Pinned versions: 1.19.12, 1.16.34
#test that import:

build==1.3.0
#Description: A simple, correct Python build frontend.
#Pinned versions: 1.3.0
#test that import:

click
#Description: Command Line Interface Creation Kit
#Pinned versions:
#test that import:

coremltools==5.0b5 ; python_version < "3.12"
coremltools==8.3 ; python_version == "3.12"
#Description: Apple framework for ML integration
#Pinned versions: 5.0b5
#test that import:

#dataclasses #this breaks some platforms
#Description: Provides decorators for auto adding special methods to user classes
#Pinned versions:
#test that import:

dill==0.3.7
#Description: dill extends pickle with serializing and de-serializing for most built-ins
#Pinned versions: 0.3.7
#test that import: dynamo/test_replay_record.py test_dataloader.py test_datapipe.py test_serialization.py

expecttest==0.3.0
#Description: method for writing tests where test framework auto populates
# the expected output based on previous runs
#Pinned versions: 0.3.0
#test that import:

fbscribelogger==0.1.7
#Description: write to scribe from authenticated jobs on CI
#Pinned versions: 0.1.6
#test that import:

flatbuffers==24.12.23
#Description: cross platform serialization library
#Pinned versions: 24.12.23
#test that import:

hypothesis==6.56.4
# Pin hypothesis to avoid flakiness: https://github.com/pytorch/pytorch/issues/31136
#Description: advanced library for generating parametrized tests
#Pinned versions: 6.56.4
#test that import: test_xnnpack_integration.py, test_pruning_op.py, test_nn.py

junitparser==2.1.1
#Description: unitparser handles JUnit/xUnit Result XML files
#Pinned versions: 2.1.1
#test that import:

lark==0.12.0
#Description: parser
#Pinned versions: 0.12.0
#test that import:

librosa>=0.6.2 ; python_version < "3.11" and platform_machine != "s390x"
librosa==0.10.2 ; python_version == "3.12" and platform_machine != "s390x"
#Description: A python package for music and audio analysis
#Pinned versions: >=0.6.2
#test that import: test_spectral_ops.py
#librosa depends on numba; disable it for s390x while numba is disabled too

# Only mkl-static and mkl-include are needed; the mkl package contains
# dynamic libraries that are not discoverable by our build scripts.
mkl-static==2024.2.0 ; platform_machine == "x86_64" or platform_machine == "AMD64"
mkl-include==2024.2.0 ; platform_machine == "x86_64" or platform_machine == "AMD64"
#Description: Intel oneAPI Math Kernel Library
#Pinned versions: 2024.2.0
#test that import: test_profiler.py, test_public_bindings.py, test_testing.py,
#test_nn.py, test_mkldnn.py, test_jit.py, test_fx_experimental.py,
#test_autograd.py

#mock
#Description: A testing library that allows you to replace parts of your
#system under test with mock objects
#Pinned versions:
#test that import: test_modules.py, test_nn.py,
#test_testing.py

#MonkeyType # breaks pytorch-xla-linux-bionic-py3.7-clang8
#Description: collects runtime types of function arguments and return
#values, and can automatically generate stub files
#Pinned versions:
#test that import:

mypy==1.16.0 ; platform_system == "Linux"
# Pin MyPy version because new errors are likely to appear with each release
# Skip on Windows as lots of type annotations are POSIX specific
#Description: linter
#Pinned versions: 1.16.0
#test that import: test_typing.py, test_type_hints.py

networkx==2.8.8
#Description: creation, manipulation, and study of
#the structure, dynamics, and functions of complex networks
#Pinned versions: 2.8.8
#test that import: functorch

ninja==1.13.0
#Description: build system. Used in some tests. Used in build to generate build
#time tracing information
#Pinned versions: 1.13.0
#test that import: run_test.py, test_cpp_extensions_aot.py,test_determination.py

numba==0.57.1 ; python_version == "3.10" and platform_machine != "s390x"
numba==0.64.0 ; python_version == "3.12" and platform_machine != "s390x"
#Description: Just-In-Time Compiler for Numerical Functions
#Pinned versions: 0.55.2, 0.60.0
#test that import: test_numba_integration.py
#Need release > 0.61.2 for s390x due to https://github.com/numba/numba/pull/10073

#numpy
#Description: Provides N-dimensional arrays and linear algebra
#Pinned versions: 1.26.2
#test that import: test_view_ops.py, test_unary_ufuncs.py, test_type_promotion.py,
#test_type_info.py, test_torch.py, test_tensorexpr_pybind.py, test_tensorexpr.py,
#test_tensorboard.py, test_tensor_creation_ops.py, test_static_runtime.py,
#test_spectral_ops.py, test_sort_and_select.py, test_shape_ops.py,
#test_segment_reductions.py, test_reductions.py, test_pruning_op.py,
#test_overrides.py, test_numpy_interop.py, test_numba_integration.py
#test_nn.py, test_namedtensor.py, test_linalg.py, test_jit_cuda_fuser.py,
#test_jit.py, test_indexing.py, test_datapipe.py, test_dataloader.py,
#test_binary_ufuncs.py
numpy==1.23.2; python_version == "3.10"
numpy==1.26.2; python_version == "3.11" or python_version == "3.12"
numpy==2.1.2; python_version >= "3.13" and python_version < "3.14"
numpy==2.3.4; python_version >= "3.14"

pandas==2.0.3; python_version < "3.12"
pandas==2.2.3; python_version >= "3.12" and python_version < "3.14"
pandas==2.3.3; python_version >= "3.14"

#onnxruntime
#Description: scoring engine for Open Neural Network Exchange (ONNX) models
#Pinned versions: 1.9.0
#test that import:

opt-einsum==3.3
#Description: Python library to optimize tensor contraction order, used in einsum
#Pinned versions: 3.3
#test that import: test_linalg.py

optree==0.13.0 ; python_version < "3.14"
optree==0.17.0 ; python_version >= "3.14"
#Description: A library for tree manipulation
#Pinned versions: 0.13.0
#test that import: test_vmap.py, test_aotdispatch.py, test_dynamic_shapes.py,
#test_pytree.py, test_ops.py, test_control_flow.py, test_modules.py,
#common_utils.py, test_eager_transforms.py, test_python_dispatch.py,
#test_expanded_weights.py, test_decomp.py, test_overrides.py, test_masked.py,
#test_ops.py, test_prims.py, test_subclass.py, test_functionalization.py,
#test_schema_check.py, test_profiler_tree.py, test_meta.py, test_torchxla_num_output.py,
#test_utils.py, test_proxy_tensor.py, test_memory_profiler.py, test_view_ops.py,
#test_pointwise_ops.py, test_dtensor_ops.py, test_torchinductor.py, test_fx.py,
#test_fake_tensor.py, test_mps.py

pillow==12.2.0
#Description:  Python Imaging Library fork
#Pinned versions: 11.0.0
#test that import:

protobuf==6.33.5
#Description:  Google's data interchange format
#Pinned versions: 6.33.2
#test that import: test_tensorboard.py, test/onnx/*

psutil
#Description: information on running processes and system utilization
#Pinned versions:
#test that import: test_profiler.py, test_openmp.py, test_dataloader.py

pytest==7.3.2
#Description: testing framework
#Pinned versions:
#test that import: test_typing.py, test_cpp_extensions_aot.py, run_test.py

pytest-xdist==3.3.1
#Description: plugin for running pytest in parallel
#Pinned versions:
#test that import:

pytest-flakefinder==1.1.0
#Description: plugin for rerunning tests a fixed number of times in pytest
#Pinned versions: 1.1.0
#test that import:

pytest-rerunfailures>=10.3
#Description: plugin for rerunning failure tests in pytest
#Pinned versions:
#test that import:

pytest-subtests==0.13.1
#Description: plugin for subtest support
#Pinned versions:
#test that import:

#pytest-benchmark
#Description: fixture for benchmarking code
#Pinned versions: 3.2.3
#test that import:

#pytest-sugar
#Description: shows failures and errors instantly
#Pinned versions:
#test that import:

xdoctest==1.3.0
#Description: runs doctests in pytest
#Pinned versions: 1.1.0
#test that import:

pygments==2.20.0
#Description: support doctest highlighting
#Pinned versions: 2.12.0
#test that import: the doctests

#pyyaml
#Description: data serialization format
#Pinned versions: 6.0.2
#test that import:

#requests
#Description: HTTP library
#Pinned versions:
#test that import: test_type_promotion.py

#rich
#Description: rich text and beautiful formatting in the terminal
#Pinned versions: 14.1.0
#test that import:

scikit-image==0.22.0
#Description: image processing routines
#Pinned versions: 0.22.0
#test that import: test_nn.py

#scikit-learn
#Description: machine learning package
#Pinned versions: 0.20.3
#test that import:

scipy==1.10.1 ; python_version <= "3.11"
scipy==1.14.1 ; python_version > "3.11" and python_version < "3.14"
scipy==1.16.2 ; python_version >= "3.14"
# Pin SciPy because of failing distribution tests (see #60347)
#Description: scientific python
#Pinned versions: 1.10.1
#test that import: test_unary_ufuncs.py, test_torch.py,test_tensor_creation_ops.py
#test_spectral_ops.py, test_sparse_csr.py, test_reductions.py,test_nn.py
#test_linalg.py, test_binary_ufuncs.py

#tabulate
#Description: Pretty-print tabular data
#Pinned versions:
#test that import:

# needed by torchgen utils
typing-extensions==4.12.2 ; python_version < "3.14"
typing-extensions==4.15.0 ; python_version >= "3.14"
#Description: type hints for python
#Pinned versions:
#test that import:

#virtualenv
#Description: virtual environment for python
#Pinned versions:
#test that import:

unittest-xml-reporting<=3.2.0,>=2.0.0
#Description: saves unit test results to xml
#Pinned versions:
#test that import:

#lintrunner is supported on aarch64-linux only from 0.12.4 version
lintrunner==0.12.11
#Description: all about linters!
#Pinned versions: 0.12.11
#test that import:

spin==0.17
#Description: developer CLI for common build/lint tasks
#Pinned versions: 0.17
#test that import:

redis>=4.0.0
#Description: redis database
#test that import: anything that tests OSS caching/mocking (inductor/test_codecache.py, inductor/test_max_autotune.py)

ghstack==0.8.0
#Description: ghstack tool
#Pinned versions: 0.8.0
#test that import:

jinja2==3.1.6
#Description: jinja2 template engine
#Pinned versions: 3.1.4
#test that import:

pytest-cpp==2.3.0
#Description: This is used by pytest to invoke C++ tests
#Pinned versions: 2.3.0
#test that import:

z3-solver==4.15.1.0 ; platform_machine != "s390x"
#Description: The Z3 Theorem Prover Project
#Pinned versions:
#test that import:

tensorboard==2.13.0 ; python_version < "3.13"
tensorboard==2.18.0 ; python_version >= "3.13"
#Description: Also included in .ci/docker/requirements-docs.txt
#Pinned versions:
#test that import: test_tensorboard

pywavelets==1.4.1 ; python_version < "3.12"
pywavelets==1.7.0 ; python_version >= "3.12"
#Description: This is a requirement of scikit-image, we need to pin
# it here because 1.5.0 conflicts with numpy 1.21.2 used in CI
#Pinned versions: 1.4.1
#test that import:

lxml==5.3.0 ; python_version < "3.14"
lxml==6.1.0 ; python_version >= "3.14"
#Description: This is a requirement of unittest-xml-reporting

PyGithub==2.3.0

sympy==1.13.3
#Description: Required by coremltools, also pinned in .github/requirements/pip-requirements-macOS.txt
#Pinned versions:
#test that import:

onnx==1.21.0
#Description: Required by the torch.onnx exporter
#Pinned versions:
#test that import:

onnxscript==0.6.2
#Description: Required by the torch.onnx exporter
#Pinned versions:
#test that import:

onnx-ir==0.1.16
#Description: In-memory IR for ONNX, dependency of onnxscript. Pinned to avoid breaking changes in newer versions.
#Pinned versions:
#test that import:

parameterized==0.8.1
#Description: Parameterizes unittests, both the tests themselves and the entire testing class
#Pinned versions:
#test that import:

#Description: required for testing torch/distributed/_tools/sac_estimator.py
#Pinned versions: 1.24.0
#test that import: test_sac_estimator.py

pwlf==2.2.1
#Description: required for testing torch/distributed/_tools/sac_estimator.py
#Pinned versions: 2.2.1
#test that import: test_sac_estimator.py

# To build PyTorch itself
pip==26.0.1
pyyaml==6.0.3
pyzstd
setuptools==78.1.1
packaging==24.2
six

scons==4.5.2 ; platform_machine == "aarch64"

pulp==2.9.0
#Description: required for testing ilp formulaiton under torch/distributed/_tools
#Pinned versions: 2.9.0
#test that import: test_sac_ilp.py

dataclasses_json==0.6.7
#Description: required for data pipeline and scripts under tools/stats
#Pinned versions: 0.6.7
#test that import:

cmake==3.31.6
#Description: required for building

tlparse==0.4.0
#Description: required for log parsing

filelock==3.20.3
#Description: required for inductor testing

cuda-bindings>=13.0,<14.0 ; platform_machine != "s390x" and platform_machine != "riscv64" and platform_system != "Darwin"
#Description: required for testing CUDAGraph::raw_cuda_graph(). See https://nvidia.github.io/cuda-python/cuda-bindings/latest/support.html for how this version was chosen. PyTorch CI CUDA builds use CUDA 13, so depend on the matching cuda-bindings major while allowing minor updates within that major.
#test that import: test_cuda.py

cupti-python>13.0 ; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "aarch64") and python_version < "3.14"
#Description: required for the experimental CUPTI monitor (torch.profiler._cupti_monitor). >13.0 to match CUDA 13.x toolkits. cupti-python only ships Linux x86_64/aarch64 CPython wheels (no 3.14/free-threaded yet), so guard to those.
#test that import: test_profiler.py

setuptools-git-versioning==2.1.0
scikit-build==0.18.1
pyre-extensions==0.0.32
tabulate==0.9.0
#Description: These package are needed to build FBGEMM and torchrec on PyTorch CI

tqdm>=4.66.0
#Description: progress bar library required for dynamo benchmarks
#test that import: benchmarks/dynamo/*

aiohttp==3.13.4
#Description: required for torch.distributed.debug

spin==0.17
#Description: required for testing spin commands
#Pinned versions: 0.17
#test that import: spincli/test_spin.py

uv
#Description: required for running spin commands via uvx
#Pinned version:
#test that import:
