Files
pytorch/pyproject.toml
Xuehai Pan 90b973a2e2 [BE] parse CMake version from cmake -E capabilities instead of cmake --version (#157073)
`cmake -E capabilities` produces a JSON format that is more machine-friendly.

```console
$ cmake --version
cmake version 4.0.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cmake -E capabilities | jq '.version.string'
"4.0.3"
$ cmake -E capabilities | jq
{
  "debugger": true,
  "fileApi": {
    "requests": [
      {
        "kind": "codemodel",
        "version": [
          {
            "major": 2,
            "minor": 8
          }
        ]
      },
      {
        "kind": "configureLog",
        "version": [
          {
            "major": 1,
            "minor": 0
          }
        ]
      },
      {
        "kind": "cache",
        "version": [
          {
            "major": 2,
            "minor": 0
          }
        ]
      },
      {
        "kind": "cmakeFiles",
        "version": [
          {
            "major": 1,
            "minor": 1
          }
        ]
      },
      {
        "kind": "toolchains",
        "version": [
          {
            "major": 1,
            "minor": 0
          }
        ]
      }
    ]
  },
  "generators": [
    {
      "extraGenerators": [],
      "name": "Watcom WMake",
      "platformSupport": false,
      "toolsetSupport": false
    },
    {
      "extraGenerators": [
        "Kate"
      ],
      "name": "Ninja Multi-Config",
      "platformSupport": false,
      "toolsetSupport": false
    },
    {
      "extraGenerators": [
        "CodeBlocks",
        "CodeLite",
        "Eclipse CDT4",
        "Kate",
        "Sublime Text 2"
      ],
      "name": "Ninja",
      "platformSupport": false,
      "toolsetSupport": false
    },
    {
      "extraGenerators": [],
      "name": "Xcode",
      "platformSupport": false,
      "toolsetSupport": true
    },
    {
      "extraGenerators": [
        "CodeBlocks",
        "CodeLite",
        "Eclipse CDT4",
        "Kate",
        "Sublime Text 2"
      ],
      "name": "Unix Makefiles",
      "platformSupport": false,
      "toolsetSupport": false
    }
  ],
  "serverMode": false,
  "tls": true,
  "version": {
    "isDirty": false,
    "major": 4,
    "minor": 0,
    "patch": 3,
    "string": "4.0.3",
    "suffix": ""
  }
}
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157073
Approved by: https://github.com/Skylion007
2025-06-28 23:20:10 +00:00

288 lines
6.8 KiB
TOML

[project]
name = "torch"
requires-python = ">=3.9"
license = {text = "BSD-3-Clause"}
dynamic = [
"authors",
"classifiers",
"entry-points",
"dependencies",
"description",
"keywords",
"optional-dependencies",
"readme",
"scripts",
"version",
]
[project.urls]
Homepage = "https://pytorch.org/"
Documentation = "https://pytorch.org/docs/"
Source = "https://github.com/pytorch/pytorch"
Forum = "https://discuss.pytorch.org/"
[build-system]
requires = [
# After 75.8.2 dropped dep disttools API. Please fix
# API temporarily restored and shim used. Please fix
# Setuptools will drop support for setup.py past 80
# min version for recursive glob package data support
"setuptools>=62.3.0,<80.0",
"wheel",
"astunparse",
"cmake",
"ninja",
"numpy",
"packaging",
"pyyaml",
"requests",
"typing-extensions>=4.10.0",
]
# Use legacy backend to import local packages in setup.py
build-backend = "setuptools.build_meta:__legacy__"
[tool.black]
line-length = 88
[tool.isort]
src_paths = ["caffe2", "torch", "torchgen", "functorch", "test"]
extra_standard_library = ["typing_extensions"]
skip_gitignore = true
skip_glob = ["third_party/*"]
atomic = true
profile = "black"
indent = 4
line_length = 88
lines_after_imports = 2
multi_line_output = 3
include_trailing_comma = true
combine_as_imports = true
[tool.usort.known]
first_party = ["caffe2", "torch", "torchgen", "functorch", "test"]
standard_library = ["typing_extensions"]
[tool.ruff]
line-length = 88
src = ["caffe2", "torch", "torchgen", "functorch", "test"]
[tool.ruff.format]
docstring-code-format = true
quote-style = "double"
[tool.ruff.lint]
# NOTE: Synchoronize the ignores with .flake8
external = [
"B001",
"B902",
"B950",
"E121",
"E122",
"E128",
"E131",
"E704",
"E723",
"F723",
"F812",
"P201",
"P204",
"T484",
"TOR901",
]
ignore = [
# these ignores are from flake8-bugbear; please fix!
"B007", "B008", "B017",
"B018", # Useless expression
"B023",
"B028", # No explicit `stacklevel` keyword argument found
"E402",
"C408", # C408 ignored because we like the dict keyword argument syntax
"E501", # E501 is not flexible enough, we're using B950 instead
"E721",
"E741",
"EXE001",
"F405",
# these ignores are from flake8-logging-format; please fix!
"G101",
# these ignores are from ruff NPY; please fix!
"NPY002",
# these ignores are from ruff PERF; please fix!
"PERF203",
"PERF401",
# these ignores are from PYI; please fix!
"PYI024",
"PYI036",
"PYI041",
"PYI056",
"SIM102", "SIM103", "SIM112", # flake8-simplify code styles
"SIM105", # these ignores are from flake8-simplify. please fix or ignore with commented reason
"SIM108", # SIM108 ignored because we prefer if-else-block instead of ternary expression
"SIM110",
"SIM114", # Combine `if` branches using logical `or` operator
"SIM115",
"SIM116", # Disable Use a dictionary instead of consecutive `if` statements
"SIM117",
"SIM118",
"UP007", # keep-runtime-typing
"TC006",
]
select = [
"B",
"B904", # Re-raised error without specifying the cause via the from keyword
"C4",
"G",
"E",
"EXE",
"F",
"SIM1",
"SIM911",
"W",
# Not included in flake8
"FURB",
"LOG",
"NPY",
"PERF",
"PGH004",
"PIE790",
"PIE794",
"PIE800",
"PIE804",
"PIE807",
"PIE810",
"PLC0131", # type bivariance
"PLC0132", # type param mismatch
"PLC0205", # string as __slots__
"PLC3002", # unnecessary-direct-lambda-call
"PLE",
"PLR0133", # constant comparison
"PLR0206", # property with params
"PLR1722", # use sys exit
"PLR1736", # unnecessary list index
"PLW0129", # assert on string literal
"PLW0131", # named expr without context
"PLW0133", # useless exception statement
"PLW0245", # super without brackets
"PLW0406", # import self
"PLW0711", # binary op exception
"PLW1501", # bad open mode
"PLW1507", # shallow copy os.environ
"PLW1509", # preexec_fn not safe with threads
"PLW2101", # useless lock statement
"PLW3301", # nested min max
"PT006", # TODO: enable more PT rules
"PT014", # duplicate parameterize case
"PT022",
"PT023",
"PT024",
"PT025",
"PT026",
"PYI",
"Q003", # avoidable escaped quote
"Q004", # unnecessary escaped quote
"RSE",
"RUF008", # mutable dataclass default
"RUF013", # ban implicit optional
"RUF015", # access first ele in constant time
"RUF016", # type error non-integer index
"RUF017",
"RUF018", # no assignment in assert
"RUF019", # unnecessary-key-check
"RUF020", # never union
"RUF024", # from keys mutable
"RUF026", # default factory kwarg
"RUF030", # No print statement in assert
"RUF033", # default values __post_init__ dataclass
"RUF041", # simplify nested Literal
"RUF048", # properly parse `__version__`
"RUF200", # validate pyproject.toml
"S324", # for hashlib FIPS compliance
"SLOT",
"TC",
"TRY002", # ban vanilla raise (todo fix NOQAs)
"TRY203",
"TRY401", # verbose-log-message
"UP",
"YTT",
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401",
]
"*.pyi" = [
"PYI011", # typed-argument-default-in-stub
"PYI021", # docstring-in-stub
"PYI053", # string-or-bytes-too-long
]
"functorch/notebooks/**" = [
"F401",
]
"test/export/**" = [
"PGH004"
]
"test/typing/**" = [
"PGH004"
]
"test/typing/reveal/**" = [
"F821",
]
"test/torch_np/numpy_tests/**" = [
"F821",
"NPY201",
]
"test/dynamo/test_bytecode_utils.py" = [
"F821",
]
"test/dynamo/test_debug_utils.py" = [
"UP037",
]
"test/dynamo/test_misc.py" = [
"PGH004",
]
"test/jit/**" = [
"PLR0133", # tests require this for JIT
"PYI",
"RUF015",
"UP", # We don't want to modify the jit test as they test specify syntax
]
"test/test_jit.py" = [
"PLR0133", # tests require this for JIT
"PYI",
"RUF015",
"UP", # We don't want to modify the jit test as they test specify syntax
]
"test/inductor/s429861_repro.py" = [
"PGH004",
]
"test/inductor/test_torchinductor.py" = [
"UP037",
]
# autogenerated #TODO figure out why file level noqa is ignored
"torch/_appdirs.py" = ["PGH004"]
"torch/jit/_shape_functions.py" = ["PGH004"]
"torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"]
"torch/_inductor/autoheuristic/artifacts/**" = ["F401", "F501"]
"torch/_inductor/codegen/**" = [
"PGH004"
]
"torchgen/api/types/__init__.py" = [
"F401",
"F403",
]
"torch/utils/collect_env.py" = [
"UP", # collect_env.py needs to work with older versions of Python
]
"torch/_vendor/**" = [
"UP", # No need to mess with _vendor
]
"tools/linter/**" = [
"LOG015" # please fix
]
[tool.codespell]
ignore-words = "tools/linter/dictionary.txt"