diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 64785574c7728..8d966d358de01 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset. + # Use the version configured in target-version of [tool.black] section in pyproject.toml. python-version: "3.10" - name: Setup Rust uses: actions-rs/toolchain@v1 @@ -55,12 +55,10 @@ jobs: - name: Update PATH run: | echo "$HOME/.local/bin" >> "$GITHUB_PATH" - - name: Install dependencies run: | set -e -x python -m pip install --user -r requirements-dev.txt - python -m pip install --user lintrunner lintrunner-adapters lintrunner init - name: Run lintrunner on all files run: | diff --git a/.lintrunner.toml b/.lintrunner.toml index be46ba0baabdb..5ef9ad9337f57 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -2,31 +2,23 @@ # You can install the dependencies and initialize with # # ```sh -# pip install lintrunner lintrunner-adapters +# pip install -r requirements-lintrunner.txt # lintrunner init # ``` # # This will install lintrunner on your system and download all the necessary # dependencies to run linters locally. -# If you want to see what lintrunner init will install, run -# `lintrunner init --dry-run`. # -# To lint local changes: +# To format local changes: # # ```bash -# lintrunner +# lintrunner -a # ``` # -# To lint all files: +# To format all files: # # ```bash -# lintrunner --all-files -# ``` -# -# To format files: -# -# ```bash -# lintrunner f --all-files +# lintrunner -a --all-files # ``` # # To read more about lintrunner, see [wiki](https://github.com/pytorch/pytorch/wiki/lintrunner). diff --git a/docs/Coding_Conventions_and_Standards.md b/docs/Coding_Conventions_and_Standards.md index f18f1036efee8..02af7ddaa49be 100644 --- a/docs/Coding_Conventions_and_Standards.md +++ b/docs/Coding_Conventions_and_Standards.md @@ -164,22 +164,16 @@ dependencies to run linters locally. If you want to see what lintrunner init will install, run `lintrunner init --dry-run`. -To lint local changes: - -```bash -lintrunner -``` - -To format files and apply suggestions: +To format local changes: ```bash lintrunner -a ``` -To lint all files: +To format all files: ```bash -lintrunner --all-files +lintrunner -a --all-files ``` To show help text: diff --git a/orttraining/orttraining/python/training/artifacts.py b/orttraining/orttraining/python/training/artifacts.py index c98e5bcd97092..31591c0156b14 100644 --- a/orttraining/orttraining/python/training/artifacts.py +++ b/orttraining/orttraining/python/training/artifacts.py @@ -185,10 +185,13 @@ def build(self, *inputs_to_loss): logging.info("Custom op library provided: %s", custom_op_library) custom_op_library_path = pathlib.Path(custom_op_library) - with onnxblock.base(loaded_model, model_path), ( - onnxblock.custom_op_library(custom_op_library_path) - if custom_op_library is not None - else contextlib.nullcontext() + with ( + onnxblock.base(loaded_model, model_path), + ( + onnxblock.custom_op_library(custom_op_library_path) + if custom_op_library is not None + else contextlib.nullcontext() + ), ): _ = training_block(*[output.name for output in loaded_model.graph.output]) training_model, eval_model = training_block.to_model_proto() diff --git a/orttraining/orttraining/python/training/ortmodule/_graph_transition_manager.py b/orttraining/orttraining/python/training/ortmodule/_graph_transition_manager.py index 22627749c316c..d9cae8e1f99e8 100755 --- a/orttraining/orttraining/python/training/ortmodule/_graph_transition_manager.py +++ b/orttraining/orttraining/python/training/ortmodule/_graph_transition_manager.py @@ -867,8 +867,9 @@ def _get_exported_model( assert model_info_for_export.export_mode is not None, "Please use a concrete instance of ExecutionManager" try: - with torch.no_grad(), stage3_export_context( - enable_zero_stage3_support, stage3_param_handle, flattened_module + with ( + torch.no_grad(), + stage3_export_context(enable_zero_stage3_support, stage3_param_handle, flattened_module), ): required_export_kwargs = { "input_names": model_info_for_export.onnx_graph_input_names, # did not contains parameters as its input yet diff --git a/pyproject.toml b/pyproject.toml index 6429df2722b2d..40e6eb96dff94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,8 @@ line-length = 120 # NOTE: Do not extend the exclude list. Edit .lintrunner.toml instead extend-exclude = "cmake|onnxruntime/core/flatbuffers/" -target-version = ["py37", "py38", "py39", "py310", "py311"] +# NOTE: use the minimum supported python version as target-version +target-version = ["py310"] [tool.isort] # NOTE: Do not extend the exclude list. Edit .lintrunner.toml instead diff --git a/requirements-dev.txt b/requirements-dev.txt index 1b5ca65cf8037..b95b85781a398 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,6 @@ -black>=22.3 +-r requirements-lintrunner.txt cerberus flatbuffers -isort jinja2 numpy onnx diff --git a/setup.py b/setup.py index 1ca31cb0019f0..c1580eeb9e8f9 100644 --- a/setup.py +++ b/setup.py @@ -529,6 +529,8 @@ def finalize_options(self): "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Artificial Intelligence", @@ -537,14 +539,10 @@ def finalize_options(self): "Topic :: Software Development :: Libraries :: Python Modules", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS", + "Programming Language :: Python :: 3.13", ] if enable_training or enable_training_apis: