Skip to content

Commit a614a28

Browse files
committed
chore(release): updates for pre 0.2.1 release
- version 0.2.0 stays unchanged.
1 parent 6162da5 commit a614a28

112 files changed

Lines changed: 7912 additions & 2295 deletions

File tree

Some content is hidden

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

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ repos:
6262
language: system
6363
entry: end-of-file-fixer
6464
types: [text]
65-
exclude: ^\.codegenius/learnings\.md$
65+
exclude: ^\.codegenius/
6666

6767
- id: check-yaml
6868
name: check yaml
@@ -174,7 +174,7 @@ repos:
174174
language: system
175175
entry: mdformat --number
176176
files: \.(md)$
177-
exclude: ^(CHANGELOG\.md|\.codegenius/learnings\.md)$
177+
exclude: ^(CHANGELOG\.md$|\.codegenius/)
178178
args: [
179179
--number, # Force 1., 2., 3. instead of all 1.
180180
--wrap=keep, # Preserve existing line breaks
@@ -255,7 +255,7 @@ repos:
255255
language: system
256256
entry: pymarkdown --disable-rules MD013,MD024 scan
257257
files: \.(md)$
258-
exclude: ^\.codegenius/learnings\.md$
258+
exclude: ^\.codegenius/
259259

260260
# ----------------------------------------------------------------------------
261261
# 3.5 Lint Shell Script (bashate)

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
- `pytest -n auto path/to/test.py` — run a test file
1818
- `pytest path/to/test.py::test_name` — run a single test
1919

20+
## uv usage
21+
22+
Always pass `--no-sync` to `uv run`: `uv run --no-sync --active …`.
23+
24+
`uv run` implicitly syncs the active project to its default-groups before running, which re-resolves dependencies and can clobber a venv's group-pinned packages — e.g. the torch pin in `.venv-lowest-torch`/`.venv-highest-torch` gets re-anchored back to the default torch. Our Make targets always prepare the environment first via `use_env`/`setup_env.sh`, so by the time `uv run` executes the deps are already correct. A `uv run` invocation should be a read-only run of a command in that prepared env, never a dependency mutation — `--no-sync` enforces that.
25+
2026
## Editing Guidelines
2127

2228
- Use `@path` to reference small files (loaded into every session automatically).

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Before pushing your changes, run these locally:
6969
- `make check` — full lint and `mypy` type-check pass
7070
- `make test` — full test suite (parallelized with `pytest-xdist`)
7171
- `make test-fast` — excludes tests marked `@pytest.mark.slow` for quicker iteration
72+
- `make test-smoke` — builds the package, installs it into a clean environment, and verifies that imports plus basic quantization and palettization work end to end
7273

7374
A clean `make check` and `make test` are required before a pull request will be reviewed.
7475

Makefile

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# Use of this source code is governed by a BSD-3-Clause license that can
44
# be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause
55

6-
.PHONY: _maybe_patch_pyproject all api-list build check clean distclean distclean-all docs docs-clean docs-open env env-all env-docs env-highest-torch env-latest-coreai env-tutorial set-auto-venv test test-coreai-compression test-cov test-export test-fast test-highest-pytorch test-lowest-pytorch test-slow version
6+
.PHONY: _maybe_patch_pyproject all api-list build check clean distclean distclean-all docs docs-clean docs-open env env-all env-docs env-highest-torch env-tutorial set-auto-venv test test-cov test-fast test-highest-pytorch test-lowest-pytorch test-slow test-smoke test-tutorials version
7+
8+
SHELL := /bin/bash
79

810
# Directory holding this Makefile, derived from its own location so the same
911
# recipes work in both contexts:
@@ -161,7 +163,7 @@ endif
161163
# =============================================================================
162164

163165
# Default target - run full workflow
164-
all: clean distclean-all env-all check test-export test-lowest-pytorch test-highest-pytorch build
166+
all: clean distclean-all env-all check test-lowest-pytorch test-highest-pytorch build
165167

166168
# =============================================================================
167169
# Environment Setup
@@ -177,10 +179,6 @@ env-highest-torch: _maybe_patch_pyproject
177179
@$(SETUP_ENV) --venv $(VENV_HIGHEST_TORCH) --python-version $(PYTHON_VERSION) --with-highest_tested_torch
178180
@$(call write_active_venv,$(VENV_HIGHEST_TORCH))
179181

180-
# Set up development environment with latest CoreAI for export testing
181-
env-latest-coreai: _maybe_patch_pyproject
182-
@$(SETUP_ENV) --venv .venv_latest_coreai --python-version $(PYTHON_VERSION) --with-latest-coreai --without-stable-coreai
183-
184182
# Set up environment for running tutorials (quantization notebook)
185183
env-tutorial: _maybe_patch_pyproject
186184
@$(SETUP_ENV) --venv $(VENV_TUTORIAL) --python-version $(PYTHON_VERSION) --with-tutorial
@@ -198,7 +196,7 @@ env-all: _maybe_patch_pyproject
198196

199197
# Build package
200198
build:
201-
@$(call use_env,VENV) && uv run --active python $(SCRIPTS)/make/build.py
199+
@$(call use_env,VENV) && uv run --no-sync --active python $(SCRIPTS)/make/build.py
202200

203201
# =============================================================================
204202
# Code Quality
@@ -207,13 +205,13 @@ build:
207205
# Print public API surface (symbols declared in __all__ across all public packages).
208206
# Pass MODULE= to inspect a single module: make api-list MODULE=coreai_opt.quantization.spec.spec
209207
api-list:
210-
@$(call use_env,VENV) && uv run --active python $(SCRIPTS)/make/print_api_list.py $(MODULE)
208+
@$(call use_env,VENV) && uv run --no-sync --active python $(SCRIPTS)/make/print_api_list.py $(MODULE)
211209

212210
# Run linting and type checking.
213211
check:
214212
@$(call use_env,VENV) && \
215213
echo "Running linting and formatting checks..." && \
216-
uv run --active pre-commit run --all-files && \
214+
uv run --no-sync --active pre-commit run --all-files && \
217215
echo "All checks passed!"
218216

219217
# =============================================================================
@@ -236,20 +234,19 @@ test-fast:
236234
test-slow:
237235
@$(MAKE) test PYTEST_ARGS="--marker slow"
238236

239-
# Run export tests with latest CoreAI (pass PYTEST_ARGS for custom flags)
240-
test-export: env-latest-coreai
241-
@$(SCRIPTS)/make/run_tests_on_latest_coreai.sh --path tests/export/ $(PYTEST_ARGS)
242-
243-
# Run coreai compression tests with latest CoreAI (pass PYTEST_ARGS for custom flags)
244-
test-coreai-compression: env-latest-coreai
245-
@$(SCRIPTS)/make/run_tests_on_latest_coreai.sh --path tests/coreai_utils/ $(PYTEST_ARGS)
237+
# Run smoke tests only (pass PYTEST_ARGS for custom flags, e.g., make test-smoke PYTEST_ARGS="--junitxml=results.xml").
238+
test-smoke:
239+
@$(call use_env,VENV) && \
240+
echo "Running smoke tests..." && \
241+
uv run --no-sync --active nox -f $(MAKEFILE_DIR)ci/nox/noxfile.py -s smoke_tests -- $(PYTEST_ARGS) && \
242+
echo "All smoke tests passed!"
246243

247244
# Run tests on lowest supported PyTorch version (pass PYTEST_ARGS for custom flags)
248245
test-lowest-pytorch:
249246
@echo "Running tests on lowest PyTorch version supported..."
250-
@$(call use_env,VENV_LOWEST_TORCH,--with-lowest_tested_torch --without-stable-coreai) && \
247+
@$(call use_env,VENV_LOWEST_TORCH,--with-lowest_tested_torch) && \
251248
echo "Testing with lowest supported PyTorch versions" && \
252-
uv run --active python $(SCRIPTS)/make/log_versions.py && \
249+
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
253250
$(RUN_TESTS) $(PYTEST_ARGS) && \
254251
echo "All tests passed!"
255252

@@ -258,10 +255,17 @@ test-highest-pytorch:
258255
@echo "Running tests on highest PyTorch version supported..."
259256
@$(call use_env,VENV_HIGHEST_TORCH,--with-highest_tested_torch) && \
260257
echo "Testing with latest supported PyTorch versions" && \
261-
uv run --active python $(SCRIPTS)/make/log_versions.py && \
258+
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
262259
$(RUN_TESTS) $(PYTEST_ARGS) && \
263260
echo "All tests passed!"
264261

262+
# Run tutorial notebook tests
263+
test-tutorials:
264+
@$(call use_env,VENV_TUTORIAL,--with-tutorial --with-test) && \
265+
echo "Running tutorial notebook tests..." && \
266+
$(RUN_TESTS) --path $(DOCS_DIR)/tests/test_tutorials.py $(PYTEST_ARGS) && \
267+
echo "All tutorial tests passed!"
268+
265269
# =============================================================================
266270
# Maintenance
267271
# =============================================================================
@@ -288,7 +292,7 @@ set-auto-venv:
288292

289293
# Show current version
290294
version:
291-
@python -c "exec(open('./src/coreai_opt/_about.py').read()); print(__version__)"
295+
@python -c "exec(open('$(MAKEFILE_DIR)src/coreai_opt/_about.py').read()); print(__version__)"
292296

293297
# =============================================================================
294298
# Documentation
@@ -316,7 +320,7 @@ endif
316320
@echo "==> [4/5] Setting up docs environment" && \
317321
$(call use_env,VENV_DOCS,--with-docs) && \
318322
echo "==> [5/5] Building documentation" && \
319-
cd $(DOCS_DIR) && uv run --active sphinx-build -E -b html src build/html
323+
cd $(DOCS_DIR) && uv run --no-sync --active sphinx-build -E -b html src build/html
320324
ifndef _DOCS_ALL
321325
@echo ""
322326
@echo "════════════════════════════════════════════════════════════════════"

agents/llm-first-principles.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-s
99
- [3. Surgical Changes](#3-surgical-changes)
1010
- [4. Goal-Driven Execution](#4-goal-driven-execution)
1111
- [Success Indicators](#success-indicators)
12+
- [References](#references)
1213

1314
## 1. Think Before Coding
1415

@@ -78,3 +79,7 @@ These principles are working when:
7879
- Diffs contain fewer unrelated changes.
7980
- Fewer rewrites stem from overcomplication.
8081
- Clarifying questions arrive before mistakes, not after.
82+
83+
## References
84+
85+
The principles above are adapted from Andrej Karpathy's coding guidance, via the [andrej-karpathy-skills](https://github.com/multica-ai/andrej-karpathy-skills) project (MIT License).

ci/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2026 Apple Inc.
2+
#
3+
# Use of this source code is governed by a BSD-3-Clause license that can
4+
# be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause

ci/nox/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2026 Apple Inc.
2+
#
3+
# Use of this source code is governed by a BSD-3-Clause license that can
4+
# be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause

ci/nox/merge_pytest_results.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright 2026 Apple Inc.
4+
#
5+
# Use of this source code is governed by a BSD-3-Clause license that can
6+
# be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause
7+
8+
"""Merge multiple pytest JUnit XML result files into a single file.
9+
10+
This script is used in CI to combine session-specific pytest results
11+
(e.g., pytest-results-3.10.xml, pytest-results-3.11.xml) into a single
12+
pytest-results.xml file.
13+
14+
Usage:
15+
python merge_pytest_results.py [--input-dir DIR] [--output FILE] [--pattern PATTERN]
16+
17+
Examples:
18+
python merge_pytest_results.py --input-dir results --output combined.xml
19+
"""
20+
21+
import argparse
22+
import logging
23+
import sys
24+
from pathlib import Path
25+
26+
from junitparser import JUnitXml
27+
28+
# Configure logging
29+
logging.basicConfig(
30+
level=logging.INFO,
31+
format="%(levelname)s: %(message)s",
32+
)
33+
34+
35+
def merge_junit_xml_files(
36+
input_dir: str = "test-results",
37+
output_file: str = "test-results/pytest-results.xml",
38+
pattern: str = "pytest-results-*.xml",
39+
) -> bool:
40+
"""Merge multiple JUnit XML files into a single file.
41+
42+
Args:
43+
input_dir: Directory containing the XML files to merge
44+
output_file: Path to the output merged XML file
45+
pattern: Glob pattern for matching input files
46+
47+
Returns:
48+
True if merge was successful, False otherwise
49+
"""
50+
input_path = Path(input_dir)
51+
xml_files = list(input_path.glob(pattern))
52+
53+
if not xml_files:
54+
logging.info(f"No files matching '{pattern}' found in {input_dir}, nothing to merge")
55+
return True
56+
57+
logging.info(f"Found {len(xml_files)} XML files to merge:")
58+
for f in sorted(xml_files):
59+
logging.info(f" - {f}")
60+
61+
merged = JUnitXml()
62+
for xml_file in sorted(xml_files):
63+
try:
64+
merged += JUnitXml.fromfile(str(xml_file))
65+
except Exception as e:
66+
logging.error(f"Error parsing {xml_file}: {e}")
67+
return False
68+
69+
output_path = Path(output_file)
70+
output_path.parent.mkdir(parents=True, exist_ok=True)
71+
merged.write(str(output_path))
72+
73+
logging.info(f"Successfully merged into {output_file}")
74+
return True
75+
76+
77+
def main() -> int:
78+
parser = argparse.ArgumentParser(
79+
description="Merge multiple pytest JUnit XML result files into a single file."
80+
)
81+
parser.add_argument(
82+
"--input-dir",
83+
default="test-results",
84+
help="Directory containing XML files to merge (default: test-results)",
85+
)
86+
parser.add_argument(
87+
"--output",
88+
default="test-results/pytest-results.xml",
89+
help="Output file path (default: test-results/pytest-results.xml)",
90+
)
91+
parser.add_argument(
92+
"--pattern",
93+
default="pytest-results-*.xml",
94+
help="Glob pattern for input files (default: pytest-results-*.xml)",
95+
)
96+
97+
args = parser.parse_args()
98+
99+
success = merge_junit_xml_files(
100+
input_dir=args.input_dir,
101+
output_file=args.output,
102+
pattern=args.pattern,
103+
)
104+
105+
return not success
106+
107+
108+
if __name__ == "__main__":
109+
sys.exit(main())

0 commit comments

Comments
 (0)