Skip to content

Commit e8f1ce0

Browse files
authored
feat: Initial Python project setup with monorepo structure (#4)
* feat: Initial Python project setup with monorepo structure Set up the morphir-python project as a production-ready Python port of Morphir with a monorepo structure supporting separate library and tools packages. Project infrastructure: - mise for tool management (Python 3.14, uv) - uv workspace with two packages: morphir (core library) and morphir-tools (CLI) - Strict type checking with mypy and pyright - Linting and formatting with ruff (Google-style docstrings) - Testing with pytest (unit) and behave (BDD) - GitHub Actions CI/CD workflows - Pre-commit hooks configuration Documentation: - Updated README.md with installation and development instructions - Created AGENTS.md with guidelines for code agents - Created .agents/skills/README.md for agentic skills (Agent Skills spec) This establishes the foundation for implementing the Morphir IR models and tooling in Python, following functional programming principles. * fix(ci): Add uv.lock for reproducible CI builds * fix(ci): Use --all-groups to install workspace packages * fix(ci): Install workspace packages in editable mode for tests * refactor(ci): Use mise tasks for consistent CI/local development - Add 'install' task to handle dependency sync and workspace package installation - Update CI workflow to use mise-action and mise tasks - Add XML coverage output to coverage task for CI reporting * fix: Add future annotations to prevent NameError with TYPE_CHECKING imports Add 'from __future__ import annotations' to defer annotation evaluation, preventing NameError when Context type is only imported under TYPE_CHECKING.
1 parent c89e60a commit e8f1ce0

Some content is hidden

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

42 files changed

+1927
-36
lines changed

.agents/skills/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Agent Skills
2+
3+
This directory contains agentic skills for the Morphir Python project, following the [Agent Skills Specification](https://agentskills.io/).
4+
5+
## What are Agent Skills?
6+
7+
Agent Skills are folders of instructions, scripts, and resources that AI agents can discover and use to perform tasks more accurately and efficiently. They provide a simple, open format for extending agent capabilities with:
8+
9+
- **Procedural knowledge** - Step-by-step instructions for complex tasks
10+
- **Contextual information** - Project-specific knowledge
11+
- **Scripts** - Executable code for common operations
12+
- **References** - Additional documentation
13+
14+
## Directory Structure
15+
16+
Each skill should be in its own subdirectory with a `SKILL.md` file:
17+
18+
```
19+
.agents/skills/
20+
├── README.md # This file
21+
├── skill-name/
22+
│ ├── SKILL.md # Required - skill definition
23+
│ ├── scripts/ # Optional - executable scripts
24+
│ ├── references/ # Optional - additional docs
25+
│ └── assets/ # Optional - templates, data files
26+
└── another-skill/
27+
└── SKILL.md
28+
```
29+
30+
## SKILL.md Format
31+
32+
Each skill must have a `SKILL.md` file with YAML frontmatter:
33+
34+
```yaml
35+
---
36+
name: skill-name
37+
description: A description of what this skill does and when to use it.
38+
license: Apache-2.0
39+
compatibility: Requirements (e.g., "Requires Python 3.14+")
40+
metadata:
41+
author: finos
42+
version: "1.0"
43+
---
44+
45+
# Skill Instructions
46+
47+
Step-by-step instructions for the skill...
48+
```
49+
50+
### Required Fields
51+
52+
| Field | Description |
53+
|-------|-------------|
54+
| `name` | Lowercase, hyphenated name (must match directory name) |
55+
| `description` | What the skill does and when to use it (max 1024 chars) |
56+
57+
### Optional Fields
58+
59+
| Field | Description |
60+
|-------|-------------|
61+
| `license` | License for the skill |
62+
| `compatibility` | Environment requirements |
63+
| `metadata` | Additional key-value metadata |
64+
| `allowed-tools` | Pre-approved tools for the skill |
65+
66+
## Creating a New Skill
67+
68+
1. Create a directory with your skill name (lowercase, hyphenated)
69+
2. Add a `SKILL.md` file with the required frontmatter
70+
3. Add any supporting scripts, references, or assets
71+
4. Test the skill with an agent to verify it works correctly
72+
73+
## Validation
74+
75+
Use the reference library to validate skills:
76+
77+
```bash
78+
npx skills-ref validate ./skill-name
79+
```
80+
81+
## Resources
82+
83+
- [Agent Skills Specification](https://agentskills.io/specification)
84+
- [Example Skills](https://github.com/anthropics/skills)
85+
- [Reference Library](https://github.com/agentskills/agentskills/tree/main/skills-ref)

.config/mise/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tools]
2+
python = "3.14"
3+
uv = "latest"
4+
5+
[env]
6+
VIRTUAL_ENV = "{{config_root}}/.venv"
7+
8+
[settings]
9+
experimental = true

.config/mise/tasks/build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Build all packages"
3+
set -euo pipefail
4+
5+
echo "Building morphir package..."
6+
uv build packages/morphir
7+
8+
echo "Building morphir-tools package..."
9+
uv build packages/morphir-tools
10+
11+
echo "Build complete!"

.config/mise/tasks/check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run all checks (lint, format, typecheck, tests)"
3+
#MISE depends=["lint", "format-check", "typecheck", "test-all"]
4+
set -euo pipefail
5+
6+
echo "All checks passed!"

.config/mise/tasks/clean

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Clean build artifacts and caches"
3+
set -euo pipefail
4+
5+
echo "Cleaning build artifacts..."
6+
rm -rf build/ dist/ .eggs/
7+
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
8+
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
9+
find . -type f -name "*.py[cod]" -delete 2>/dev/null || true
10+
11+
echo "Cleaning test artifacts..."
12+
rm -rf .pytest_cache/ .coverage htmlcov/ coverage.xml .hypothesis/
13+
14+
echo "Cleaning type checker caches..."
15+
rm -rf .mypy_cache/ .ruff_cache/ .pyright/
16+
17+
echo "Clean complete!"

.config/mise/tasks/coverage

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run tests with coverage report"
3+
set -euo pipefail
4+
5+
uv run pytest tests/ --cov=packages/morphir/src --cov=packages/morphir-tools/src --cov-report=term-missing --cov-report=html --cov-report=xml

.config/mise/tasks/format

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run ruff formatter on the codebase"
3+
set -euo pipefail
4+
5+
uv run ruff format .

.config/mise/tasks/format-check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Check code formatting without making changes"
3+
set -euo pipefail
4+
5+
uv run ruff format --check .

.config/mise/tasks/install

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Install all dependencies and workspace packages"
3+
set -euo pipefail
4+
5+
echo "Syncing dependencies..."
6+
uv sync --all-groups
7+
8+
echo "Installing workspace packages in editable mode..."
9+
uv pip install -e packages/morphir -e packages/morphir-tools
10+
11+
echo "Install complete!"

.config/mise/tasks/lint

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run ruff linter on the codebase"
3+
set -euo pipefail
4+
5+
uv run ruff check .

0 commit comments

Comments
 (0)