Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python version metadata (remove 3.7, 3.8, 3.9; add 3.13). #23067

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
18 changes: 5 additions & 13 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
12 changes: 3 additions & 9 deletions docs/Coding_Conventions_and_Standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 7 additions & 4 deletions orttraining/orttraining/python/training/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
black>=22.3
-r requirements-lintrunner.txt
cerberus
flatbuffers
isort
jinja2
numpy
onnx
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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:
Expand Down
Loading