6 Commits

Author SHA1 Message Date
Tianqi Chen 9a8320acbd [LINT][PYTHON] Modernize annotations with ruff UP rules (#18830)
This PR enables ruff pyupgrade (UP) rules with py310 target, auto-fixing
~5600 annotation modernizations (PEP 585 generics, PEP 604 unions,
deprecated typing imports).

Also removes from __future__ import annotations from ir/module.py and
rmsnorm.py, bumps requires-python to >=3.10, and removes absolute_import
aliases from topi/contrib files.
2026-02-27 21:29:47 -05:00
Tianqi Chen 33dcea1686 [REFACTOR][LINT] Modernize ruff config (#18810)
This PR removes the extra lint violations from the codebase so lint
aligns with the latest style
2026-02-23 07:29:21 -05:00
Siyuan Feng 795fc32d99 [SCRIPT] Bump Python minimum version to 3.9 and update AST compatibility (#18086)
- Set Python minimal version to 3.9 as Python 3.8 has reached end of life
- Update AST handling to match Python 3.9+ API changes
- Fix deprecation warning: "Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15"
- Update TVMScript parser components to use modern AST interfaces
- Adjust linting and test infrastructure for Python 3.9+ compatibility
2025-06-23 13:04:07 -04:00
Siyuan Feng 43e7676ba2 [Script] Remove deprecated attributes from Constant AST node (#18066)
[ARITH] Remove deprecated attributes from Constant AST node

Remove the deprecated `s` and `n` attributes from the `Constant` AST node
class in the script parser. These attributes were previously used for
string and numeric constants but are no longer needed in the current
AST implementation.

Updated all code that creates `Constant` objects to remove the
corresponding parameters:
- Removed `s` and `n` parameters from `Constant.__init__`
- Updated `_FIELDS` list to exclude deprecated attributes
- Fixed calls in `evaluator.py` and `parser.py` to remove extra arguments

This change simplifies the AST structure and removes unused legacy code.
2025-06-17 08:25:27 -04:00
Krzysztof Parzyszek 18467c95dd [Script] Be more careful when generating ast.ExtSlice for Subscript (#15483)
* [Script] Be more careful when generating ast.ExtSlice for Subscript

The ast.ExtSlice expects a non-empty list, otherwise evaluation
fails with "error: empty dims on ExtSlice". Also, each element
in "dims" list of ExtSlice must be either Slice or Index.

In python3.8 an expression A[()] is parsed (by ast) as Subscript
with slice being Index(value=Tuple(elts=[])). When we translate a
subscript from doc.AST to ast, we unconditionally convert every
tuple to ast.ExtSlice, which in this case is incorrect.

The fix is to map empty tuple back to the Index(Tuple[])) instead
of ExtSlice. In other cases, ensure that members of ExtSlice are
of correct types.

* Fix lint #1
2023-08-04 19:41:01 -05:00
Junru Shao b20b7c4ad4 [TVMScript] Reorganize the folder structure (#12496)
This PR introduces some minor restructuring of the `python/tvm/script`
folder structure to make it more convenient for future upstreaming.

Co-authored-by: Yaxing Cai <caiyaxing666@gmail.com>
2022-11-12 01:25:23 -05:00