Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ cmake_install.cmake
.cache/
.idea/
*.log

# pixi environments
.pixi
*.egg-info
13,624 changes: 13,624 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

280 changes: 280 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
[project]
name = "coremltools"
channels = ["conda-forge"]
platforms = ["osx-arm64", "osx-64", "linux-64"]

#################################
### Dependencies ###
#################################

# ------------------ #
# Python features #
# ------------------ #

[feature.py39.dependencies]
python = "3.9.*"

[feature.py310.dependencies]
python = "3.10.*"

[feature.py311.dependencies]
python = "3.11.*"

[feature.py312.dependencies]
python = "3.12.*"

# ------------------ #
# Build features #
# ------------------ #

[feature.build.dependencies]
cmake = ">=3.30.5,<4"
clang = ">=19.1.3,<20"

[feature.build.pypi-dependencies]
six = ">=1.16.0, <2"
sympy = ">=1.13.3, <2"
tqdm = ">=4.67.0, <5"
wheel = ">=0.45.0, <0.46"
attrs = ">=24.2.0, <25"
cattrs = ">=24.1.2, <25"
pyaml = ">=24.9.0, <25"
numpy = "==2.0.0"

# ------------------ #
# Test features #
# ------------------ #

# Dependencies for all platforms and python versions
[feature.test.pypi-dependencies]
boto3 = "==1.14.8"
configparser = ">=7.1.0, <8"
future = ">=1.0.0, <2"
olefile = "==0.44"
pandas = ">=2.0.3, <3"
parameterized = "==0.8.1"
protobuf = ">=5.28.3, <6"
pillow = ">=10.4.0, <12"
pytest = "==7.1.2"
pytest-cov = ">=5.0.0, <7"
pytest-sugar = ">=1.0.0, <2"
six = ">=1.16.0, <2"
sympy = ">1.6"
gast = "==0.4.0"
mock = ">=5.1.0, <6"
wrapt = ">=1.16.0, <2"
tqdm = ">=4.67.0, <5"
pytest-timeout = ">=2.3.1, <3"
peft = ">=0.13.2, <0.14"
filelock = "==3.6.0"
pytest-flake8 = "==1.0.7"
pytest-xdist = "==2.5.0"
pytest-mock = "==3.8.2"
scikit-learn = "==1.5.1"

# Dependencies for osx-arm64 and all python versions
[feature.test.target.osx-arm64.pypi-dependencies]
transformers = "==4.38.2"
timm = "==0.6.13"
torchsr = "==1.0.4"
torchvision = "==0.19.0"
torchaudio = "==2.4.0"
torch = "==2.4.0"
scipy = ">=1.13.1, <2"
numpy = "==2.0.0"

# Dependencies for osx-64 and all python versions
[feature.test.target.osx-64.pypi-dependencies]
transformers = "==4.26.0"
xgboost = "==1.4.2"
torchvision = "==0.17.0"
torchaudio = "==2.2.0"
torch = "==2.2.0"
numpy = ">1.18.4"

# Dependencies for linux-64 and all python versions
[feature.test.target.linux-64.pypi-dependencies]
transformers = "==4.26.0"
xgboost = "==1.4.2"
torchvision = "==0.17.0"
torchaudio = "==2.2.0"
torch = "==2.2.0"
numpy = ">1.18.4"

# Dependencies for osx-64 and python 3.9
[feature.test-py39-specific.target.osx-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.8.1"

# Dependencies for linux-64 and python 3.9
[feature.test-py39-specific.target.linux-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.8.1"

# Dependencies for osx-64 and python 3.10
[feature.test-py310-specific.target.osx-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.8.1"

# Dependencies for linux-64 and python 3.10
[feature.test-py310-specific.target.linux-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.8.1"

# Dependencies for osx-64 and python 3.11
[feature.test-py311-specific.target.osx-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.9.2"

# Dependencies for linux-64 and python 3.11
[feature.test-py311-specific.target.linux-64.pypi-dependencies]
libsvm = "*"
scipy = "==1.9.2"

# ------------------ #
# TF2 Test features #
# ------------------ #

# TF2 Dependencies for all platforms and all python versions
[feature.test-tf2.pypi-dependencies]
boto3 = "==1.14.8"
numpy = "==1.23.5"
parameterized = "==0.8.1"
pytest = "==7.1.2"
tensorflow-hub = "==0.12.0"
tensorflow-addons = ">=0.23.0, <0.24"

# TF2 Dependencies for osx-arm64 and all python versions
[feature.test-tf2.target.osx-arm64.pypi-dependencies]
tensorflow-macos = "==2.12.0"

# TF2 Dependencies for osx-64 and all python versions
[feature.test-tf2.target.osx-64.pypi-dependencies]
tensorflow = "==2.12.0"
tensorflow-estimator = "==2.12.0"
keras = "==2.12.0"

# TF2 Dependencies for linux-64 and all python versions
[feature.test-tf2.target.linux-64.pypi-dependencies]
tensorflow = "==2.12.0"
tensorflow-estimator = "==2.12.0"

# ------------------ #
# Lint features #
# ------------------ #

[feature.lint.dependencies]
python = "3.10.*"

[feature.lint.pypi-dependencies]
flake8 = ">=7.1.1, <8"
pylint = ">=3.3.1, <4"
yapf = ">=0.40.2, <0.41"

# ------------------ #
# Docs features #
# ------------------ #

[feature.docs.dependencies]
python = "3.10.*"

[feature.docs.pypi-dependencies]
babel = ">=2.16.0, <3"
markupsafe = ">=3.0.2, <4"
pygments = ">=2.18.0, <3"
sphinx = "==7.4.7"
alabaster = ">=0.7.16, <0.8"
certifi = ">=2024.8.30, <2025"
chardet = ">=5.2.0, <6"
docutils = ">=0.21.2, <0.22"
idna = ">=3.10, <4"
imagesize = ">=1.4.1, <2"
myst-parser = ">=3.0.1, <5"
numpy = ">=2.0.0, <3"
numpydoc = ">=1.8.0, <2"
protobuf = "==3.19.6"
pytz = ">=2024.2, <2025"
six = ">=1.16.0, <2"
snowballstemmer = ">=2.2.0, <3"
sphinx-rtd-theme = ">=3.0.1, <4"
sphinx-book-theme = ">=1.1.3, <2"
sphinxcontrib-websupport = ">=2.0.0, <3"
sphinx-gallery = ">=0.18.0, <0.19"
sphinx-code-tabs = ">=0.5.5, <0.6"
sphinx-copybutton = ">=0.5.2, <0.6"
sympy = ">=1.13.3, <2"
typing = ">=3.7.4.3, <4"
urllib3 = ">=2.2.3, <3"
torch = ">=1.13.0"
scikit-learn = ">=1.5.2, <2"
pillow = ">=11.0.0, <12"


#################################
### Tasks ###
#################################

# ------------------ #
# Build Tasks #
# ------------------ #
[feature.build.tasks]
build = "echo 'Building coremltools'"
# build = "something"
# clean

# ------------------ #
# Test Tasks #
# ------------------ #
[feature.test.tasks]
# test = "something"

# ------------------ #
# Lint Tasks #
# ------------------ #
[feature.lint.tasks]
# style = "something", runs yapf
# check-style = "something", runs yapf
# lint = "something", depends pylint and flake8
# _flake
# _pylint

# ------------------ #
# Docs Tasks #
# ------------------ #
[feature.docs.tasks]
clean-guide = { cmd = "sphinx-build -M clean . _build", cwd = "docs-guides" }
build-guide = { cmd = "sphinx-build -M html . _build", depends-on = [
"clean",
], cwd = "docs-guides" }
clean-api-docs = { cmd = "sphinx-build -M clean . _build", cwd = "docs" }
build-api-docs = { cmd = "sphinx-build -M html . _build", depends-on = [
"clean-api-docs",
], cwd = "docs" }
clean = { depends-on = ["clean-guide", "clean-api-docs"] }
build = { depends-on = [
"build-guide",
"build-api-docs",
] } # TODO: Make this depend on coremltools build?

#################################
### Environments ###
#################################

[environments]
py39-build = ["py39", "build"]
py39-test = ["py39", "test", "test-py39-specific"]
py39-test-tf2 = ["py39", "test-tf2"]

py310-build = ["py310", "build"]
py310-test = ["py310", "test", "test-py310-specific"]
py310-test-tf2 = ["py310", "test-tf2"]

py311-build = ["py311", "build"]
py311-test = ["py311", "test", "test-py311-specific"]
py311-test-tf2 = ["py311", "test-tf2"]

py312-build = ["py312", "build"]
py312-test = ["py312", "test"]

lint = ["lint"]
docs = ["docs"]
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[project]
name = "coremltools"
version = "8.0"
description = "Community Tools for Core ML"
authors = [{ name = "Apple Inc.", email = "[email protected]" }]
dependencies = [
"setuptools>=75.3.0",
"attrs>=21.3.0",
"cattrs",
"numpy >= 1.14.5",
"packaging",
"protobuf >= 3.1.0",
"pyaml",
"sympy",
"tqdm",
]
requires-python = ">=3.7"
readme = "README.md"
license = { text = "BSD" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
]

[project.urls]
Homepage = "https://github.com/apple/coremltools"

[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "wheel"]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["osx-arm64", "osx-64", "linux-64"]

[tool.pixi.pypi-dependencies]
coremltools = { path = ".", editable = true }

[tool.pixi.tasks]

[tool.pixi.feature.py37.dependencies]
python = "3.7.*"

[tool.pixi.feature.py38.dependencies]
python = "3.8.*"

[tool.pixi.feature.py39.dependencies]
python = "3.9.*"

[tool.pixi.feature.py310.dependencies]
python = "3.10.*"

[tool.pixi.feature.py311.dependencies]
python = "3.11.*"
17 changes: 17 additions & 0 deletions tools/get_pixi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$script_dir/pixi_settings.env"

PIXI_HOME="$script_dir/../.pixi"
export PIXI_HOME PIXI_NO_PATH_UPDATE PIXI_VERSION PIXI_CACHE_DIR

pixi_binary="${PIXI_HOME}/bin/pixi"

if [[ ! -x "$pixi_binary" ]]; then
echo "Installing Pixi..."
curl -fsSL https://pixi.sh/install.sh | bash
fi

export pixi="$pixi_binary"
4 changes: 4 additions & 0 deletions tools/pixi_settings.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PIXI_PATH=.pixi
PIXI_NO_PATH_UPDATE=true
PIXI_VERSION=v0.30.0
PIXI_CACHE_DIR=".pixi/.cache/rattler"
7 changes: 7 additions & 0 deletions tools/run_pixi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$script_dir/get_pixi.sh"

"$pixi" "$@"