Skip to content

Commit a1bb7a5

Browse files
committed
Initial commit
0 parents  commit a1bb7a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+10743
-0
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: LLVM
2+
ColumnLimit: 120

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CompileFlags:
2+
CompilationDatabase: build-vscode/

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
env:
5+
CIBW_BUILD_VERBOSITY: 3
6+
CIBW_TEST_REQUIRES: "pytest"
7+
CIBW_TEST_COMMAND: "pytest -svv {project}/tests/python/"
8+
MLC_CIBW_VERSION: "2.20.0"
9+
MLC_PYTHON_VERSION: "3.9"
10+
MLC_CIBW_WIN_BUILD: "cp39-win_amd64"
11+
MLC_CIBW_MAC_BUILD: "cp39-macosx_arm64"
12+
MLC_CIBW_LINUX_BUILD: "cp313-manylinux_x86_64"
13+
14+
jobs:
15+
pre-commit:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ env.MLC_PYTHON_VERSION }}
22+
- uses: pre-commit/[email protected]
23+
windows:
24+
name: Windows
25+
runs-on: windows-latest
26+
needs: pre-commit
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
submodules: "recursive"
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ env.MLC_PYTHON_VERSION }}
34+
- name: Install cibuildwheel
35+
run: python -m pip install cibuildwheel=="${{ env.MLC_CIBW_VERSION }}"
36+
- name: Build wheels
37+
run: python -m cibuildwheel --output-dir wheelhouse
38+
env:
39+
CIBW_BEFORE_ALL: ".\\scripts\\cpp_tests.bat"
40+
CIBW_BUILD: ${{ env.MLC_CIBW_WIN_BUILD }}
41+
- name: Show package contents
42+
run: python scripts/show_wheel_content.py wheelhouse
43+
macos:
44+
name: MacOS
45+
runs-on: macos-latest
46+
needs: pre-commit
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
submodules: "recursive"
51+
- uses: actions/setup-python@v5
52+
with:
53+
python-version: ${{ env.MLC_PYTHON_VERSION }}
54+
- name: Install cibuildwheel
55+
run: python -m pip install cibuildwheel==${{ env.MLC_CIBW_VERSION }}
56+
- name: Build wheels
57+
run: python -m cibuildwheel --output-dir wheelhouse
58+
env:
59+
CIBW_BEFORE_ALL: "./scripts/cpp_tests.sh"
60+
CIBW_BUILD: ${{ env.MLC_CIBW_MAC_BUILD }}
61+
- name: Show package contents
62+
run: python scripts/show_wheel_content.py wheelhouse
63+
linux:
64+
name: Linux
65+
runs-on: ubuntu-latest
66+
needs: pre-commit
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
submodules: "recursive"
71+
- uses: actions/setup-python@v5
72+
with:
73+
python-version: ${{ env.MLC_PYTHON_VERSION }}
74+
- name: Install cibuildwheel
75+
run: python -m pip install cibuildwheel==${{ env.MLC_CIBW_VERSION }}
76+
- name: Build wheels
77+
run: python -m cibuildwheel --output-dir wheelhouse
78+
env:
79+
CIBW_BEFORE_ALL: "./scripts/setup_manylinux2014.sh && ./scripts/cpp_tests.sh"
80+
CIBW_BUILD: ${{ env.MLC_CIBW_LINUX_BUILD }}
81+
- name: Show package contents
82+
run: python scripts/show_wheel_content.py wheelhouse

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
CIBW_BUILD_VERBOSITY: 3
9+
CIBW_TEST_REQUIRES: "pytest"
10+
CIBW_TEST_COMMAND: "pytest -svv {project}/tests/python/"
11+
CIBW_SKIP: "cp313-win_amd64" # Python 3.13 is not quite ready yet
12+
MLC_CIBW_VERSION: "2.20.0"
13+
MLC_PYTHON_VERSION: "3.9"
14+
MLC_CIBW_WIN_BUILD: "cp3*-win_amd64"
15+
MLC_CIBW_MAC_BUILD: "cp3*-macosx_arm64"
16+
MLC_CIBW_LINUX_BUILD: "cp3*-manylinux_x86_64"
17+
18+
jobs:
19+
pre-commit:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ env.MLC_PYTHON_VERSION }}
26+
- uses: pre-commit/[email protected]
27+
windows:
28+
name: Windows
29+
runs-on: windows-latest
30+
needs: pre-commit
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
submodules: "recursive"
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: ${{ env.MLC_PYTHON_VERSION }}
38+
- name: Install cibuildwheel
39+
run: python -m pip install twine cibuildwheel=="${{ env.MLC_CIBW_VERSION }}"
40+
- name: Build wheels
41+
run: python -m cibuildwheel --output-dir wheelhouse
42+
env:
43+
CIBW_BUILD: ${{ env.MLC_CIBW_WIN_BUILD }}
44+
- name: Show package contents
45+
run: python scripts/show_wheel_content.py wheelhouse
46+
- name: Upload wheels
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: wheels-windows
50+
path: ./wheelhouse/*.whl
51+
macos:
52+
name: MacOS
53+
runs-on: macos-latest
54+
needs: pre-commit
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
submodules: "recursive"
59+
- uses: actions/setup-python@v5
60+
with:
61+
python-version: ${{ env.MLC_PYTHON_VERSION }}
62+
- name: Install cibuildwheel
63+
run: python -m pip install twine cibuildwheel==${{ env.MLC_CIBW_VERSION }}
64+
- name: Build wheels
65+
run: python -m cibuildwheel --output-dir wheelhouse
66+
env:
67+
CIBW_BUILD: ${{ env.MLC_CIBW_MAC_BUILD }}
68+
- name: Show package contents
69+
run: python scripts/show_wheel_content.py wheelhouse
70+
- name: Upload wheels
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: wheels-macos
74+
path: ./wheelhouse/*.whl
75+
linux:
76+
name: Linux
77+
runs-on: ubuntu-latest
78+
needs: pre-commit
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
submodules: "recursive"
83+
- uses: actions/setup-python@v5
84+
with:
85+
python-version: ${{ env.MLC_PYTHON_VERSION }}
86+
- name: Install cibuildwheel
87+
run: python -m pip install twine cibuildwheel==${{ env.MLC_CIBW_VERSION }}
88+
- name: Build wheels
89+
run: python -m cibuildwheel --output-dir wheelhouse
90+
env:
91+
CIBW_BUILD: ${{ env.MLC_CIBW_LINUX_BUILD }}
92+
- name: Show package contents
93+
run: python scripts/show_wheel_content.py wheelhouse
94+
- name: Upload wheels
95+
uses: actions/upload-artifact@v3
96+
with:
97+
name: wheels-linux
98+
path: ./wheelhouse/*.whl
99+
publish:
100+
name: Publish
101+
runs-on: ubuntu-latest
102+
needs: [windows, macos, linux]
103+
environment:
104+
name: pypi
105+
url: https://pypi.org/p/mlc-python
106+
steps:
107+
- uses: actions/setup-python@v5
108+
with:
109+
python-version: ${{ env.MLC_PYTHON_VERSION }}
110+
- name: Download all artifacts
111+
uses: actions/download-artifact@v3
112+
with:
113+
path: ./wheelhouse
114+
- name: Prepare distribution files
115+
run: |
116+
mkdir -p dist
117+
mv wheelhouse/wheels-macos/*.whl dist/
118+
mv wheelhouse/wheels-linux/*.whl dist/
119+
mv wheelhouse/wheels-windows/*.whl dist/
120+
- name: Publish to PyPI
121+
uses: pypa/gh-action-pypi-publish@release/v1
122+
with:
123+
packages-dir: dist/
124+
password: ${{ secrets.MLC_PYPI_API_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode
2+
*.dSYM
3+
build
4+
build-cpp-tests

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "3rdparty/dlpack"]
2+
path = 3rdparty/dlpack
3+
url = https://github.com/dmlc/dlpack.git
4+
[submodule "3rdparty/libbacktrace"]
5+
path = 3rdparty/libbacktrace
6+
url = https://github.com/ianlancetaylor/libbacktrace
7+
[submodule "3rdparty/googletest"]
8+
path = 3rdparty/googletest
9+
url = https://github.com/google/googletest.git

.pre-commit-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: mixed-line-ending
9+
- id: end-of-file-fixer
10+
- id: check-yaml
11+
- id: check-toml
12+
- id: check-added-large-files
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.4.7
15+
hooks:
16+
- id: ruff
17+
types_or: [python, pyi, jupyter]
18+
args: [--fix]
19+
- id: ruff-format
20+
types_or: [python, pyi, jupyter]
21+
- repo: https://github.com/pre-commit/mirrors-mypy
22+
rev: "v1.11.1"
23+
hooks:
24+
- id: mypy
25+
additional_dependencies: ['numpy >= 1.22', "ml-dtypes >= 0.1", "pytest"]
26+
args: [--show-error-codes]
27+
- repo: https://github.com/pre-commit/mirrors-clang-format
28+
rev: "v18.1.5"
29+
hooks:
30+
- id: clang-format
31+
- repo: https://github.com/MarcoGorelli/cython-lint
32+
rev: v0.16.2
33+
hooks:
34+
- id: cython-lint
35+
- id: double-quote-cython-strings
36+
- repo: https://github.com/scop/pre-commit-shfmt
37+
rev: v3.8.0-1
38+
hooks:
39+
- id: shfmt
40+
- repo: https://github.com/shellcheck-py/shellcheck-py
41+
rev: v0.10.0.1
42+
hooks:
43+
- id: shellcheck
44+
# - repo: https://github.com/cheshirekow/cmake-format-precommit
45+
# rev: v0.6.10
46+
# hooks:
47+
# - id: cmake-format
48+
# - id: cmake-lint

3rdparty/dlpack

Submodule dlpack added at bbd2f4d

3rdparty/googletest

Submodule googletest added at f8d7d77

3rdparty/libbacktrace

Submodule libbacktrace added at febbb9b

0 commit comments

Comments
 (0)