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
40 changes: 18 additions & 22 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,34 @@ We accept code contributions through pull requests.
In short, this is how that works.

1. Fork [the repository](https://github.com/compas-dev/compas_framework) and clone the fork.
2. Create a virtual environment using your tool of choice (e.g. `virtualenv`, `conda`, etc).
3. Install development dependencies:
2. Install Python 3.12–3.14 and [uv](https://docs.astral.sh/uv/).
3. From the repository root, synchronize the locked tooling environment:

```bash
python -m pip install -e ".[dev,docs]"
uv sync --locked --project .github/tooling
```

4. Make sure all tests pass:
4. Start making changes on a branch based on `main`.
5. Run the ordinary checks:

```bash
invoke test
uv run --no-sync --project .github/tooling ruff check .
uv run --no-sync --project .github/tooling ruff format --check .
uv run --no-sync --project .github/tooling pyright
uv run --no-sync --project .github/tooling pytest -p no:cacheprovider tests/test_package.py
uv run --no-sync --project .github/tooling mkdocs build --strict
```

5. Start making your changes on a feature branch based on **main**.
6. Make sure all tests still pass:
6. Commit, push, and open a pull request.

```bash
invoke test
```

7. Commit your changes and push your branch to GitHub.
8. Create a [pull request](https://help.github.com/articles/about-pull-requests/) through the GitHub website.

During development, use [pyinvoke](http://docs.pyinvoke.org/) tasks on the
command line to ease recurring operations:
The tooling environment installs repository checks independently of the
framework and its native dependencies. Use an environment documented by the
owning package when running native or cross-package integration.

* `invoke clean`: Clean all generated artifacts.
* `invoke check`: Run various code and documentation style checks.
* `invoke test`: Run all tests and checks in one swift command.
* `invoke typecheck`: Run Pyright over integration code and tests.
* `invoke docs`: Build the MkDocs documentation.
* `invoke`: Show available tasks.
Use the canonical checkout for each repository. Keep one writer per repository
and record checkpoints in the initiative handoff or draft PR. Create an
additional worktree only when explicitly requested, with a visible path and
owner recorded in the handoff.

## Bug reports

Expand Down
18 changes: 18 additions & 0 deletions .github/tooling/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[project]
name = "compas-framework-tooling"
version = "0.0.0"
requires-python = ">=3.12,<3.15"

[dependency-groups]
dev = [
"mkdocs==1.6.1",
"mkdocs-material==9.8.0",
"mkdocstrings[python]==0.30.1",
"pymdown-extensions==11.0.2",
"pyright==1.1.414",
"pytest==9.2.0",
"ruff==0.17.4",
]

[tool.uv]
package = false
728 changes: 728 additions & 0 deletions .github/tooling/uv.lock

Large diffs are not rendered by default.

46 changes: 36 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,50 @@ name: build

on:
push:
branches:
- main
branches: [main]
pull_request:
branches:
- main

permissions:
contents: read

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10", "3.11", "3.12"]
python: ["3.12", "3.13", "3.14"]
env:
PYTHONDONTWRITEBYTECODE: "1"
UV_PYTHON: ${{ matrix.python }}
RUFF_NO_CACHE: "true"

steps:
- uses: compas-dev/compas-actions.build@v4
- name: Configure temporary tool environment
shell: bash
run: echo "UV_PROJECT_ENVIRONMENT=$RUNNER_TEMP/framework-tooling" >> "$GITHUB_ENV"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
with:
python: ${{ matrix.python }}
invoke_lint: true
invoke_test: true
version: "0.12.7"
- run: uv sync --locked --project .github/tooling
- name: Lint and format
run: |
uv run --no-sync --project .github/tooling ruff check .
uv run --no-sync --project .github/tooling ruff format --check .
- name: Type check
run: uv run --no-sync --project .github/tooling pyright
- name: Run pure package tests
run: >-
uv run --no-sync --project .github/tooling pytest
--basetemp "${{ runner.temp }}/framework-pytest" -p no:cacheprovider tests/test_package.py
25 changes: 23 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,32 @@ on:
tags:
- 'v*'
pull_request:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest
permissions:
contents: read
env:
UV_PYTHON: "3.12"
steps:
- name: Configure temporary tool environment
run: echo "UV_PROJECT_ENVIRONMENT=$RUNNER_TEMP/framework-docs" >> "$GITHUB_ENV"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
with:
version: "0.12.7"
- run: uv sync --locked --project .github/tooling
- run: uv run --no-sync --project .github/tooling mkdocs build --strict --site-dir "$RUNNER_TEMP/site"

deploy:
if: github.event_name == 'push'
needs: docs
runs-on: ubuntu-latest
steps:
- uses: compas-dev/compas-actions.docs@v4
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/framework-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: framework-install

on:
workflow_dispatch:

permissions:
contents: read

jobs:
targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: targets
run: |
matrix=$(jq -ce '{os: .install_check_os, python: .python}' framework-matrix.json)
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
with:
version: "0.12.7"
- name: Build the metapackage wheel
run: |
mkdir -p "$RUNNER_TEMP/framework-source"
git archive --format=tar HEAD | tar -xf - -C "$RUNNER_TEMP/framework-source"
uv build --wheel --no-sources "$RUNNER_TEMP/framework-source" --out-dir "$RUNNER_TEMP/framework-dist"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: framework-install-wheel
path: ${{ runner.temp }}/framework-dist/*.whl
if-no-files-found: error

install:
needs: targets
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.targets.outputs.matrix) }}
defaults:
run:
shell: bash
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: framework-install-wheel
path: ${{ runner.temp }}/framework-dist
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@ae62891fec2bb8e7d6c99fc78c9fec3a63790f8d # v10.0.0
with:
version: "0.12.7"
- name: Resolve and install the complete framework from PyPI
working-directory: ${{ runner.temp }}
run: |
uv venv framework-smoke --python "$(command -v python)"
smoke_python=framework-smoke/bin/python
if [[ "$RUNNER_OS" == Windows ]]; then
smoke_python=framework-smoke/Scripts/python.exe
fi
uv pip install --no-config --python "$smoke_python" --default-index https://pypi.org/simple framework-dist/*.whl
uv pip check --python "$smoke_python"
"$smoke_python" -I -c "import compas_framework; assert compas_framework.__version__"
11 changes: 7 additions & 4 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ name: verify-pr-checklist
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- master

permissions:
contents: read
pull-requests: read

jobs:
build:
name: Check Actions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Changelog check
uses: Zomzog/changelog-checker@v1.2.0
with:
Expand Down
20 changes: 18 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ These instructions apply to the entire repository.
- Use `TYPE_CHECKING` for dependencies imported only for annotations, especially optional or heavy geometry and GUI dependencies.
- Do not hide integration problems behind broad exception handling or optional imports. Skip tests only for explicitly optional system capabilities.

## Checkouts and Progress

- Work in each repository's canonical checkout on the agreed task branch.
Check the branch and working tree before editing, and preserve existing changes.
- Create an additional worktree only when explicitly requested. Use an agreed,
visible path outside system temporary directories and record its path, branch,
owner, and cleanup status in the handoff.
- Assign one writer per repository at a time. Read-only work and writes in
distinct package repositories can run in parallel.
- At meaningful checkpoints, report the checkout, branch, changed files, and
verification status. When commits and pushes are authorized, keep the draft PR
current so progress is visible.
- Keep initiative handoffs short. Record the current checkpoint, evidence, and
up to three next tasks. Keep design details in the initiative plan and decisions.

## Framework Integration Contracts

- Exercise plugins through public COMPAS plugin APIs. Do not call backend implementation modules directly merely to make an integration test pass.
Expand All @@ -45,8 +60,9 @@ These instructions apply to the entire repository.
## Tests and Validation

- Run the smallest relevant tests first, then broaden validation in proportion to risk.
- Use the commands in `.github/CONTRIBUTING.md`: `invoke test`,
`invoke check`, `invoke typecheck`, `invoke docs`, and `invoke format`.
- Use the locked tooling environment and the commands in `.github/CONTRIBUTING.md`
for ordinary repository checks. Use the owning package's environment for native
and cross-package integration.
- Always run `git diff --check` for changed patches.
- Mark integration, roundtrip, performance, GUI, and native-backend tests so they can be selected independently.
- Test public behavior rather than implementation metadata. Prefer capability checks over platform-name checks.
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added a locked environment for repository checks without installing framework
runtime packages and a manual clean-install check for the full metapackage.

### Changed

* Run ordinary CI on pull requests to any base branch and use canonical
checkouts for initiative work.

### Removed


Expand Down
19 changes: 11 additions & 8 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Contributing

Install the project with development and documentation dependencies:
Install [uv](https://docs.astral.sh/uv/) and synchronize the tooling environment
from the repository root:

```bash
python -m pip install -e ".[dev,docs]"
uv sync --locked --project .github/tooling
```

Run focused tests while developing, then run the repository checks:

```bash
invoke test
invoke check
invoke typecheck
invoke docs
uv run --no-sync --project .github/tooling ruff check .
uv run --no-sync --project .github/tooling ruff format --check .
uv run --no-sync --project .github/tooling pyright
uv run --no-sync --project .github/tooling pytest -p no:cacheprovider tests/test_package.py
uv run --no-sync --project .github/tooling mkdocs build --strict
```

Integration tests and examples should use public APIs and span package
boundaries. Package-local fixes belong in the owning package repository.
Use the canonical checkout and keep checkpoints visible in the handoff or
draft PR. Install native dependencies separately using the owning package's
documented environment when working on cross-package integration.
14 changes: 12 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# Testing Strategy

Framework tests are organized by the contract they exercise:
Ordinary pull requests run a pure tooling check on Python 3.12–3.14 across
Linux, macOS, and Windows, plus a strict documentation build. The tooling check
does not install the framework or its runtime dependencies.

For a coordinated release, the manual `framework-install` workflow builds
one metapackage wheel and attempts a clean install of its required
dependencies from PyPI on each target in `framework-matrix.json`. Run it
after the intended upstream releases are available and record the result
alongside the runtime integration evidence.

Cross-package integration can cover:

- plugin discovery and dispatch through public COMPAS APIs;
- data roundtrips across serialization formats and package boundaries;
- end-to-end workflows combining geometry, algorithms, models, and viewing;
- performance baselines for representative cross-package operations; and
- packaging checks for the supported Python and operating-system matrix.
- installation checks for coordinated package releases.

Use the `integration`, `roundtrip`, `performance`, `gui`, and `native_backend`
markers to select tests by capability. Tests needing a display or native
Expand Down
4 changes: 4 additions & 0 deletions framework-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python": ["3.12", "3.13", "3.14"],
"install_check_os": ["ubuntu-latest", "macos-latest", "windows-latest"]
}
13 changes: 12 additions & 1 deletion tests/test_package.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import json
import tomllib
from pathlib import Path
from runpy import run_path


def test_version_is_available():
namespace = run_path(Path(__file__).parents[1] / "src" / "compas_framework" / "__init__.py")
namespace = run_path(str(Path(__file__).parents[1] / "src" / "compas_framework" / "__init__.py"))

assert namespace["__version__"]


def test_install_matrix_covers_declared_python_versions():
root = Path(__file__).resolve().parents[1]
project = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))["project"]
matrix = json.loads((root / "framework-matrix.json").read_text(encoding="utf-8"))
classifier_prefix = "Programming Language :: Python :: 3."
declared = {classifier.removeprefix("Programming Language :: Python :: ") for classifier in project["classifiers"] if classifier.startswith(classifier_prefix)}
assert set(matrix["python"]) == declared
Loading