Skip to content

feat: Initial Python project setup with monorepo structure#4

Merged
DamianReeves merged 6 commits intomainfrom
feature/python-project-setup
Jan 19, 2026
Merged

feat: Initial Python project setup with monorepo structure#4
DamianReeves merged 6 commits intomainfrom
feature/python-project-setup

Conversation

@DamianReeves
Copy link
Member

Summary

  • Set up morphir-python as a production-ready Python 3.14+ project with monorepo structure
  • Configure mise for tool management and uv for Python package management
  • Create two workspace packages: morphir (core library) and morphir-tools (CLI/extensions)
  • Set up strict type checking (mypy + pyright), linting (ruff), and testing (pytest + behave)
  • Add GitHub Actions CI/CD workflows for continuous integration and PyPI releases
  • Create documentation including AGENTS.md for code agent guidelines

Changes

Project Structure

morphir-python/
├── packages/
│   ├── morphir/           # Core library (IR models, types)
│   └── morphir-tools/     # CLI tools and extensions
├── tests/                 # Unit tests (pytest)
├── features/              # BDD tests (behave)
├── .config/mise/          # Tool configuration and tasks
└── .github/workflows/     # CI/CD pipelines

Development Tooling

  • Python 3.14 with strict type annotations
  • uv for fast package management with workspace support
  • mise for tool acquisition and task running
  • ruff for linting and formatting (Google-style docstrings)
  • mypy + pyright for dual type checking in strict mode
  • pytest + behave for TDD and BDD testing

Available Commands

mise run check      # Run all checks (lint, format, typecheck, tests)
mise run test       # Run pytest unit tests
mise run test-bdd   # Run behave BDD tests
mise run lint       # Run ruff linter
mise run typecheck  # Run mypy and pyright
mise run build      # Build packages

Test plan

  • mise install successfully installs Python 3.14 and uv
  • uv sync --all-groups installs all dependencies
  • mise run lint passes (All checks passed)
  • mise run format-check passes (12 files properly formatted)
  • mise run typecheck passes (mypy and pyright both clean)
  • mise run test passes (10 unit tests)
  • mise run test-bdd passes (3 scenarios, 11 steps)
  • mise run check passes (all checks combined)

🤖 Generated with Claude Code

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.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6afe20d788

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +11 to +12
@given("the Python environment is set up")
def step_python_environment_setup(context: Context) -> None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent NameError from TYPE_CHECKING-only Context

These step functions annotate context with Context, but Context is only imported under if TYPE_CHECKING earlier in the file and there is no from __future__ import annotations. On Python’s default runtime annotation evaluation, that means importing this module will raise NameError: name 'Context' is not defined, so Behave will fail before any steps run. This is environment-dependent on annotation evaluation (default in 3.11/3.12); without deferring annotations or quoting the type, the BDD tests will crash at import time.

Useful? React with 👍 / 👎.

Comment on lines 25 to 26
- name: Install dependencies
run: uv sync --group dev

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install Python 3.14 before uv sync

The workflow runs uv sync on ubuntu-latest without installing a Python interpreter, but the workspace and both packages require >=3.14. If the runner’s default Python is below 3.14 (the usual case on ubuntu-latest), uv sync will fail because no compatible interpreter is available, so lint/typecheck/test jobs won’t start. This will be avoided only if the runner image already ships Python 3.14 or you explicitly install it (e.g., actions/setup-python or uv python install) before the sync.

Useful? React with 👍 / 👎.

- 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
…mports

Add 'from __future__ import annotations' to defer annotation evaluation,
preventing NameError when Context type is only imported under TYPE_CHECKING.
@DamianReeves DamianReeves merged commit e8f1ce0 into main Jan 19, 2026
4 checks passed
@DamianReeves DamianReeves deleted the feature/python-project-setup branch January 19, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant