Skip to content

Conversation

@Ayush10
Copy link

@Ayush10 Ayush10 commented Jan 31, 2026

Summary

  • Adds isort for automatic import sorting (black-compatible profile, line length 120)
  • Enhances .pre-commit-config.yaml with additional hooks:
    • trailing-whitespace, end-of-file-fixer, check-yaml, debug-statements, check-added-large-files
    • isort hook for automatic import sorting on commit
    • Fixed black hook to use proper arg format and exclude _version.py
  • Adds make fix target for one-command auto-formatting (black + isort + nbqa)
  • Adds make isort check target and includes it in make lint
  • Adds isort check step to CI workflow (test_qlib_from_source.yml)
  • Configures [tool.isort] and [tool.black] in pyproject.toml
  • Applies initial import sorting across all 177 Python files (mechanical, auto-generated)

Changes breakdown

Commit Description Files
1st Add tooling config (pre-commit, Makefile, pyproject.toml, CI) 4
2nd Auto-fix import sorting via isort qlib scripts 177

How developers use this

# Auto-fix all formatting issues (black + isort + nbqa)
make fix

# Check only (used in CI)
make lint    # includes: black, isort, pylint, flake8, mypy, nbqa

# Pre-commit hooks run automatically on git commit
pre-commit install

Test plan

  • isort --check-only qlib scripts passes after fix
  • Key imports verified: qlib.config, qlib.data.ops, qlib.contrib.strategy
  • All import changes are mechanical (no logic modifications)
  • Existing tests pass without modification

Closes #2060

Ayush Ojha added 2 commits January 30, 2026 23:56
- Add isort for import sorting with black-compatible profile
- Add pre-commit hooks: trailing-whitespace, end-of-file-fixer,
  check-yaml, debug-statements, check-added-large-files
- Add isort check to CI workflow (test_qlib_from_source.yml)
- Add 'make fix' target for auto-formatting (black + isort + nbqa)
- Add 'make isort' target for import sort checking
- Add isort to lint dependencies in pyproject.toml
- Configure [tool.isort] and [tool.black] sections in pyproject.toml

Refs microsoft#2060
Run 'isort qlib scripts' to sort all imports according to the
isort configuration added in the previous commit. All changes are
mechanical — no logic modifications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto lint fix in CI

1 participant