Skip to content

Commit cd3e0a6

Browse files
authored
Merge branch 'develop' into FXC-3943-fix-angle-spec-docs
2 parents 8445513 + 523418d commit cd3e0a6

Some content is hidden

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

51 files changed

+4906
-1292
lines changed

AGENTS.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Documentation
4+
- See the root `README.md` → “Project Overview” for a map of directories, and consult subdirectory READMEs for local nuances; follow those layouts when adding code.
5+
- Keep all README files, `docs/`, and this AGENTS.md in sync whenever tooling or behavior changes.
6+
- Prefer extending existing utilities in `scripts/` before adding new helper modules.
7+
8+
## Workflow & Tooling
9+
- Make sure your local environment is bootstrapped with `poetry install --extras dev` and `poetry run pre-commit install`; once that’s done on a machine, you shouldn’t need to repeat it unless dependencies change.
10+
- Prefix every repo command with `poetry run` to match CI.
11+
- Re-run `poetry run pytest` locally as part of your development loop; `pyproject.toml` already wires markers, doctests, coverage, and env vars.
12+
- The pre-commit hooks you enabled during onboarding run automatically; still run `poetry run pre-commit run --all-files` before opening a PR or when new hooks land so your tree matches `.pre-commit-config.yaml` and the checks in `.github/workflows/tidy3d-python-client-tests.yml` (covers `ruff format`, `ruff check`, doc hooks).
13+
14+
### Do / Don't
15+
- **Do** run `poetry run pre-commit run --all-files` before opening a PR; **don't** skip it even if individual hooks passed earlier.
16+
- **Do** stick to `poetry run …` commands; **don't** invoke tools outside Poetry, since that drifts from CI environments.
17+
- **Do** reuse `scripts/` utilities; **don't** add new helper modules without checking for an existing script first.
18+
19+
## Coding Style & Naming
20+
- Favor descriptive `snake_case` functions and `PascalCase` classes tied to the physics domain.
21+
- Most simulation and monitor classes subclass `Tidy3dBaseModel`; reserve `pydantic.BaseModel` for lightweight helpers (see `tidy3d/updater.py`), and rely on `.updated_copy(...)` plus shared validators in `tidy3d/components/validators.py`.
22+
- Public APIs covered in `docs/` should use the existing Numpy-inspired block pattern rendered by our Sphinx Book Theme; lean on current API examples or the theme reference at https://sphinx-book-theme.readthedocs.io/en/stable/reference/api-numpy.html. Internal helpers may keep short docstrings but match local tone.
23+
- Prefer `tidy3d.log.log` and `tidy3d.exceptions` for contributor-facing messages; touch stdlib `logging` only when muting external libraries such as `pyroots`.
24+
- Reuse types from `tidy3d/components/types`, domain constants from `tidy3d/constants`, and runtime defaults from `tidy3d/config`.
25+
26+
## Testing Guidelines
27+
- Mirror the source tree with `test_<feature>.py`, add a short module docstring, and import `tidy3d as td`; keep single-use fixtures local but upstream broadly useful helpers into `tests/conftest.py`.
28+
- Lean on `tests/conftest.py` for RNG seeding, matplotlib cleanup, logger reset, and autograd helpers, and use pytest’s `tmp_path` for artifacts.
29+
- `poetry run pytest` is the canonical entry point; the `pyproject` config already selects markers, doctests, coverage, xdist, and env vars, so reproduce CI locally before opening a PR.
30+
- Prefer pytest primitives (`pytest.raises`, `pytest.approx`, `@pytest.mark.parametrize`) for coverage, and add doctest snippets for new public APIs to keep docs and runtime behavior aligned.
31+
- Mock all external/web APIs in tests (e.g., `web.run`, HTTP clients) and assert the contract instead of hitting live services; CI must stay hermetic.
32+
- Numerical tests require explicit maintainer confirmation. They run real simulations and are excluded by default (`-m 'not numerical'`). When approved, run selectively via `poetry run pytest -m numerical path/to/test.py -k specific_case`.
33+
- Scope tests by path: `poetry run pytest -q tests/test_web/` or `poetry run pytest -q tidy3d/components/geometry/`.
34+
- Scope tests by keyword: `poetry run pytest -q -k "feature_name or module_name"`.
35+
- Keep repo defaults (incl. xdist); for speed disable coverage and mute warnings: `poetry run pytest -q --no-cov -W ignore tests/... --maxfail=1`.
36+
- Doctest a single module quickly: `poetry run pytest -q --no-cov -W ignore tidy3d/components/foo.py`.
37+
38+
## Schema Assets
39+
- Files under `schemas/` are generated artifacts; never edit them manually.
40+
- Run `poetry run python scripts/regenerate_schema.py` after model/serialization changes, and commit the output alongside the code.
41+
- CI reruns the script and fails the PR whenever checked-in schemas drift from regenerated results.
42+
43+
## Commit & Pull Request Guidelines
44+
- Follow Conventional Commits per `.commitlintrc.json`.
45+
- Branch names must use an allowed prefix (`chore`, `hotfix`, `daily-chore`) or include a Jira key to satisfy CI.
46+
- PRs should link issues, summarize behavior changes, list the `poetry run …` checks you executed, and call out docs/schema updates.
47+
48+
_Reminder: update this AGENTS.md whenever workflow, tooling, or review expectations change so agents stay in sync with the repo._

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
- Added a Gaussian inverse design filter option with autograd gradients and complete padding mode coverage.
3434
- Added support for argument passing to DRC file when running checks with `DRCRunner.run(..., drc_args={key: value})` in klayout plugin.
3535
- Added support for `nonlinear_spec` in `CustomMedium` and `CustomDispersiveMedium`.
36+
- `tidy3d.plugins.design.DesignSpace.run(..., fn_post=...)` now accepts a `priority` keyword to propagate vGPU queue priority to all automatically batched simulations.
37+
- Introduced `BroadbandPulse` for exciting simulations across a wide frequency spectrum.
38+
- Added `interp_spec` in `ModeSpec` to allow downsampling and interpolation of waveguide modes in frequency.
39+
- Added warning if port mesh refinement is incompatible with the `GridSpec` in the `TerminalComponentModeler`.
3640

3741
### Breaking Changes
3842
- Edge singularity correction at PEC and lossy metal edges defaults to `True`.
@@ -50,7 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5054
### Changed
5155
- Improved performance of antenna metrics calculation by utilizing cached wave amplitude calculations instead of recomputing wave amplitudes for each port excitation in the `TerminalComponentModelerData`.
5256
- Changed hashing method in `Tidy3dBaseModel` from sha256 to md5.
53-
- Allowing for more geometries in a ClipOperation geometry.
57+
- Removed validators on limiting the number of geometries in a ClipOperation geometry.
5458
- Improved the speed of computing `Box` shape derivatives when used inside a `GeometryGroup`.
5559
- All RF and microwave specific components now inherit from `MicrowaveBaseModel`.
5660
- `DirectivityMonitor` now forces `far_field_approx` to `True`, which was previously configurable.

README.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Name](https://img.shields.io/badge/pypi-tidy3d-blue?style=for-the-badge)](https://pypi.python.org/pypi/tidy3d)
44
[![PyPI version shields.io](https://img.shields.io/pypi/v/tidy3d.svg?style=for-the-badge)](https://pypi.python.org/pypi/tidy3d/)
55
[![Documentation Status](https://readthedocs.com/projects/flexcompute-tidy3ddocumentation/badge/?version=latest&style=for-the-badge)](https://flexcompute-tidy3ddocumentation.readthedocs-hosted.com/?badge=latest)
6-
![Tests](https://img.shields.io/github/actions/workflow/status/flexcompute/tidy3d/run_tests.yml?style=for-the-badge)
7-
![License](https://img.shields.io/github/license/flexcompute/tidy3d?style=for-the-badge)
8-
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/psf/black)
6+
[![Tests](https://img.shields.io/github/actions/workflow/status/flexcompute/tidy3d/tidy3d-python-client-tests.yml?branch=develop&style=for-the-badge)](https://github.com/flexcompute/tidy3d/actions/workflows/tidy3d-python-client-tests.yml)
7+
[![License: LGPL-2.1](https://img.shields.io/badge/license-LGPL--2.1-blue?style=for-the-badge)](LICENSE)
8+
[![Ruff](https://img.shields.io/badge/code%20style-ruff-5A4FCF?style=for-the-badge)](https://github.com/astral-sh/ruff)
99
![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/daquinteroflex/4702549574741e87deaadba436218ebd/raw/tidy3d_extension.json)
1010

1111
[![Notebooks](https://img.shields.io/badge/Demo-Live%20notebooks-8A2BE2?style=for-the-badge)](https://github.com/flexcompute/tidy3d-notebooks)
@@ -20,7 +20,6 @@ This repository contains the python API to allow you to:
2020
* Submit and manage simulations running on Flexcompute's servers.
2121
* Download and postprocess the results from the simulations.
2222

23-
2423
![](https://raw.githubusercontent.com/flexcompute/tidy3d/main/img/snippet.png)
2524

2625
## Installation
@@ -74,6 +73,69 @@ To get started, our documentation has a lot of [examples](https://docs.flexcompu
7473
| FAQ | https://docs.flexcompute.com/projects/tidy3d/en/latest/faq/docs/index.html |
7574

7675

76+
## FlexAgent MCP
77+
78+
FlexAgent adds an AI-assisted layer on top of Tidy3D via the Model Context Protocol (MCP); read more about [AI-assisted simulation in Tidy3D](https://hs.flexcompute.com/news/ai-assisted-simulation-in-tidy3d-ushering-in-a-new-era-of-photonic-design). Install the `tidy3d-mcp` server when you want that experience inside an MCP client without the Tidy3D extension for [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Cursor](https://open-vsx.org/extension/Flexcompute/tidy3d).
79+
80+
These commands assume [uv](https://docs.astral.sh/uv/getting-started/installation/) is installed on your machine.
81+
82+
**Register the server with your MCP client** - use the block below that matches your CLI.
83+
84+
<details>
85+
<summary>Codex CLI / IDE</summary>
86+
87+
```bash
88+
codex mcp add tidy3d -- uvx tidy3d-mcp --api-key "YOUR_TIDY3D_API_KEY"
89+
```
90+
91+
</details>
92+
93+
<details>
94+
<summary>Claude CLI / Desktop / Code</summary>
95+
96+
```bash
97+
claude mcp add tidy3d -- uvx tidy3d-mcp --api-key "YOUR_TIDY3D_API_KEY"
98+
```
99+
100+
</details>
101+
102+
<details>
103+
<summary>Gemini CLI</summary>
104+
105+
Create or edit `.gemini/settings.json` (project) or `~/.gemini/settings.json` (global):
106+
107+
```json
108+
{
109+
"mcpServers": {
110+
"tidy3d": {
111+
"command": "uvx",
112+
"args": ["tidy3d-mcp", "--api-key", "YOUR_TIDY3D_API_KEY"]
113+
}
114+
}
115+
}
116+
```
117+
118+
</details>
119+
120+
<details>
121+
<summary>Cursor CLI / IDE</summary>
122+
123+
Cursor reuses the same schema across the editor and `cursor-agent`. Configure `.cursor/mcp.json` (per-project) or `~/.cursor/mcp.json` (global) and then run `cursor-agent mcp list` to verify:
124+
125+
```json
126+
{
127+
"mcpServers": {
128+
"tidy3d": {
129+
"command": "uvx",
130+
"args": ["tidy3d-mcp", "--api-key", "YOUR_TIDY3D_API_KEY"]
131+
}
132+
}
133+
}
134+
```
135+
136+
</details>
137+
138+
77139
## Related Source Repositories
78140

79141
| Name | Repository |

docs/api/mode.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ Mode Specifications
77
:toctree: _autosummary/
88
:template: module.rst
99

10-
tidy3d.ModeSpec
10+
tidy3d.ModeSpec
11+
tidy3d.ModeSortSpec
12+
tidy3d.ModeInterpSpec

docs/api/sources.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Source Time Dependence
3434

3535
tidy3d.GaussianPulse
3636
tidy3d.ContinuousWave
37+
tidy3d.BroadbandPulse
3738
tidy3d.SourceTime
3839
tidy3d.CustomSourceTime
3940

0 commit comments

Comments
 (0)