Skip to content

Commit

Permalink
Prepare for 4.0 release (#528)
Browse files Browse the repository at this point in the history
* Remove deprecated functions (#496)

* Remove deprecated functions

* Remove Java from CI

* Fix tests

* More fix

* Update C API doc

* Fix CI

* Fix CMake example

* Fix temp dir on Windows

* Creat tmpdir

* Remove unused code (#497)

* Remove unused code

* Remove treelite::optional, since it's not used

* Remove unused imports

* typo

* Remove deprecated functions from doc (#498)

* Set up formatting check via pre-commit (#500)

* Set up pre-commit

* Use f-strings

* Fix typo

* Replace setup.py with pyproject.toml (#501)

* Replace setup.py with pyproject.toml

* Replace setup.py with pyproject.toml

* Add script to change version

* Convert pathlib to str before passing it to LoadLibrary

* Fix visibility on Linux

* Fix MacOS wheel build

* Use Mamba to speed up Python env setup

* Move ContiguousArray and TaskType to separate headers (#502)

* Document current v3 serialization format (#504)

* Document current v3 serialization format

* Add missing description

* Clean up serialization logic (#507)

* Clean up serialization logic

* Add missing header

* Add missing header

* Add missing header

* Fix compatibility test

* Add extra check for num_nodes

* Add missing header

* Add missing std::

* Use shared_ptr<> to store ref to mixin

* Don't store iterator in mixin

* Remove stray &

* Document proposed v4 serialization format (#505)

* Document current v3 serialization format

* Add missing description

* Document proposed v4 serialization format

* Fix typo

* Update

* Apply suggestions from code review

* Update docs/serialization/v4.rst

* Update docs/serialization/v4.rst

* Use std::variant in treelite::Model (#508)

* Fix loading from XGBoost 2.0 dev (#509)

* Removed deprecated parameter size_leaf_vector

* Handle iteration_indptr field in JSON

* Add additional metadata for trees (#510)

* Add additional metadata for trees

* Use class_id

* Fix formatting

* Simplify task_type

* Update v4.rst

* Fix serializer test (#512)

* Fix serializer test

* Fix typo

* Use C++ headers from Conda env

* Fix compiler warnings (#513)

* Fix warnings from Visual Studio

* Fix warnings from GCC

* Fix unused parameter warning

* Use std:: prefix for uint32_t and size_t

* Clean up unused parameter warnings

* Refactor sklearn importer to use mix-in classes (#516)

* Minor formatting fixes

* Move sklearn importers to sklearn namespace

* Refactor sklearn importer to use mix-in classes

* Divide tests into multiple files

* Revise v4 spec (#518)

Also simplify doc build

* Fix typo in doc

* Rename NodeType -> TreeNodeType

* Clarify behavior of node stats field

* Name a nameless field

* [Doc] Clarify leaf_vector_shape

* Fix doc build

* Use signed integers for some metadata types, to avoid programming errors

* Clarify the meaning of average_tree_output

* Rename pred_transform -> postprocessor

* Clarify num_class

* Implement Treelite v4 specification (#524)

* Bring in treelite-ng

* Apply linting to CMake files

* Fix CMakeLists.txt

* Fix C++ app example

* Fix build on MacOS

* Fix build on MacOS

* Fix scripts

* Use MacOS 10.15+

* Fix test on MacOS: size_t != uint64_t on MacOS

* Install latest XGBoost in CI

* Don't install if TEST_COVERAGE

* Don't install fmt

* Don't use O0 for test coverage

* Use latest MacOS and Windows workers

* Require MSVC 2022

* Use latest Windows

* Ensure that we use positive int for seeding rng

* Fix build with USE_OPENMP=OFF

* Fix flaky test

* Add back LightGBM

* Install XGBoost from the source

* Fix tests

* [Doc] various fixes (#525)

* [Doc] various fixes

* Update docstring

* Update docstrings

* Add submodules

* Doc fix

* [sklearn] Use more stable interface to get base_scores (#526)

* Doc fix

* Add legacy model builder (#527)

* Add legacy model builder

* Use bysource order
  • Loading branch information
hcho3 authored Oct 25, 2023
1 parent 762f938 commit cf66f23
Show file tree
Hide file tree
Showing 319 changed files with 13,771 additions and 63,879 deletions.
59 changes: 59 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
Language: Cpp
Standard: c++17
BasedOnStyle: Google
TabWidth: 2
IndentWidth: 2
ColumnLimit: 100
UseTab: Never

AccessModifierOffset: -1
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: AfterColon
BreakStringLiterals: true
CompactNamespaces: false
Cpp11BracedListStyle: true
DerivePointerAlignment: false
IndentWrappedFunctionNames: false
InsertBraces: true
IndentCaseLabels: false
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
PointerAlignment: Left
ReflowComments: true
SortIncludes: CaseInsensitive
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
QualifierAlignment: Right
30 changes: 30 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[flake8]
filename = *.py, *.pyx, *.pxd
exclude =
*.egg,
.git,
__pycache__,
build/,
cpp,
docs,
tests/cython/

# Cython Rules ignored:
# E999: invalid syntax (works for Python, not Cython)
# E225: Missing whitespace around operators (breaks cython casting syntax like <int>)
# E226: Missing whitespace around arithmetic operators (breaks cython pointer syntax like int*)
# E227: Missing whitespace around bitwise or shift operator (Can also break casting syntax)
# W503: line break before binary operator (breaks lines that start with a pointer)
# W504: line break after binary operator (breaks lines that end with a pointer)

extend-ignore =
# handled by black
E501, W503, E203
# imported but unused
F401
# redefinition of unused
F811
extend-ignore =
# E203 whitespace before ':'
# https://github.com/psf/black/issues/315
E203
30 changes: 2 additions & 28 deletions .github/workflows/coverage-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
bash ops/cpp-python-coverage.sh
win-python-coverage:
name: Run Python and C++ tests with test coverage (Windows)
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -63,7 +63,7 @@ jobs:
call ops/win-python-coverage.bat
macos-python-coverage:
name: Run Python and C++ tests with test coverage (MacOS)
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -83,29 +83,3 @@ jobs:
shell: bash -l {0}
run: |
bash ops/macos-python-coverage.sh
java-coverage:
name: Run Java tests with test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
with:
cache-downloads: true
cache-env: true
environment-name: dev
environment-file: ops/conda_env/dev.yml
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: treelite4j-${{ runner.os }}-m2-${{ hashFiles('./runtime/java/treelite4j/pom.xml') }}
restore-keys: treelite4j-${{ runner.os }}-m2
- name: Run tests with test coverage computation
shell: bash -l {0}
run: |
bash ops/java-coverage.sh
36 changes: 0 additions & 36 deletions .github/workflows/formatting-check.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/macos-wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
jobs:
macos-wheel-builder:
name: Build and test Python wheels (MacOS)
runs-on: macos-11
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/misc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -72,7 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: pre-commit

on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion .github/workflows/windows-wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
jobs:
windows-wheel-builder:
name: Build and test Python wheels (Windows)
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[settings]
profile=black
known_first_party=treelite,treelite_runtime
known_first_party=treelite
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=4000"]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
- id: cython-lint
- id: double-quote-cython-strings
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: [--config=.flake8]
files: .*$
types: [file]
types_or: [python]
additional_dependencies: [flake8-force]
- repo: local
hooks:
- id: pylint
name: pylint
entry: python dev/run_pylint.py
language: python
types: [python]
additional_dependencies: [
pylint, hatchling, pytest, scikit-learn, hypothesis, pandas, treelite,
lightgbm, xgboost, tqdm
]
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: ["-i", "--style=file:.clang-format"]
language: python
additional_dependencies: [clang-format>=15.0]
types_or: [c, c++]
- id: cpplint
language: python
args: [
"--linelength=100", "--recursive",
"--filter=-build/c++11,-build/include,-build/namespaces_literals,-runtime/references,-build/include_order,+build/include_what_you_use",
"--root=include"]
additional_dependencies: [cpplint]
types_or: [c++]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools, numpy]
1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ sphinx:
python:
install:
- requirements: docs/requirements.txt
system_packages: true
Loading

0 comments on commit cf66f23

Please sign in to comment.