Skip to content
Open
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
28 changes: 28 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[flake8]
max-line-length = 88
extend-ignore =
E203,
E266,
E402,
E501,
E741,
F541,
F811,
F824,
W503,
W291,
W293,
W391
per-file-ignores =
tests/*:F401,F811,F405,F403,F841,E402,E712,E713
exclude =
.git,
__pycache__,
build,
dist,
.eggs,
*.egg-info,
venv,
.venv,
src/madengine/scripts/,
tests/fixtures/dummy/scripts/
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run tests
run: pytest -m "not slow and not integration" --ignore=tests/e2e/

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -e ".[dev]"
Comment thread
coketaste marked this conversation as resolved.
- name: Check formatting (black)
run: black --check src/ tests/
- name: Check imports (isort)
run: isort --check src/ tests/
- name: Lint (flake8)
run: flake8 src/ tests/
109 changes: 109 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Publish to PyPI

on:
release:
types: [published]
workflow_dispatch:
inputs:
target:
description: 'Publish target'
required: true
default: 'testpypi'
type: choice
options:
- testpypi
- pypi

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: pip install build
- name: Build sdist and wheel
run: python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

test-install:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install wheel
run: pip install dist/*.whl
- name: Verify CLI entry point
run: madengine --help
- name: Verify import and version
run: python -c "import madengine; print(madengine.__version__)"
- name: Verify package assets
run: |
python -c "
from pathlib import Path
import madengine
pkg = Path(madengine.__file__).parent
missing = []
for p in [
'scripts/common/tools.json',
'deployment/templates/kubernetes/job.yaml.j2',
'deployment/templates/slurm/job.sh.j2',
'py.typed',
]:
if not (pkg / p).exists():
missing.append(p)
if missing:
raise SystemExit(f'Missing package assets: {missing}')
print('All package assets verified')
"

Comment thread
coketaste marked this conversation as resolved.
publish-testpypi:
needs: test-install
if: >-
github.event_name == 'workflow_dispatch' &&
github.event.inputs.target == 'testpypi'
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-pypi:
needs: test-install
if: >-
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' &&
github.event.inputs.target == 'pypi')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
*.whl
*.tar.gz

# PyInstaller
# Usually these files are written by a Python script from a template
Expand Down
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- **Profiling**: `rocm_trace_lite` now sets `RTL_MODE=lite` explicitly; added tool `rocm_trace_lite_default` with `RTL_MODE=default` for A/B overhead comparison. `rtl_trace_wrapper.sh` passes `rtl trace --mode …` when `RTL_MODE` is set.

## [2.0.2] - 2026-04-28
## [2.1.0] - 2026-04-28

### Changed

- **Modern PyPI packaging**: Migrated from legacy `setup.py` to `pyproject.toml`-only build using `hatchling` as the build backend. Version is now derived automatically from git tags via `versioningit` — no hardcoded version strings. Added PyPI classifiers, keywords, license metadata, and `py.typed` (PEP 561) marker for type checker support.

- **Python 3.9+ baseline**: Raised minimum Python version from 3.8 to 3.9. Updated `black`, `mypy`, and classifier targets accordingly.

- **Dependency lower bounds**: All core dependencies now specify minimum version constraints (e.g. `pandas>=1.3`, `sqlalchemy>=1.4`) instead of unpinned names, improving reproducibility.

### Added

- **CI workflow** (`.github/workflows/ci.yml`): Runs unit tests on Python 3.9–3.12 matrix and lint checks (black, isort, flake8) on every push/PR to `develop` and `main`.

- **Publish workflow** (`.github/workflows/publish.yml`): Builds sdist + wheel, verifies install and CLI entry point across Python 3.9–3.12, then publishes via PyPI trusted publishing. Supports manual dispatch to TestPyPI and automatic publish on GitHub release.

- **`MANIFEST.in`**: Ensures `LICENSE`, `README.md`, `CHANGELOG.md`, scripts, presets, and templates are included in source distributions.

### Removed

- **`setup.py`**: Deleted the 307-line legacy setup script. All packaging configuration now lives in `pyproject.toml`.

### Fixed

Expand Down Expand Up @@ -482,7 +502,7 @@ madengine run --tags model --additional-context '{
### 📝 Installation & Setup

#### Requirements
- **Python**: 3.8+ (use `typing_extensions` for 3.8 compatibility)
- **Python**: 3.9+ (3.8 support dropped in v2.0.2)
- **Docker**: Required for all execution (local and distributed)
- **MAD Package**: Separate repo (`git clone https://github.com/ROCm/MAD.git`) for model definitions
- **Pre-commit** (dev): `pip install pre-commit && pre-commit install`
Expand Down
65 changes: 45 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,49 @@ authors = [
]
description = "MAD Engine is a set of interfaces to run various AI models from public MAD."
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT"}
requires-python = ">=3.9"
keywords = ["ai", "ml", "docker", "rocm", "amd", "benchmark", "automation", "gpu"]
dependencies = [
"pandas",
"GitPython",
"jsondiff",
"sqlalchemy",
"paramiko",
"tqdm",
"typing-extensions",
"pymongo",
"toml",
"pandas>=1.3",
"GitPython>=3.1",
"jsondiff>=2.0",
"sqlalchemy>=1.4",
"paramiko>=2.9",
"tqdm>=4.60",
"typing-extensions>=4.0",
"pymongo>=4.0",
"toml>=0.10",
"typer>=0.9.0",
"rich>=13.0.0",
"click>=8.0.0",
"jinja2>=3.0.0",
"pyyaml>=6.0",
]
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Testing",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]

[project.scripts]
madengine = "madengine.cli.app:cli_main"

[project.urls]
Homepage = "https://github.com/ROCm/madengine"
Repository = "https://github.com/ROCm/madengine"
Issues = "https://github.com/ROCm/madengine/issues"
Changelog = "https://github.com/ROCm/madengine/blob/develop/CHANGELOG.md"

[project.optional-dependencies]
dev = [
Expand Down Expand Up @@ -75,11 +89,11 @@ all = [
"pre-commit",
]

[tool.hatch.build.targets.wheel]

[tool.hatch.build.targets.wheel.force-include]
"src/madengine/scripts" = "madengine/scripts"
"src/madengine/deployment/templates" = "madengine/deployment/templates"
[tool.hatch.build]
artifacts = [
"src/madengine/scripts/**/*",
"src/madengine/deployment/templates/**/*",
]

Comment thread
coketaste marked this conversation as resolved.
[tool.hatch.version]
source = "versioningit"
Expand All @@ -99,7 +113,7 @@ distance-dirty = "{base_version}.post{distance}+{vcs}{rev}.d{build_date:%Y%m%d}"
# Code formatting and linting configuration
[tool.black]
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'
extend-exclude = '''
/(
Expand All @@ -123,7 +137,7 @@ known_first_party = ["madengine"]
known_third_party = ["pytest", "pandas", "numpy", "sqlalchemy"]

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
Expand All @@ -150,11 +164,22 @@ ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = ["tests"]
python_paths = ["src"]
addopts = "-v --tb=short"
pythonpath = ["src"]
addopts = "-v --tb=short -ra --strict-markers"
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"e2e: End-to-end tests (require full environment, Docker, may be very slow)",
"gpu: Tests that require GPU hardware",
"amd: Tests specific to AMD GPUs",
"nvidia: Tests specific to NVIDIA GPUs",
"cpu: Tests for CPU-only execution",
"requires_docker: Tests that require Docker daemon",
"requires_models: Tests that require model fixtures",
]

[tool.coverage.run]
Expand Down
Loading
Loading