Skip to content
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
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
groups:
dev-dependencies:
dependency-type: "development"
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
quality:
uses: ./.github/workflows/quality.yml
70 changes: 70 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Quality

on:
workflow_call:

permissions:
contents: read

jobs:
quality:
name: Quality gates
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: "3.13"

- name: Sync dev dependencies
run: uv sync --only-group dev --locked

- name: Lint
run: uv run ruff check hft2ane tests

- name: Format check
run: uv run ruff format --check hft2ane tests

- name: Type check
run: uv run basedpyright

- name: Cache pruning
if: always()
run: uv cache prune --ci

tests:
name: Tests
runs-on: macos-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: "3.13"

- name: Sync dependencies
run: uv sync --locked

- name: Tests
run: uv run pytest -m "not convert"

- name: Cache pruning
if: always()
run: uv cache prune --ci
72 changes: 16 additions & 56 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

Expand All @@ -55,24 +52,12 @@ coverage.xml
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/
# Environments
.env
.venv
env/
venv/
ENV/

# Jupyter Notebook
.ipynb_checkpoints
Expand All @@ -84,49 +69,24 @@ ipython_config.py
# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site
# Ruff
.ruff_cache/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# basedpyright
.basedpyright/

# Pyre type checker
.pyre/

# Lock files
# Uncomment whichever applies to your project:
# uv.lock
# poetry.lock

# hft2ane
*.mlpackage
50 changes: 29 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
exclude: ^vendor/
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.264'
hooks:
- id: ruff
args: [--fix]
exclude: ^vendor/
- repo: https://github.com/psf/black
rev: "23.3.0"
hooks:
- id: black
exclude: ^vendor/
- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy
args: ["-p", "hft2ane"]
pass_filenames: false
language: system
types: [python]
require_serial: true
- repo: builtin
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.1
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.3
hooks:
- id: uv-lock

- repo: local
hooks:
- id: basedpyright
name: Type checking (basedpyright)
entry: uv run basedpyright
language: system
types: [python]
pass_filenames: false
26 changes: 11 additions & 15 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
"python.analysis.autoImportCompletions": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
,
"files.exclude": {
"**/__pycache__": true
},
"search.exclude": {
"**/__pycache__": true
},
"files.watcherExclude": {
"**/__pycache__": true
}
}
"python.testing.pytestEnabled": true,
"python.analysis.typeCheckingMode": "standard",
"python.analysis.extraPaths": [
"vendor/ml-ane-transformers",
"vendor/exporters/src"
],
"files.exclude": { "**/__pycache__": true },
"search.exclude": { "**/__pycache__": true, "vendor/**": true },
"files.watcherExclude": { "**/__pycache__": true }
}
6 changes: 3 additions & 3 deletions MAINTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ Uses Apple's `powermetrics` (requires sudo) via `asitop` to measure ANE power dr

```bash
# Collect tests (structural check — imports, no broken references)
poetry run pytest tests/ --collect-only
uv run pytest tests/ --collect-only

# Run tests (requires macOS with coremltools for test_bert.py)
poetry run pytest tests/
uv run pytest tests/

# Pre-commit hooks
poetry run pre-commit run --all-files
prek run --all-files
```

Note: `test_bert.py` imports `coremltools` at module level so it will fail to collect on non-macOS or without `coremltools` installed. The other test files (distilbert, roberta) collect and run without it.
Loading