Skip to content

Commit 00ceb94

Browse files
Jammy2211claude
authored andcommitted
Add AI agent configs, issue templates, and update contributing guide
- AGENTS.md, .github/copilot-instructions.md for AI agent support - notify-workspaces.yml to dispatch API updates to autolens_workspace - Issue templates for feature requests and bug reports - CONTRIBUTING.md updated with AI-first workflow and code example guidance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 402fedf commit 00ceb94

6 files changed

Lines changed: 238 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or unexpected behaviour
4+
title: 'fix: '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
11+
<!-- Clear description of the bug -->
12+
13+
## Steps to Reproduce
14+
15+
1.
16+
2.
17+
3.
18+
19+
## Expected Behaviour
20+
21+
<!-- What should happen -->
22+
23+
## Actual Behaviour
24+
25+
<!-- What actually happens -->
26+
27+
## Environment
28+
29+
- OS:
30+
- Python version:
31+
- Package version:
32+
33+
## Original Prompt
34+
35+
<details>
36+
<summary>Click to expand starting prompt</summary>
37+
38+
<!-- If this issue was created from an AI prompt, paste the original prompt here -->
39+
40+
</details>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Feature / Task Request
3+
about: Propose a new feature, improvement, or task
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Overview
10+
11+
<!-- 2-4 sentence summary of what this task is and why it matters -->
12+
13+
## Plan
14+
15+
<!-- High-level bullet-point plan, human readable, no code -->
16+
17+
<details>
18+
<summary>Detailed implementation plan</summary>
19+
20+
### Affected Repositories
21+
<!-- List repos this touches, mark primary -->
22+
23+
### Implementation Steps
24+
<!-- Step-by-step with file paths and specifics -->
25+
26+
### Key Files
27+
<!-- List files that will be modified -->
28+
29+
</details>
30+
31+
## Example Code
32+
33+
<!-- If your feature involves a specific calculation, algorithm, or small piece of functionality,
34+
include example code here. Even a rough script, a working prototype, or a snippet showing
35+
the existing behaviour you want changed helps enormously.
36+
37+
Code gives AI agents and human contributors concrete context and dramatically reduces
38+
misunderstandings. Delete this section if not applicable. -->
39+
40+
```python
41+
# Paste your example code here
42+
```
43+
44+
## Original Prompt
45+
46+
<details>
47+
<summary>Click to expand starting prompt</summary>
48+
49+
<!-- If this issue was created from an AI prompt, paste the original prompt here -->
50+
51+
</details>

.github/copilot-instructions.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copilot Coding Agent Instructions
2+
3+
You are working on **PyAutoLens**, a Python library for strong gravitational lens modeling built on PyAutoGalaxy.
4+
5+
## Key Rules
6+
7+
- Run tests after every change: `python -m pytest test_autolens/`
8+
- Format code with `black autolens/`
9+
- All files must use Unix line endings (LF, `\n`)
10+
- Decorated functions (`@to_array`, `@to_grid`, `@to_vector_yx`) must return **raw arrays**, not autoarray wrappers
11+
- The `xp` parameter controls NumPy (`xp=np`) vs JAX (`xp=jnp`) — never import JAX at module level
12+
- Functions called inside `jax.jit` must guard autoarray wrapping with `if xp is np:`
13+
- If changing public API, clearly document what changed in your PR description — downstream workspaces depend on this
14+
15+
## Architecture
16+
17+
- `autolens/lens/``Tracer`, multi-plane ray-tracing, deflection logic
18+
- `autolens/imaging/`, `interferometer/`, `point/` — Dataset-specific fit and analysis classes
19+
- `autolens/plot/` — Visualisation for all data types
20+
- `autolens/aggregator/` — Results scraping
21+
- `test_autolens/` — Test suite
22+
23+
## Sandboxed runs
24+
25+
```bash
26+
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib python -m pytest test_autolens/
27+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Notify downstream workspaces when a PR is merged to main.
2+
#
3+
# Sends a repository_dispatch event to each workspace repo so they can
4+
# trigger an automated API update (via Copilot coding agent or similar).
5+
#
6+
# Required secret:
7+
# WORKSPACE_DISPATCH_TOKEN — PAT with repo scope on the target workspace
8+
# repositories.
9+
10+
name: Notify Workspaces
11+
12+
on:
13+
pull_request:
14+
types: [closed]
15+
branches: [main]
16+
17+
jobs:
18+
dispatch:
19+
if: github.event.pull_request.merged == true
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
workspace:
24+
- Jammy2211/autolens_workspace
25+
steps:
26+
- name: Send repository_dispatch
27+
env:
28+
GH_TOKEN: ${{ secrets.WORKSPACE_DISPATCH_TOKEN }}
29+
run: |
30+
gh api --method POST \
31+
-H "Accept: application/vnd.github+json" \
32+
"/repos/${{ matrix.workspace }}/dispatches" \
33+
-f "event_type=api-update" \
34+
-f "client_payload[pr_number]=${{ github.event.pull_request.number }}" \
35+
-f "client_payload[pr_title]=${{ github.event.pull_request.title }}" \
36+
-f "client_payload[pr_branch]=${{ github.event.pull_request.head.ref }}" \
37+
-f "client_payload[pr_url]=${{ github.event.pull_request.html_url }}"

AGENTS.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# PyAutoLens — Agent Instructions
2+
3+
**PyAutoLens** is a Python library for strong gravitational lens modeling, built on PyAutoGalaxy. It adds multi-plane ray-tracing via the `Tracer` object and lensing-specific fit/analysis classes.
4+
5+
## Setup
6+
7+
```bash
8+
pip install -e ".[dev]"
9+
```
10+
11+
## Running Tests
12+
13+
```bash
14+
python -m pytest test_autolens/
15+
python -m pytest test_autolens/lens/test_tracer.py
16+
python -m pytest test_autolens/imaging/test_fit_imaging.py -s
17+
```
18+
19+
### Sandboxed / Codex runs
20+
21+
```bash
22+
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib python -m pytest test_autolens/
23+
```
24+
25+
## Key Architecture
26+
27+
- **Tracer** (`lens/tracer.py`): groups galaxies by redshift plane, performs multi-plane ray-tracing
28+
- **Fit classes**: `FitImaging`, `FitInterferometer`, `FitPointDataset` — extend autogalaxy equivalents with lensing
29+
- **Analysis classes**: `AnalysisImaging`, `AnalysisInterferometer`, `AnalysisPoint`
30+
- **Namespace**: `al.mp.*` (mass), `al.lp.*` (light), `al.Galaxy`, `al.Tracer`
31+
32+
## Dependencies
33+
34+
- `autogalaxy` — galaxy morphology, profiles, single-plane fitting
35+
- `autoarray` — data structures, grids, masks, inversions
36+
- `autofit` — non-linear search and model-fitting framework
37+
38+
## Key Rules
39+
40+
- The `xp` parameter controls NumPy vs JAX: `xp=np` (default) or `xp=jnp`
41+
- Functions inside `jax.jit` must guard autoarray wrapping with `if xp is np:`
42+
- Decorated functions return **raw arrays** — the decorator wraps them
43+
- All files must use Unix line endings (LF)
44+
- Format with `black autolens/`
45+
46+
## Working on Issues
47+
48+
1. Read the issue description and any linked plan.
49+
2. Identify affected files and write your changes.
50+
3. Run the full test suite: `python -m pytest test_autolens/`
51+
4. Ensure all tests pass before opening a PR.
52+
5. If changing public API, note the change in your PR description — downstream workspaces may need updates.

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# AI-Assisted Development
2+
3+
This project uses an AI-first development workflow. Most features, bug fixes, and improvements are implemented through AI coding agents (Claude Code, GitHub Copilot, OpenAI Codex) working from structured issue descriptions.
4+
5+
## How It Works
6+
7+
1. **Issues are the starting point** — Every task begins as a GitHub issue with a structured format: an overview, a human-readable plan, a detailed implementation plan (in a collapsible block), and optionally the original prompt that generated the issue.
8+
9+
2. **AI agents pick up issues** — Issues can be assigned to AI coding agents (e.g. GitHub Copilot) which read the issue description, `AGENTS.md`, and `CLAUDE.md` for context, then implement the changes autonomously.
10+
11+
3. **Human review** — All AI-generated pull requests are reviewed by maintainers before merging.
12+
13+
## Creating an Issue
14+
15+
When opening an issue, please use the provided issue templates. The **Feature / Task Request** template follows our standard format:
16+
17+
- **Overview** — What and why, in 2-4 sentences
18+
- **Plan** — High-level bullet points (human-readable)
19+
- **Detailed implementation plan** — File paths, steps, key files (in a collapsible block)
20+
- **Original Prompt** — If you used an AI to help draft the issue, include the original prompt
21+
22+
If your feature involves a specific calculation, algorithm, or small piece of functionality — **include example code**. Even a rough script, a working prototype, or a snippet showing the existing behaviour you want to change makes a huge difference. Code examples give AI agents and human contributors concrete context to work from, and dramatically reduce misunderstandings about what you're asking for.
23+
24+
This structure ensures that both human contributors and AI agents can understand and act on the issue effectively.
25+
26+
## Contributing Without AI
27+
28+
Traditional contributions are equally welcome! If you prefer to work without AI tools, simply follow the development setup and pull request guidelines below. The issue templates are helpful for any contributor, AI or human.
29+
30+
---
31+
132
## Community Guidelines
233

334
We strive to maintain a welcoming, respectful, and inclusive community. All contributors—whether opening issues, submitting pull requests, reviewing code, or participating in discussions—are expected to follow these guidelines.

0 commit comments

Comments
 (0)