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
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [main]

jobs:
build-and-test:
c-build-and-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -24,3 +24,21 @@ jobs:

- name: Test
run: ctest --preset unit_test --exclude-regex UnitTestDataLoader

python-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync

- name: Test
run: uv run pytest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

### Python
.venv
*/__pycache__/
**/__pycache__/
config.bin
*.npy

Expand Down
8 changes: 6 additions & 2 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ in
enable = true;
package = unstablePkgs.uv;
sync.enable = true;
sync.allExtras = true;
sync.arguments = [ "--all-groups" ];
};
};

Expand Down Expand Up @@ -66,9 +66,10 @@ in
cmake --preset unit_test
cmake --build --preset unit_test
ctest --preset unit_test
uv run pytest
'';
package = pkgs.bash;
description = "Run the full CI pipeline locally (configure, build, test)";
description = "Run the full CI pipeline locally (C + Python tests)";
};

};
Expand All @@ -78,6 +79,9 @@ in
};

enterShell = ''
if [ ! -L "$DEVENV_ROOT/.venv" ]; then
ln -sf "$DEVENV_STATE/venv" "$DEVENV_ROOT/.venv"
fi
echo
echo "Welcome back"
echo
Expand Down
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def main():
print("Hello from ondevicetraining!")


if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[project]
name = "odt"
version = "0.1.0"
description = "ODT Python pipeline: providers, ir2c, resource estimation for on-device training"
requires-python = ">=3.12"
dependencies = [
"elasticai-creator @ git+https://github.com/es-ude/elastic-ai.creator.git@training-implementation-provider",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["python/odt"]

[tool.pytest.ini_options]
testpaths = ["python/tests"]

[dependency-groups]
dev = [
"pytest>=8.0",
]
Empty file added python/odt/__init__.py
Empty file.
Empty file added python/odt/ir2c/__init__.py
Empty file.
Empty file.
Empty file.
Empty file added python/tests/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions python/tests/test_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Smoke test: verify package structure and creator dependency are accessible."""

from elasticai.creator.experimental.ir.implementation_provider.implementation_provider import (
TrainingImplementationProvider,
apply_training_provider,
)


def test_odt_package_importable():
from odt import providers, ir2c, resource_estimator

assert providers is not None
assert ir2c is not None
assert resource_estimator is not None


def test_creator_protocol_accessible():
assert hasattr(TrainingImplementationProvider, "model_attributes")
assert hasattr(TrainingImplementationProvider, "training_function")
assert hasattr(TrainingImplementationProvider, "optimizer")
assert hasattr(TrainingImplementationProvider, "loss")


def test_apply_training_provider_callable():
assert callable(apply_training_provider)
629 changes: 629 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading